mem0ai / mem0

The Memory layer for your AI apps
https://mem0.ai
Apache License 2.0
22.39k stars 2.06k forks source link

Unsupported LLM provider and Unsupported embedding provider #1950

Open fate-think opened 1 week ago

fate-think commented 1 week ago

🐛 Describe the bug

when I excute the test.py ,I get some errors of Unsupported LLM provider and Unsupported embedding provider.By the way,I add chatglm to oneapi,and passed the test in oneapi.So,I have a openai-like api.And When I call the api in fastgpt,it works well.So it is clear that the api is fine and can be called normally.


My original codes is blow: ({xxx} represent my privacy information)

import os
from mem0 import Memory

os.environ["OPENAI_API_KEY"] = "{xxx}"
os.environ["OPENAI_API_BASE"] = "{xxx}"

config = {
    "llm": {
        "provider": "openai-like",
        "config": {
            "model": "glm-4-plus",
            "temperature": 0.2,
            "max_tokens": 2500,
        }
    },
    "embedder": { 
        "provider": "openai-like",
        "config": { 
            "model": "embedding-3" 
                 } 
    },
    "vector_store": {
        "provider": "qdrant",
        "config": {
            "collection_name": "test",
            "host": "{xxx}", 
            "port": {xxx},
            "embedding_model_dims": 3072,
        }
    },
    "version": "v1.1",
}

m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})

Errors I got :

Configuration validation error: 2 validation errors for MemoryConfig
llm.config
  Value error, Unsupported LLM provider: openai-like [type=value_error, input_value={'model': 'glm-4-plus', '...0.2, 'max_tokens': 2500}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.8/v/value_error
embedder.config
  Value error, Unsupported embedding provider: openai-like [type=value_error, input_value={'model': 'embedding-3'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.8/v/value_error
Traceback (most recent call last):
  File "/root/mem0test1.py", line 34, in <module>
    m = Memory.from_config(config)
  File "/usr/local/lib/python3.9/dist-packages/mem0/memory/main.py", line 55, in from_config
    config = MemoryConfig(**config_dict)
  File "/usr/local/lib/python3.9/dist-packages/pydantic/main.py", line 193, in __init__
    self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 2 validation errors for MemoryConfig
llm.config
  Value error, Unsupported LLM provider: openai-like [type=value_error, input_value={'model': 'glm-4-plus', '...0.2, 'max_tokens': 2500}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.8/v/value_error
embedder.config
  Value error, Unsupported embedding provider: openai-like [type=value_error, input_value={'model': 'embedding-3'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.8/v/value_error
spike-spiegel-21 commented 1 week ago

Hey @fate-think, mem0 does not support open-like as of now. Try with openai.