mirror of
https://github.com/langchain-ai/long_term_memory_course.git
synced 2026-06-30 20:37:54 -04:00
Simplify baseline
This commit is contained in:
+55
@@ -0,0 +1,55 @@
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
*.ipynb
|
||||
|
||||
# Virtual Environment
|
||||
venv/
|
||||
env/
|
||||
ENV/
|
||||
.env
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
.vscode/
|
||||
*.swp
|
||||
*.swo
|
||||
.DS_Store
|
||||
|
||||
# Testing
|
||||
.coverage
|
||||
htmlcov/
|
||||
.pytest_cache/
|
||||
.tox/
|
||||
|
||||
# Distribution
|
||||
*.tar.gz
|
||||
*.whl
|
||||
|
||||
# Misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
+233
-419
File diff suppressed because one or more lines are too long
@@ -1,3 +1,3 @@
|
||||
example_input = """ . """
|
||||
|
||||
example_output = """ . """
|
||||
example_output = """ . """
|
||||
|
||||
@@ -57,4 +57,4 @@ Please determine how to handle the below email thread:
|
||||
From: {author}
|
||||
To: {to}
|
||||
Subject: {subject}
|
||||
{email_thread}"""
|
||||
{email_thread}"""
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import List, TypedDict, Literal, Annotated
|
||||
import operator
|
||||
from typing_extensions import TypedDict, Literal, Annotated
|
||||
from langgraph.graph import add_messages
|
||||
|
||||
|
||||
class Router(BaseModel):
|
||||
"""Analyze the unread email and route it according to its content."""
|
||||
|
||||
reasoning: str = Field(
|
||||
description="Step-by-step reasoning behind the classification."
|
||||
)
|
||||
classification: Literal["ignore", "respond", "notify"] = Field(
|
||||
None,
|
||||
description="The classification of an email: 'ignore' for irrelevant emails, "
|
||||
"'notify' for important information that doesn't need a response, "
|
||||
"'respond' for emails that need a reply"
|
||||
"'respond' for emails that need a reply",
|
||||
)
|
||||
|
||||
|
||||
class State(TypedDict):
|
||||
email_input: str
|
||||
routing_decision: str
|
||||
messages: Annotated[list, operator.add]
|
||||
|
||||
|
||||
messages: Annotated[list, add_messages]
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
def parse_email(email_input: dict) -> dict:
|
||||
"""Parse an email input dictionary.
|
||||
|
||||
|
||||
Args:
|
||||
email_input (dict): Dictionary containing email fields:
|
||||
- author: Sender's name and email
|
||||
- to: Recipient's name and email
|
||||
- subject: Email subject line
|
||||
- email_thread: Full email content
|
||||
|
||||
|
||||
Returns:
|
||||
tuple[str, str, str, str]: Tuple containing:
|
||||
- author: Sender's name and email
|
||||
@@ -19,5 +19,5 @@ def parse_email(email_input: dict) -> dict:
|
||||
email_input["author"],
|
||||
email_input["to"],
|
||||
email_input["subject"],
|
||||
email_input["email_thread"]
|
||||
email_input["email_thread"],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user