Poetry and LLM fixes (#1508)

This commit is contained in:
Dev Khant
2024-07-20 10:49:15 +05:30
committed by GitHub
parent 51fd7db205
commit 0c9c5fe9c2
9 changed files with 26 additions and 1556 deletions

View File

@@ -12,6 +12,7 @@ install:
install_all:
poetry install
poetry run pip install groq together boto3 litellm
# Format code with ruff
format:

View File

@@ -2,7 +2,10 @@ import os
import json
from typing import Dict, List, Optional, Any
import boto3
try:
import boto3
except ImportError:
raise ImportError("AWS Bedrock requires extra dependencies. Install with `pip install boto3`") from None
from mem0.llms.base import LLMBase
from mem0.configs.llms.base import BaseLlmConfig

View File

@@ -14,7 +14,7 @@ class LlmConfig(BaseModel):
@field_validator("config")
def validate_config(cls, v, values):
provider = values.data.get("provider")
if provider in ["openai", "ollama", "groq"]:
if provider in ("openai", "ollama", "groq", "together", "aws_bedrock", "litellm"):
return v
else:
raise ValueError(f"Unsupported LLM provider: {provider}")

View File

@@ -1,7 +1,10 @@
import json
from typing import Dict, List, Optional
from groq import Groq
try:
from groq import Groq
except ImportError:
raise ImportError("Groq requires extra dependencies. Install with `pip install groq`") from None
from mem0.llms.base import LLMBase
from mem0.configs.llms.base import BaseLlmConfig

View File

@@ -1,7 +1,10 @@
import json
from typing import Dict, List, Optional
import litellm
try:
import litellm
except ImportError:
raise ImportError("litellm requires extra dependencies. Install with `pip install litellm`") from None
from mem0.llms.base import LLMBase
from mem0.configs.llms.base import BaseLlmConfig

View File

@@ -1,7 +1,10 @@
import json
from typing import Dict, List, Optional
from together import Together
try:
from together import Together
except ImportError:
raise ImportError("Together requires extra dependencies. Install with `pip install together`") from None
from mem0.llms.base import LLMBase
from mem0.configs.llms.base import BaseLlmConfig

View File

@@ -1,3 +1,5 @@
import os
import shutil
import logging
from typing import Optional
@@ -50,6 +52,8 @@ class Qdrant(VectorStoreBase):
params = {}
if path:
params["path"] = path
if os.path.exists(path) and os.path.isdir(path):
shutil.rmtree(path)
if api_key:
params["api_key"] = api_key
if url:

1549
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "mem0ai"
version = "0.0.6"
version = "0.0.7"
description = "Long-term memory for AI Agents"
authors = ["Deshraj Yadav <deshraj@mem0.ai>", "Taranjeet Singh <taranjeet@mem0.ai>"]
exclude = [
@@ -20,10 +20,6 @@ qdrant-client = "^1.9.1"
pydantic = "^2.7.3"
openai = "^1.33.0"
posthog = "^3.5.0"
groq = "^0.9.0"
together = "^1.2.1"
boto3 = "^1.34.144"
litellm = "^1.41.24"
[tool.poetry.group.test.dependencies]
pytest = "^8.2.2"