Simplify baseline

This commit is contained in:
William Fu-Hinthorn
2025-02-04 22:16:35 -08:00
parent 65b7b97110
commit 0fe9fe1efb
6 changed files with 305 additions and 431 deletions
+55
View File
@@ -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
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,3 +1,3 @@
example_input = """ . """
example_output = """ . """
example_output = """ . """
+1 -1
View File
@@ -57,4 +57,4 @@ Please determine how to handle the below email thread:
From: {author}
To: {to}
Subject: {subject}
{email_thread}"""
{email_thread}"""
+12 -7
View File
@@ -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]
+3 -3
View File
@@ -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"],
)