Use indexing

This commit is contained in:
William Fu-Hinthorn
2024-12-02 17:57:43 -08:00
parent b0325a02b9
commit 3581dce4c6
5 changed files with 13 additions and 4 deletions
+1
View File
@@ -5,6 +5,7 @@ __pycache__/
# C extensions
*.so
.langgraph_api
# Distribution / packaging
.Python
+7 -1
View File
@@ -5,5 +5,11 @@
},
"env": ".env",
"python_version": "3.11",
"dependencies": ["."]
"dependencies": ["."],
"store": {
"index": {
"dims": 1536,
"embed": "openai:text-embedding-3-small"
}
}
}
+1 -1
View File
@@ -13,7 +13,7 @@ dependencies = [
# Optional (for selecting different models)
"langchain-openai>=0.2.1",
"langchain-anthropic>=0.2.1",
"langchain>=0.3.1",
"langchain>=0.3.8",
"langchain-core>=0.3.8",
"python-dotenv>=1.0.1",
"langgraph-sdk>=0.1.32",
+3 -1
View File
@@ -24,7 +24,9 @@ async def call_model(state: State, config: RunnableConfig, *, store: BaseStore)
# Retrieve the most recent memories for context
memories = await store.asearch(
("memories", configurable.user_id), limit=10
("memories", configurable.user_id),
query=str([m.content for m in state.messages[-3:]]),
limit=10,
)
# Format memories for inclusion in the prompt
+1 -1
View File
@@ -40,4 +40,4 @@ async def upsert_memory(
key=str(mem_id),
value={"content": content, "context": context},
)
return f"Stored memory {memory_id}"
return f"Stored memory {mem_id}"