mirror of
https://github.com/langchain-ai/long_term_memory_course.git
synced 2026-07-01 20:39:39 -04:00
Add memory
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
"\n",
|
||||
"We'll start with a simple implementation - one that uses hard-coded rules to handle emails.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"First, install the prerequisite packages:"
|
||||
]
|
||||
@@ -233,7 +233,8 @@
|
||||
"### Build agent\n",
|
||||
"\n",
|
||||
"Combine triage with tool calling agent\n",
|
||||
"\n"
|
||||
"\n",
|
||||
"TODO: Explain `Command`\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -280,6 +281,7 @@
|
||||
" triage_no=profile[\"triage_rules\"][\"ignore\"],\n",
|
||||
" triage_notify=profile[\"triage_rules\"][\"notify\"],\n",
|
||||
" triage_email=profile[\"triage_rules\"][\"respond\"],\n",
|
||||
" examples=None\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
" user_prompt = triage_user_prompt.format(\n",
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,18 @@
|
||||
[project]
|
||||
name = "memory-course"
|
||||
version = "0.1.0"
|
||||
description = "LangGraph Memory Course"
|
||||
requires-python = ">=3.8"
|
||||
dependencies = [
|
||||
"langchain",
|
||||
"langchain-anthropic",
|
||||
"langgraph",
|
||||
"langmem"
|
||||
]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["src/memory_course"]
|
||||
@@ -17,6 +17,33 @@ Use these tools when appropriate to help manage {name}'s tasks efficiently.
|
||||
</ Instructions >
|
||||
"""
|
||||
|
||||
# Agent prompt semantic memory
|
||||
agent_system_prompt_semantic = """
|
||||
< Role >
|
||||
You are {full_name}'s executive assistant. You are a top-notch executive assistant who cares about {name} performing as well as possible.
|
||||
</ Role >
|
||||
|
||||
< Tools >
|
||||
You have access to the following tools to help manage {name}'s communications and schedule:
|
||||
|
||||
1. write_email(to, subject, content) - Send emails to specified recipients
|
||||
2. schedule_meeting(attendees, subject, duration_minutes, preferred_day) - Schedule calendar meetings
|
||||
3. check_calendar_availability(day) - Check available time slots for a given day
|
||||
4. manage_memory("email_assistant", user, "collection") - Store any relevant information about contacts, actions, discussion, etc. in memory for future reference
|
||||
5. manage_memory("email_assistant", user, "user_profile") - Store any relevant information about the recipient, {name}, in the user profile for future reference the current user profile is shown below
|
||||
6. search_memory("email_assistant", user, "collection") - Search memory for detail from previous emails
|
||||
</ Tools >
|
||||
|
||||
< User profile >
|
||||
{profile}
|
||||
</ User profile >
|
||||
|
||||
< Instructions >
|
||||
Use these tools when appropriate to help manage {name}'s tasks efficiently.
|
||||
If updating the user profile, do not omit past information. Simply it with new information from the email that that fits within the profile schema.
|
||||
</ Instructions >
|
||||
"""
|
||||
|
||||
# Triage prompt
|
||||
triage_system_prompt = """
|
||||
< Role >
|
||||
|
||||
@@ -19,4 +19,5 @@ class Router(BaseModel):
|
||||
class State(TypedDict):
|
||||
email_input: str
|
||||
routing_decision: str
|
||||
human_feedback: Literal["ignore", "respond", "notify"]
|
||||
messages: Annotated[list, add_messages]
|
||||
|
||||
Reference in New Issue
Block a user