mem0 icon indicating copy to clipboard operation
mem0 copied to clipboard

Support AWS bedrock LLM

Open taranjeet opened this issue 2 years ago • 2 comments

🚀 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 avatar Sep 26 '23 18:09 taranjeet

@taranjeet please assign this to me

KapilM26 avatar Oct 03 '23 13:10 KapilM26

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

krrishdholakia avatar Oct 21 '23 23:10 krrishdholakia