langchain-ai / langchain-aws

Build LangChain Applications on AWS
MIT License
63 stars 46 forks source link

Refactor ChatBedrock._combine_llm_outputs() to match other Langchain model output #67

Open adarmiento opened 1 month ago

adarmiento commented 1 month ago

_combine_llm_outputs() of different supported models hardcodes different keys. In this example, the token_usage key is different in

https://github.com/langchain-ai/langchain/blob/acaf214a4516a2ffbd2817f553f4d48e6a908695/libs/community/langchain_community/chat_models/bedrock.py#L321

and

https://github.com/langchain-ai/langchain/blob/acaf214a4516a2ffbd2817f553f4d48e6a908695/libs/partners/openai/langchain_openai/chat_models/base.py#L457

The outcome is that replacing one model with another is not transparent and can lead to issues, such as breaking monitoring