Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -69,66 +69,7 @@ class BasicAgent:
|
|
69 |
executor_type="local",
|
70 |
verbose=verbose
|
71 |
)
|
72 |
-
print(f"Using OpenAIServerModel with X.AI API at {api_base}")
|
73 |
-
elif model_type == "HfApiModel" and hf_token:
|
74 |
-
# Use Hugging Face API
|
75 |
-
self.gaia_agent = GAIAAgent(
|
76 |
-
model_type="HfApiModel",
|
77 |
-
model_id=model_id,
|
78 |
-
api_key=hf_token,
|
79 |
-
temperature=temperature,
|
80 |
-
executor_type="local",
|
81 |
-
verbose=verbose
|
82 |
-
)
|
83 |
-
print(f"Using HfApiModel with model_id: {model_id}")
|
84 |
-
elif openai_key:
|
85 |
-
# Default to OpenAI API
|
86 |
-
api_base = os.environ.get("AGENT_API_BASE")
|
87 |
-
kwargs = {
|
88 |
-
"model_type": "OpenAIServerModel",
|
89 |
-
"model_id": model_id,
|
90 |
-
"api_key": openai_key,
|
91 |
-
"temperature": temperature,
|
92 |
-
"executor_type": "local",
|
93 |
-
"verbose": verbose
|
94 |
-
}
|
95 |
-
if api_base:
|
96 |
-
kwargs["api_base"] = api_base
|
97 |
-
print(f"Using custom API base: {api_base}")
|
98 |
|
99 |
-
self.gaia_agent = GAIAAgent(**kwargs)
|
100 |
-
print(f"Using OpenAIServerModel with model_id: {model_id}")
|
101 |
-
else:
|
102 |
-
# Fallback to using whatever token we have
|
103 |
-
print("WARNING: Using fallback initialization with available token")
|
104 |
-
if hf_token:
|
105 |
-
self.gaia_agent = GAIAAgent(
|
106 |
-
model_type="HfApiModel",
|
107 |
-
model_id="mistralai/Mistral-7B-Instruct-v0.2",
|
108 |
-
api_key=hf_token,
|
109 |
-
temperature=temperature,
|
110 |
-
executor_type="local",
|
111 |
-
verbose=verbose
|
112 |
-
)
|
113 |
-
elif openai_key:
|
114 |
-
self.gaia_agent = GAIAAgent(
|
115 |
-
model_type="OpenAIServerModel",
|
116 |
-
model_id="gpt-3.5-turbo",
|
117 |
-
api_key=openai_key,
|
118 |
-
temperature=temperature,
|
119 |
-
executor_type="local",
|
120 |
-
verbose=verbose
|
121 |
-
)
|
122 |
-
else:
|
123 |
-
self.gaia_agent = GAIAAgent(
|
124 |
-
model_type="OpenAIServerModel",
|
125 |
-
model_id="grok-3-latest",
|
126 |
-
api_key=xai_key,
|
127 |
-
api_base=os.environ.get("XAI_API_BASE", "https://api.x.ai/v1"),
|
128 |
-
temperature=temperature,
|
129 |
-
executor_type="local",
|
130 |
-
verbose=verbose
|
131 |
-
)
|
132 |
except ImportError as ie:
|
133 |
# Handle OpenAI module errors specifically
|
134 |
if "openai" in str(ie).lower() and hf_token:
|
|
|
69 |
executor_type="local",
|
70 |
verbose=verbose
|
71 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
except ImportError as ie:
|
74 |
# Handle OpenAI module errors specifically
|
75 |
if "openai" in str(ie).lower() and hf_token:
|