David
commited on
Commit
·
095d02f
1
Parent(s):
cefa420
Setting gemini with llamaindex
Browse files- agent.py +16 -0
- gaia_system_prompt.py +6 -0
- requirements.txt +1 -0
agent.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from llama_index.llms.google_genai import GoogleGenAI
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
GEMINI_API_KEY = os.getenv("GEMINI_TOKEN")
|
| 5 |
+
GEMINI_MODEL_NAME = "gemini-2.5-flash-preview-04-17"
|
| 6 |
+
|
| 7 |
+
class FinalAgent:
|
| 8 |
+
def __init__(self):
|
| 9 |
+
self.llm = GoogleGenAI(model=GEMINI_MODEL_NAME, api_key=GEMINI_API_KEY)
|
| 10 |
+
|
| 11 |
+
print("FinalAgent initialized.")
|
| 12 |
+
def __call__(self, question: str) -> str:
|
| 13 |
+
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 14 |
+
fixed_answer = "This is a default answer."
|
| 15 |
+
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 16 |
+
return fixed_answer
|
gaia_system_prompt.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GAIA_SYSTEM_PROMPT="""You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template:
|
| 2 |
+
FINAL ANSWER: [YOUR FINAL ANSWER].
|
| 3 |
+
YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
|
| 4 |
+
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.
|
| 5 |
+
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.
|
| 6 |
+
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."""
|
requirements.txt
CHANGED
|
@@ -4,4 +4,5 @@ numpy
|
|
| 4 |
pandas
|
| 5 |
llama-index
|
| 6 |
llama-index-llms-gemini
|
|
|
|
| 7 |
llama-index-utils-workflow
|
|
|
|
| 4 |
pandas
|
| 5 |
llama-index
|
| 6 |
llama-index-llms-gemini
|
| 7 |
+
llama-index-llms-google-genai
|
| 8 |
llama-index-utils-workflow
|