LangChain
Memori Cloud supports LangChain chat models. Each class has its own registration keyword: ChatOpenAI for OpenAI, ChatBedrock for AWS Bedrock, ChatGoogleGenerativeAI for Google Gen AI models.
Quick Start
LangChain Integration
from langchain_openai import ChatOpenAI
from memori import Memori
client = ChatOpenAI(model="gpt-4o-mini")
mem = Memori().llm.register(chatopenai=client)
mem.attribution(entity_id="user_123", process_id="langchain_agent")
response = client.invoke("Hello!")
print(response.content)
Different Providers
| Package | Chat Model | Registration Keyword |
|---|---|---|
langchain-openai | ChatOpenAI | chatopenai=client |
langchain-google-genai | ChatGoogleGenerativeAI | chatgooglegenai=client |
langchain-aws | ChatBedrock | chatbedrock=client |
LangChain Providers
from langchain_google_genai import ChatGoogleGenerativeAI
from memori import Memori
client = ChatGoogleGenerativeAI(model="gemini-2.0-flash-exp")
mem = Memori().llm.register(chatgooglegenai=client)
Supported Modes
| Mode | Method |
|---|---|
| Sync | client.invoke() |
| Async | await client.ainvoke() |
| Streamed | client.stream() |