Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fix: Fix letta-free embeddings (#4055)

Matthew Zhou4fb0fe28b7fb
diff --git a/letta/schemas/embedding_config.py b/letta/schemas/embedding_config.py
index bf89039d9..2840146e7 100644
--- a/letta/schemas/embedding_config.py
+++ b/letta/schemas/embedding_config.py
@@ -62,11 +62,11 @@ class EmbeddingConfig(BaseModel):
)
elif model_name == "letta":
return cls(
- embedding_endpoint="https://bun-function-production-e310.up.railway.app/v1",
- embedding_model="BAAI/bge-large-en-v1.5",
- embedding_dim=1024,
+ embedding_endpoint="https://embeddings.letta.com/",
+ embedding_model="letta-free",
+ embedding_dim=1536,
embedding_chunk_size=DEFAULT_EMBEDDING_CHUNK_SIZE,
- embedding_endpoint_type="hugging-face",
+ embedding_endpoint_type="openai",
)
elif provider == "pinecone":
# default config for pinecone with empty endpoint
diff --git a/letta/schemas/providers/letta.py b/letta/schemas/providers/letta.py
index 707d4899b..34151facb 100644
--- a/letta/schemas/providers/letta.py
+++ b/letta/schemas/providers/letta.py
@@ -30,9 +30,9 @@ class LettaProvider(Provider):
return [
EmbeddingConfig(
embedding_model="letta-free", # NOTE: renamed
- embedding_endpoint_type="hugging-face",
- embedding_endpoint="https://bun-function-production-e310.up.railway.app/v1",
- embedding_dim=1024,
+ embedding_endpoint_type="openai",
+ embedding_endpoint="https://embeddings.letta.com/",
+ embedding_dim=1536,
embedding_chunk_size=DEFAULT_EMBEDDING_CHUNK_SIZE,
handle=self.get_handle("letta-free", is_embedding=True),
)
diff --git a/tests/integration_test_batch_api_cron_jobs.py b/tests/integration_test_batch_api_cron_jobs.py
index 08337f080..95d98bf28 100644
--- a/tests/integration_test_batch_api_cron_jobs.py
+++ b/tests/integration_test_batch_api_cron_jobs.py
@@ -148,9 +148,9 @@ def create_test_agent(name, actor, test_id: Optional[str] = None, model="anthrop
dummy_embedding_config = EmbeddingConfig(
embedding_model="letta-free",
- embedding_endpoint_type="hugging-face",
- embedding_endpoint="https://bun-function-production-e310.up.railway.app/v1",
- embedding_dim=1024,
+ embedding_endpoint_type="openai",
+ embedding_endpoint="https://embeddings.letta.com/",
+ embedding_dim=1536,
embedding_chunk_size=300,
handle="letta/letta-free",
)
diff --git a/tests/test_sources.py b/tests/test_sources.py
index 9f96c01d0..8dc235de8 100644
--- a/tests/test_sources.py
+++ b/tests/test_sources.py
@@ -1284,3 +1284,32 @@ def test_file_processing_timeout_logic():
# Test recent file
recent_time = current_time - timedelta(minutes=10)
assert not (recent_time < timeout_threshold), "Recent file should not trigger timeout"
+
+
+def test_letta_free_embedding(disable_pinecone, client: LettaSDKClient):
+ """Test creating a source with letta/letta-free embedding and uploading a file"""
+ # create a source with letta-free embedding
+ source = client.sources.create(name="test_letta_free_source", embedding="letta/letta-free")
+
+ # verify source was created with correct embedding
+ assert source.name == "test_letta_free_source"
+ print("\n\n\n\ntest")
+ print(source.embedding_config)
+ # assert source.embedding_config.embedding_model == "letta-free"
+
+ # upload test.txt file
+ file_path = "tests/data/test.txt"
+ file_metadata = upload_file_and_wait(client, source.id, file_path)
+
+ # verify file was uploaded successfully
+ assert file_metadata.processing_status == "completed"
+ assert file_metadata.source_id == source.id
+ assert file_metadata.file_name == "test.txt"
+
+ # verify file appears in source files list
+ files = client.sources.files.list(source_id=source.id, limit=1)
+ assert len(files) == 1
+ assert files[0].id == file_metadata.id
+
+ # cleanup
+ client.sources.delete(source_id=source.id)