Fix langchain llm and update changelog (#2508)
This commit is contained in:
2
Makefile
2
Makefile
@@ -13,7 +13,7 @@ install:
|
|||||||
install_all:
|
install_all:
|
||||||
poetry install
|
poetry install
|
||||||
poetry run pip install groq together boto3 litellm ollama chromadb weaviate weaviate-client sentence_transformers vertexai \
|
poetry run pip install groq together boto3 litellm ollama chromadb weaviate weaviate-client sentence_transformers vertexai \
|
||||||
google-generativeai elasticsearch opensearch-py vecs pinecone pinecone-text faiss-cpu
|
google-generativeai elasticsearch opensearch-py vecs pinecone pinecone-text faiss-cpu langchain-community
|
||||||
|
|
||||||
# Format code with ruff
|
# Format code with ruff
|
||||||
format:
|
format:
|
||||||
|
|||||||
@@ -6,6 +6,25 @@ mode: "wide"
|
|||||||
<Tabs>
|
<Tabs>
|
||||||
<Tab title="Python">
|
<Tab title="Python">
|
||||||
|
|
||||||
|
<Update label="2025-04-07" description="v0.1.82">
|
||||||
|
|
||||||
|
**New Features:**
|
||||||
|
- **LLM Integrations:** Added support for Langchain LLMs, Google as new LLM and embedder
|
||||||
|
- **Development:** Added development docker compose
|
||||||
|
|
||||||
|
**Improvements:**
|
||||||
|
- **Output Format:** Set output_format='v1.1' and updated documentation
|
||||||
|
|
||||||
|
**Documentation:**
|
||||||
|
- **Integrations:** Added LMStudio and Together.ai documentation
|
||||||
|
- **API Reference:** Updated output_format documentation
|
||||||
|
- **Integrations:** Added PipeCat integration documentation
|
||||||
|
- **Integrations:** Added Flowise integration documentation for Mem0 memory setup
|
||||||
|
|
||||||
|
**Bug Fixes:**
|
||||||
|
- **Tests:** Fixed failing unit tests
|
||||||
|
</Update>
|
||||||
|
|
||||||
<Update label="2025-04-02" description="v0.1.79">
|
<Update label="2025-04-02" description="v0.1.79">
|
||||||
|
|
||||||
**New Features:**
|
**New Features:**
|
||||||
@@ -56,6 +75,17 @@ mode: "wide"
|
|||||||
|
|
||||||
<Tab title="TypeScript">
|
<Tab title="TypeScript">
|
||||||
|
|
||||||
|
<Update label="2025-04-01" description="v2.1.14">
|
||||||
|
**New Features:**
|
||||||
|
- **Mastra Example:** Added Mastra example
|
||||||
|
- **Integrations:** Added Flowise integration documentation for Mem0 memory setup
|
||||||
|
|
||||||
|
**Improvements:**
|
||||||
|
- **Demo:** Updated Demo Mem0AI
|
||||||
|
- **Client:** Enhanced Ping method in Mem0 Client
|
||||||
|
- **AI SDK:** Updated AI SDK implementation
|
||||||
|
</Update>
|
||||||
|
|
||||||
<Update label="2025-03-29" description="v2.1.13">
|
<Update label="2025-03-29" description="v2.1.13">
|
||||||
**Improvements:**
|
**Improvements:**
|
||||||
- **Introuced `ping` method to check if API key is valid and populate org/project id**
|
- **Introuced `ping` method to check if API key is valid and populate org/project id**
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ except ImportError:
|
|||||||
|
|
||||||
# Provider-specific package mapping
|
# Provider-specific package mapping
|
||||||
PROVIDER_PACKAGES = {
|
PROVIDER_PACKAGES = {
|
||||||
# "Anthropic": "langchain_anthropic", # Special handling for Anthropic with Pydantic v2
|
"Anthropic": "langchain_anthropic",
|
||||||
"MistralAI": "langchain_mistralai",
|
"MistralAI": "langchain_mistralai",
|
||||||
"Fireworks": "langchain_fireworks",
|
"Fireworks": "langchain_fireworks",
|
||||||
"AzureOpenAI": "langchain_openai",
|
"AzureOpenAI": "langchain_openai",
|
||||||
@@ -135,18 +135,25 @@ class LangchainLLM(LLMBase):
|
|||||||
try:
|
try:
|
||||||
# Check if this provider needs a specialized package
|
# Check if this provider needs a specialized package
|
||||||
if provider in PROVIDER_PACKAGES:
|
if provider in PROVIDER_PACKAGES:
|
||||||
package_name = PROVIDER_PACKAGES[provider]
|
if provider == "Anthropic": # Special handling for Anthropic with Pydantic v2
|
||||||
try:
|
try:
|
||||||
# Import the model class directly from the package
|
from langchain_anthropic import ChatAnthropic
|
||||||
module_path = f"{package_name}"
|
model_class = ChatAnthropic
|
||||||
model_class = __import__(module_path, fromlist=[model_name])
|
except ImportError:
|
||||||
model_class = getattr(model_class, model_name)
|
raise ImportError("langchain_anthropic not found. Please install it with `pip install langchain-anthropic`")
|
||||||
except ImportError:
|
else:
|
||||||
raise ImportError(
|
package_name = PROVIDER_PACKAGES[provider]
|
||||||
f"Package {package_name} not found. " f"Please install it with `pip install {package_name}`"
|
try:
|
||||||
)
|
# Import the model class directly from the package
|
||||||
except AttributeError:
|
module_path = f"{package_name}"
|
||||||
raise ImportError(f"Model {model_name} not found in {package_name}")
|
model_class = __import__(module_path, fromlist=[model_name])
|
||||||
|
model_class = getattr(model_class, model_name)
|
||||||
|
except ImportError:
|
||||||
|
raise ImportError(
|
||||||
|
f"Package {package_name} not found. " f"Please install it with `pip install {package_name}`"
|
||||||
|
)
|
||||||
|
except AttributeError:
|
||||||
|
raise ImportError(f"Model {model_name} not found in {package_name}")
|
||||||
else:
|
else:
|
||||||
# Use the default langchain_community module
|
# Use the default langchain_community module
|
||||||
if not hasattr(chat_models, model_name):
|
if not hasattr(chat_models, model_name):
|
||||||
@@ -158,8 +165,7 @@ class LangchainLLM(LLMBase):
|
|||||||
self.langchain_model = model_class(
|
self.langchain_model = model_class(
|
||||||
model=self.config.model,
|
model=self.config.model,
|
||||||
temperature=self.config.temperature,
|
temperature=self.config.temperature,
|
||||||
max_tokens=self.config.max_tokens,
|
max_tokens=self.config.max_tokens
|
||||||
api_key=self.config.api_key,
|
|
||||||
)
|
)
|
||||||
except (ImportError, AttributeError, ValueError) as e:
|
except (ImportError, AttributeError, ValueError) as e:
|
||||||
raise ImportError(f"Error setting up langchain model for provider {provider}: {str(e)}")
|
raise ImportError(f"Error setting up langchain model for provider {provider}: {str(e)}")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "mem0ai"
|
name = "mem0ai"
|
||||||
version = "0.1.82"
|
version = "0.1.83"
|
||||||
description = "Long-term memory for AI Agents"
|
description = "Long-term memory for AI Agents"
|
||||||
authors = ["Mem0 <founders@mem0.ai>"]
|
authors = ["Mem0 <founders@mem0.ai>"]
|
||||||
exclude = [
|
exclude = [
|
||||||
|
|||||||
Reference in New Issue
Block a user