Skip to content
Discussion options

You must be logged in to vote

resolved:

def call_model(state: State):
system_message = "You help users with simple integer math problems. Please use your tools."
summary = state.get("summary", "")
if summary:
system_message += f"\n\nSummary of conversation earlier: {summary}"

messages = state.get("messages", [])

# Convert string messages to HumanMessage objects
messages = [HumanMessage(content=m) if isinstance(m, str) else m for m in messages]

full_messages = [SystemMessage(content=system_message)] + messages
print("  --> Thinking")
response = model.invoke(full_messages)
return {"messages": full_messages + [response]}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by chazlupei
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant