Paperbag commited on
Commit
60d960d
·
1 Parent(s): 0303c92

refactor: Remove explicit `google_api_key` assignment for Gemini model, relying on automatic environment variable pickup.

Browse files
Files changed (2) hide show
  1. __pycache__/agent.cpython-312.pyc +0 -0
  2. agent.py +11 -13
__pycache__/agent.cpython-312.pyc ADDED
Binary file (22 kB). View file
 
agent.py CHANGED
@@ -66,7 +66,7 @@ openrouter_model = ChatOpenAI(
66
  # Google AI Studio Fallback Model (Gemini)
67
  gemini_model = ChatGoogleGenerativeAI(
68
  model="gemini-1.5-pro",
69
- google_api_key=os.getenv("GOOGLE_API_KEY"),
70
  temperature=0,
71
  )
72
 
@@ -392,24 +392,22 @@ def answer_message(state: AgentState) -> AgentState:
392
 
393
  TODAY'S EXACT DATE is {current_date}. Keep this in mind for all time-sensitive queries.
394
 
395
- CRITICAL RULES FOR SEARCH & TOOLS:
396
- 1. If an image, video, or audio file is attached, YOU MUST NOT SAY "I don't have access to analyze..." or "I cannot see". YOU ARE NOT BLIND. You have external APIs (analyze_image, analyze_video, analyze_audio) that will act as your eyes and ears! ALWAYS invoke these tools immediately to get descriptions!
397
- 2. If a text/data file is attached, use the appropriate tool (run_python_script, read_document) to analyze the file content.
398
- 3. Use run_python_script freely to process data (pandas), read complex documents (.xlsx, .pdf), or do heavy math calculations.
399
- 4. When using tools like web_search or wiki_search, do not blindly search the entire question. Extract the core entities.
400
- 5. If the first search result doesn't contain the answer, THINK step-by-step, refine your search query (e.g., use synonyms, or search for broader concepts), and search again.
401
- 6. Cross-reference facts if they seem ambiguous.
402
 
403
- Do not include any thought process before answering the question, and only response exactly what was being asked of you.
404
- If you are not able to provide an answer, use tools or state the limitation that you're facing instead.
 
 
405
 
406
  YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
407
  If you are asked for a number, don't use comma to write your number, and don't use units such as $ or percent sign unless specified otherwise.
408
  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.
409
  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.
410
-
411
- Example question: How many hours are there in a day?
412
- Response: 24
413
  """)]
414
  messages = prompt + messages
415
 
 
66
  # Google AI Studio Fallback Model (Gemini)
67
  gemini_model = ChatGoogleGenerativeAI(
68
  model="gemini-1.5-pro",
69
+ # google_api_key is automatically picked up from GOOGLE_API_KEY environment variable
70
  temperature=0,
71
  )
72
 
 
392
 
393
  TODAY'S EXACT DATE is {current_date}. Keep this in mind for all time-sensitive queries.
394
 
395
+ CRITICAL RULES FOR FILES & TOOLS:
396
+ 1. If a message contains a path like `[Attached File Local Path: ...]` followed by an image (.png, .jpg, .jpeg), video, or audio file, YOU MUST USE THE CORRESPONDING TOOL (analyze_image, analyze_video, analyze_audio).
397
+ 2. YOU ARE NOT BLIND. NEVER say "I cannot see images" or "I don't have access to files". Use your tools to see and hear for you!
398
+ 3. If you see a file path, invoke the tool IMMEDIATELY in your first ReAct step.
399
+ 4. For text/data files, use `read_document` or `run_python_script` (especially for .xlsx or .pdf).
400
+ 5. Be thorough. If one tool doesn't give enough info, use another (e.g., search the web for context).
 
401
 
402
+ Example of Tool Trigger:
403
+ User: "What is in this image? [Attached File Local Path: /path/to/image.png]"
404
+ Your Thought: "I need to see the image to answer. I will use the analyze_image tool."
405
+ Your Action: Call `analyze_image(image_path='/path/to/image.png', question='What is in this image?')`
406
 
407
  YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
408
  If you are asked for a number, don't use comma to write your number, and don't use units such as $ or percent sign unless specified otherwise.
409
  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.
410
  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.
 
 
 
411
  """)]
412
  messages = prompt + messages
413