Skip to content

Commit efd1b50

Browse files
author
hfhoffman1144
committed
this is insane
1 parent d1aa730 commit efd1b50

File tree

5 files changed

+10
-25
lines changed

5 files changed

+10
-25
lines changed

python-langgraph/chains/binary_questions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,5 @@ class BinaryAnswer(BaseModel):
2626
binary_question_model = ChatOpenAI(model="gpt-4o-mini", temperature=0)
2727

2828
BINARY_QUESTION_CHAIN = (
29-
binary_question_prompt
30-
| binary_question_model.with_structured_output(BinaryAnswer)
29+
binary_question_prompt | binary_question_model.with_structured_output(BinaryAnswer)
3130
)

python-langgraph/chains/escalation_check.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,5 @@ class EscalationCheck(BaseModel):
2828
escalation_check_model = ChatOpenAI(model="gpt-4o-mini", temperature=0)
2929

3030
ESCALATION_CHECK_CHAIN = (
31-
escalation_prompt
32-
| escalation_check_model.with_structured_output(EscalationCheck)
31+
escalation_prompt | escalation_check_model.with_structured_output(EscalationCheck)
3332
)

python-langgraph/chains/notice_extraction.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ class NoticeEmailExtract(BaseModel):
6464
@property
6565
def date_of_notice(self) -> date | None:
6666
try:
67-
return datetime.strptime(
68-
self.date_of_notice_str, "%Y-%m-%d"
69-
).date()
67+
return datetime.strptime(self.date_of_notice_str, "%Y-%m-%d").date()
7068
except Exception as e:
7169
print(e)
7270
return None
@@ -75,9 +73,7 @@ def date_of_notice(self) -> date | None:
7573
@property
7674
def compliance_deadline(self) -> date | None:
7775
try:
78-
return datetime.strptime(
79-
self.compliance_deadline_str, "%Y-%m-%d"
80-
).date()
76+
return datetime.strptime(self.compliance_deadline_str, "%Y-%m-%d").date()
8177
except Exception as e:
8278
print(e)
8379
return None
@@ -103,7 +99,6 @@ def compliance_deadline(self) -> date | None:
10399

104100
notice_parser_model = ChatOpenAI(model="gpt-4o-mini", temperature=0)
105101

106-
NOTICE_PARSER_CHAIN = (
107-
info_parse_prompt
108-
| notice_parser_model.with_structured_output(NoticeEmailExtract)
102+
NOTICE_PARSER_CHAIN = info_parse_prompt | notice_parser_model.with_structured_output(
103+
NoticeEmailExtract
109104
)

python-langgraph/graphs/email_agent.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ def forward_email(email_message: str, send_to_email: str) -> bool:
2626

2727

2828
@tool
29-
def send_wrong_email_notification_to_sender(
30-
sender_email: str, correct_department: str
31-
):
29+
def send_wrong_email_notification_to_sender(sender_email: str, correct_department: str):
3230
"""
3331
Send an email back to the sender informing them that
3432
they have the wrong address. The email should be sent
@@ -43,9 +41,7 @@ def send_wrong_email_notification_to_sender(
4341

4442

4543
@tool
46-
def extract_notice_data(
47-
email: str, escalation_criteria: str
48-
) -> NoticeEmailExtract:
44+
def extract_notice_data(email: str, escalation_criteria: str) -> NoticeEmailExtract:
4945
"""
5046
Extract structured fields from a regulatory notice.
5147
This should be used when the email message comes from
@@ -109,9 +105,7 @@ def determine_email_action(email: str) -> str:
109105
]
110106
tool_node = ToolNode(tools)
111107

112-
EMAIL_AGENT_MODEL = ChatOpenAI(model="gpt-4o-mini", temperature=0).bind_tools(
113-
tools
114-
)
108+
EMAIL_AGENT_MODEL = ChatOpenAI(model="gpt-4o-mini", temperature=0).bind_tools(tools)
115109

116110

117111
def call_agent_model_node(state: MessagesState) -> dict[str, list[AIMessage]]:

python-langgraph/utils/graph_utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ def create_legal_ticket(
3232
]
3333

3434
if current_follow_ups:
35-
follow_ups = [
36-
f for f in follow_ups if f not in current_follow_ups.keys()
37-
]
35+
follow_ups = [f for f in follow_ups if f not in current_follow_ups.keys()]
3836

3937
follow_up = random.choice(follow_ups)
4038

0 commit comments

Comments
 (0)