patterns-ai-core / langchainrb

Build LLM-powered applications in Ruby
https://rubydoc.info/gems/langchainrb
MIT License
1.18k stars 156 forks source link

aws bedrock streaming #630

Closed agomezcampero closed 1 month ago

agomezcampero commented 1 month ago

This PR adds streaming to Bedrock API similar to how it's handled in OpenAI. If no block is passed, the code works exactly the way it used to.

Usage:

Langchain::LLM::AwsBedrock.new.chat(messages:, model:) do |chunk|
  do_something(chunk)
end
image
andreibondarev commented 1 month ago

@agomezcampero Looks great, just 1 comment!

andreibondarev commented 1 month ago

@agomezcampero Great job, thank you!