mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-22 23:52:23 +02:00
docs: check for format violations with ruff (#1967)
This commit is contained in:
@@ -174,7 +174,9 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"@tool\n",
|
||||
"def save_core_memory(memory: str, index: Optional[int] = None, config: RunnableConfig = None) -> str:\n",
|
||||
"def save_core_memory(\n",
|
||||
" memory: str, index: Optional[int] = None, config: RunnableConfig = None\n",
|
||||
") -> str:\n",
|
||||
" \"\"\"Store a core memory in the database.\n",
|
||||
"\n",
|
||||
" Args:\n",
|
||||
@@ -192,7 +194,7 @@
|
||||
" memory_key = memories[index].key\n",
|
||||
" else:\n",
|
||||
" memory_key = str(uuid.uuid4())\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" core_memory_store.put((\"memories\", user_id), memory_key, {\"memory\": memory})\n",
|
||||
" return memory\n",
|
||||
"\n",
|
||||
@@ -325,7 +327,7 @@
|
||||
" \" do call tools, all text preceding the tool call is an internal\"\n",
|
||||
" \" message. Respond AFTER calling the tool, once you have\"\n",
|
||||
" \" confirmation that the tool completed successfully.\"\n",
|
||||
" \" REMEMBER: Use save_core_memories for key information like name, location, etc.\\n\\n\"\n",
|
||||
" \" REMEMBER: Use save_core_memories for key information like name, location, etc.\\n\\n\",\n",
|
||||
" ),\n",
|
||||
" (\"placeholder\", \"{messages}\"),\n",
|
||||
" ]\n",
|
||||
@@ -359,10 +361,10 @@
|
||||
" bound = prompt | model_with_tools\n",
|
||||
" # we can directly load core memories from the store parameter passed to the `agent` node\n",
|
||||
" user_id = get_user_id(config)\n",
|
||||
" core_memories = [item.value[\"memory\"] for item in core_memory_store.search((\"memories\", user_id))]\n",
|
||||
" core_str = (\n",
|
||||
" \"<core_memory>\\n\" + \"\\n\".join(core_memories) + \"\\n</core_memory>\"\n",
|
||||
" )\n",
|
||||
" core_memories = [\n",
|
||||
" item.value[\"memory\"] for item in core_memory_store.search((\"memories\", user_id))\n",
|
||||
" ]\n",
|
||||
" core_str = \"<core_memory>\\n\" + \"\\n\".join(core_memories) + \"\\n</core_memory>\"\n",
|
||||
" recall_str = (\n",
|
||||
" \"<recall_memory>\\n\" + \"\\n\".join(state[\"recall_memories\"]) + \"\\n</recall_memory>\"\n",
|
||||
" )\n",
|
||||
@@ -370,7 +372,7 @@
|
||||
" {\n",
|
||||
" \"messages\": state[\"messages\"],\n",
|
||||
" \"recall_memories\": recall_str,\n",
|
||||
" \"core_memories\": core_str\n",
|
||||
" \"core_memories\": core_str,\n",
|
||||
" }\n",
|
||||
" )\n",
|
||||
" return {\n",
|
||||
|
||||
Reference in New Issue
Block a user