letta-ai / letta

Letta (formerly MemGPT) is a framework for creating LLM services with memory.
https://letta.com
Apache License 2.0
12.88k stars 1.41k forks source link

Cannot create source using text-embedding-ada-002 model #2043

Open CristianBB opened 6 days ago

CristianBB commented 6 days ago

Describe the bug I'm trying to create sources by using OpenAI embeddings model (text-embedding-ada-002), however it's constantly being created with letta-free

Please describe your setup

Screenshots If applicable, add screenshots to help explain your problem.

Additional context 1- Try to create a source with embeddings model text-embedding-ada-002:

curl --location 'http://localhost:8283/v1/sources/' \
--header 'Authorization: Bearer password' \
--header 'Content-Type: application/json' \
--data '{
    "name": "testing",
    "description": "",
    "embedding_config": {
        "embedding_endpoint_type": "openai",
        "embedding_endpoint": "https://api.openai.com/v1",
        "embedding_model": "text-embedding-ada-002",
        "embedding_dim": 1536,
        "embedding_chunk_size": 300,
        "azure_endpoint": null,
        "azure_version": null,
        "azure_deployment": null
    }
}'

2- Response:

{"description":null,"embedding_config":{"embedding_endpoint_type":"hugging-face","embedding_endpoint":"https://embeddings.memgpt.ai","embedding_model":"letta-free","embedding_dim":1024,"embedding_chunk_size":300,"azure_endpoint":null,"azure_version":null,"azure_deployment":null},"metadata_":null,"id":"source-511bb682-2773-4d1b-b1cb-1e90a341185e","name":"testing","created_at":"2024-11-15T15:41:17.393696Z","user_id":"user-00000000-0000-4000-8000-000000000000"}

No matter how much I try to set the embeddings model for the source with ada-002, it's only created with letta-free. After creating the source I manually updated the property embedding_config from table "sources" (postgres DB) with the desired config to use openAI and new files uploaded to the source are being generated properly with ada-002 embeddings model, but there is no way from the API to create or even update a source with a different embeddings model

Letta Config Please attach your ~/.letta/config file or copy past it below.


matrixmayhem commented 3 days ago

I have the same problem

mattzh72 commented 3 days ago

I'm not getting this behavior -

(base) mattzhou@Matts-MacBook-Pro ~ % curl --location 'http://localhost:8283/v1/sources/' \
--header 'Authorization: Bearer password' \
--header 'Content-Type: application/json' \
--data '{
    "name": "testing",
    "description": "",
    "embedding_config": {
        "embedding_endpoint_type": "openai",
        "embedding_endpoint": "https://api.openai.com/v1",
        "embedding_model": "text-embedding-ada-002",
        "embedding_dim": 1536,
        "embedding_chunk_size": 300,
        "azure_endpoint": null,
        "azure_version": null,
        "azure_deployment": null
    }
}'
{"id":"source-90df2890-64ef-4f02-9388-754e55904eb2","name":"testing","description":"","embedding_config":{"embedding_endpoint_type":"openai","embedding_endpoint":"https://api.openai.com/v1","embedding_model":"text-embedding-ada-002","embedding_dim":1536,"embedding_chunk_size":300,"azure_endpoint":null,"azure_version":null,"azure_deployment":null},"organization_id":"org-00000000-0000-4000-8000-000000000000","metadata_":null,"created_by_id":"user-00000000-0000-4000-8000-000000000000","last_updated_by_id":"user-00000000-0000-4000-8000-000000000000","created_at":"2024-11-19T02:19:05","updated_at":"2024-11-19T02:1

Would you be able to share more about your environment/setup? Are you using docker?

lemorage commented 3 days ago

@mattzh72 an off-topic question, I am also using letta api endpoint for development, but I do not know where to get the Bearer token for Authorization after deploying it on my server, how did u get it?

CristianBB commented 3 days ago

I'm not getting this behavior -

(base) mattzhou@Matts-MacBook-Pro ~ % curl --location 'http://localhost:8283/v1/sources/' \
--header 'Authorization: Bearer password' \
--header 'Content-Type: application/json' \
--data '{
    "name": "testing",
    "description": "",
    "embedding_config": {
        "embedding_endpoint_type": "openai",
        "embedding_endpoint": "https://api.openai.com/v1",
        "embedding_model": "text-embedding-ada-002",
        "embedding_dim": 1536,
        "embedding_chunk_size": 300,
        "azure_endpoint": null,
        "azure_version": null,
        "azure_deployment": null
    }
}'
{"id":"source-90df2890-64ef-4f02-9388-754e55904eb2","name":"testing","description":"","embedding_config":{"embedding_endpoint_type":"openai","embedding_endpoint":"https://api.openai.com/v1","embedding_model":"text-embedding-ada-002","embedding_dim":1536,"embedding_chunk_size":300,"azure_endpoint":null,"azure_version":null,"azure_deployment":null},"organization_id":"org-00000000-0000-4000-8000-000000000000","metadata_":null,"created_by_id":"user-00000000-0000-4000-8000-000000000000","last_updated_by_id":"user-00000000-0000-4000-8000-000000000000","created_at":"2024-11-19T02:19:05","updated_at":"2024-11-19T02:1

Would you be able to share more about your environment/setup? Are you using docker?

Sure. I'm just cloning the repository, setting the .env file with OPENAI api key and executing docker compose up

matrixmayhem commented 3 days ago

I am using conda on my pc and installing using pip.

(letta) C:\Users\Ali>curl --location "http://localhost:8283/v1/sources/" ^
More? --header "Authorization: Bearer password" ^
More? --header "Content-Type: application/json" ^
More? --data "{ \"name\": \"test 13\", \"description\": \"\", \"embedding_config\": { \"embedding_endpoint_type\": \"openai\", \"embedding_endpoint\": \"https://api.openai.com/v1\", \"embedding_model\": \"text-embedding-ada-002\", \"embedding_dim\": 1536, \"embedding_chunk_size\": 300, \"azure_endpoint\": null, \"azure_version\": null, \"azure_deployment\": null }}"
{"description":null,"embedding_config":{"embedding_endpoint_type":"hugging-face","embedding_endpoint":"https://embeddings.memgpt.ai","embedding_model":"letta-free","embedding_dim":1024,"embedding_chunk_size":300,"azure_endpoint":null,"azure_version":null,"azure_deployment":null},"metadata_":null,"id":"source-3fae9c07-1d00-4e24-b146-5b78ccc83b82","name":"test 13","created_at":"2024-11-19T10:59:42.617175Z","user_id":"user-00000000-0000-4000-8000-000000000000"}
mattzh72 commented 2 days ago

@CristianBB I was able to do a deep dive of the issue, looks like there were some bugs in the older version of Letta. Recently we have been rewriting our data models using ORMs, and that has helped stamp out a lot of these kinds of bugs. You have a couple options here - can you try using the more recent image (not latest)?

https://registry.hub.docker.com/layers/letta/letta/nightly/images/sha256-989cd577880ae3e10e747fe5156bd34a32a479bc5b9d53f054e6644a7a368153?context=explore

OR - you can use letta server locally (no docker), and make sure OPENAI_API_KEY in your shell environment. @matrixmayhem I'm fairly sure that should work for you too.