langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
84.81k stars 13.1k forks source link

community[mini]: Add stop_reason and stop_sequence to Bedrock Anthropic model output #20975

Closed Neet-Nestor closed 2 weeks ago

Neet-Nestor commented 2 weeks ago

Description: Currently, the output of Amazon Bedrock llms will ignore the stop_reason and stop_sequence fields in the output of Anthropic models, making it hard for users to rely on these fields to build agents.

Description of these two fields are described here: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-anthropic-claude-messages.html

This PR adds these two fields in the "metadata" output field if Bedrock returns them in the response so the downstream users could read and use the accordingly.

Dependencies: n/a

vercel[bot] commented 2 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **langchain** | ⬜️ Ignored ([Inspect](https://vercel.com/langchain/langchain/3dq23C455KooEkuYxEdfV2CUVywY)) | [Visit Preview](https://langchain-git-fork-neet-nestor-master-langchain.vercel.app) | | Apr 27, 2024 10:52pm |
Neet-Nestor commented 2 weeks ago

Seems this approach is not feasible as the llm model eventually will only return "text" back in _call