mem0
mem0 copied to clipboard
Support AWS bedrock LLM
🚀 The feature
https://python.langchain.com/docs/integrations/platforms/aws
Motivation, pitch
- We need to support more llms so that users have the flexibility of choosing whatever LLM they want to use.
- Langchain provides a standard interface for llms. This helps in better code maintenance and also helps in better observability.
@taranjeet please assign this to me
Hey @taranjeet @KapilM26 @sidmohanty11 you can do this with ChatLiteLLM in Langchain
from langchain.chat_models import ChatLiteLLM
from langchain.schema import AIMessage, HumanMessage, SystemMessage
chat = ChatLiteLLM(model="bedrock/anthropic.claude-v2")
messages = [
HumanMessage(
content="Translate this sentence from English to French. I love programming."
)
]
chat(messages)
Benefit over using the bedrock integration? Bedrock supports:
- Anthropic
- Cohere
- Amazon Titan
- AI21
Each has their own prompt formatting and input params (langchain doesn't natively map this).
Langchain Docs: https://python.langchain.com/docs/integrations/chat/litellm LiteLLM Docs: https://docs.litellm.ai/docs/providers/bedrock
You can also pass in provider-specific params: https://docs.litellm.ai/docs/completion/input#provider-specific-params