Golfn commited on
Commit
abeeb2c
·
1 Parent(s): a827ded

Change from AI message to system message

Browse files
Files changed (1) hide show
  1. Alfred_Agent.py +4 -3
Alfred_Agent.py CHANGED
@@ -38,7 +38,7 @@ from langchain.docstore.document import Document
38
  #######################################################################################################################################################
39
  from typing import TypedDict, Annotated
40
  from langgraph.graph.message import add_messages
41
- from langchain_core.messages import AnyMessage, HumanMessage, AIMessage
42
  from langgraph.prebuilt import ToolNode
43
  from langgraph.graph import START, StateGraph
44
  from langgraph.prebuilt import tools_condition
@@ -62,9 +62,10 @@ tools = [
62
  chat_with_tools = llm.bind_tools(tools)
63
 
64
  #setting up prompt
65
- ai_message = AIMessage(content="""You are a helpful assistant tasked with answering questions using a set of tools.
66
  Now, I will ask you a question. Report your thoughts, and finish your answer with the following template:
67
- FINAL ANSWER: [YOUR FINAL ANSWER].
 
68
  YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, Apply the rules above for each element (number or string), ensure there is exactly one space after each comma.
69
  Your answer should only start with "FINAL ANSWER: ", then follows with the answer. """)
70
 
 
38
  #######################################################################################################################################################
39
  from typing import TypedDict, Annotated
40
  from langgraph.graph.message import add_messages
41
+ from langchain_core.messages import AnyMessage, HumanMessage, AIMessage,SystemMessage
42
  from langgraph.prebuilt import ToolNode
43
  from langgraph.graph import START, StateGraph
44
  from langgraph.prebuilt import tools_condition
 
62
  chat_with_tools = llm.bind_tools(tools)
63
 
64
  #setting up prompt
65
+ ai_message = SystemMessage(content="""You are a helpful assistant tasked with answering questions using a set of tools.
66
  Now, I will ask you a question. Report your thoughts, and finish your answer with the following template:
67
+ FINAL ANSWER:
68
+ [YOUR FINAL ANSWER].
69
  YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, Apply the rules above for each element (number or string), ensure there is exactly one space after each comma.
70
  Your answer should only start with "FINAL ANSWER: ", then follows with the answer. """)
71