IamRulo commited on
Commit
f2ed73d
·
verified ·
1 Parent(s): 167bbcb

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +19 -16
agent.py CHANGED
@@ -625,13 +625,14 @@ def combine_images(
625
  #with open("system_prompt.txt", "r", encoding="utf-8") as f:
626
  # system_prompt = f.read()
627
 
628
- system_prompt = """You are a helpful assistant tasked with answering questions using a set of tools.
 
629
  Now, I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER].
630
  YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
631
  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.
632
  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.
633
  If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
634
- Your answer should only start with "FINAL ANSWER: ", then follows with the answer."""
635
 
636
  # System message
637
  sys_msg = SystemMessage(content=system_prompt)
@@ -667,17 +668,17 @@ tools = [
667
  wiki_search,
668
  web_search,
669
  arvix_search,
670
- save_and_read_file,
671
- download_file_from_url,
672
- extract_text_from_image,
673
- analyze_csv_file,
674
- analyze_excel_file,
675
- execute_code_multilang,
676
- analyze_image,
677
- transform_image,
678
- draw_on_image,
679
- generate_simple_image,
680
- combine_images,
681
  ]
682
 
683
  # Build graph function
@@ -714,7 +715,9 @@ def build_graph(provider: str = "huggingface"):
714
 
715
  elif provider == "google":
716
  # Google Gemini
717
- llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=0)
 
 
718
  else:
719
  raise ValueError("Invalid provider. Choose 'huggingface'.")
720
 
@@ -751,8 +754,8 @@ def build_graph(provider: str = "huggingface"):
751
  "assistant",
752
  tools_condition,
753
  )
754
- #builder.add_edge("tools", "retriever")
755
- builder.add_edge("tools", "assistant")
756
 
757
  # Compile graph
758
  return builder.compile()
 
625
  #with open("system_prompt.txt", "r", encoding="utf-8") as f:
626
  # system_prompt = f.read()
627
 
628
+ system_prompt = """
629
+ You are a helpful assistant tasked with answering questions using a set of tools.
630
  Now, I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER].
631
  YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
632
  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.
633
  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.
634
  If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
635
+ Your answer should only start with "FINAL ANSWER: ", then follows with the answer.""".strip()
636
 
637
  # System message
638
  sys_msg = SystemMessage(content=system_prompt)
 
668
  wiki_search,
669
  web_search,
670
  arvix_search,
671
+ #save_and_read_file,
672
+ #download_file_from_url,
673
+ #extract_text_from_image,
674
+ #analyze_csv_file,
675
+ #analyze_excel_file,
676
+ #execute_code_multilang,
677
+ #analyze_image,
678
+ #transform_image,
679
+ #draw_on_image,
680
+ #generate_simple_image,
681
+ #combine_images,
682
  ]
683
 
684
  # Build graph function
 
715
 
716
  elif provider == "google":
717
  # Google Gemini
718
+ #llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=0)
719
+ llm = ChatGoogleGenerativeAI(model="gemini-1.5-flash", temperature=0)
720
+
721
  else:
722
  raise ValueError("Invalid provider. Choose 'huggingface'.")
723
 
 
754
  "assistant",
755
  tools_condition,
756
  )
757
+ builder.add_edge("tools", "retriever")
758
+ #builder.add_edge("tools", "assistant")
759
 
760
  # Compile graph
761
  return builder.compile()