Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -14,18 +14,21 @@ class GaiaAgent:
|
|
| 14 |
}
|
| 15 |
|
| 16 |
def generate(self, prompt: str, stop: List[str] = []) -> str:
|
|
|
|
|
|
|
|
|
|
| 17 |
payload = {
|
| 18 |
"inputs": prompt,
|
| 19 |
"parameters": {
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
}
|
| 24 |
}
|
|
|
|
| 25 |
response = requests.post(self.api_url, headers=self.headers, json=payload)
|
| 26 |
response.raise_for_status()
|
| 27 |
output = response.json()
|
| 28 |
-
|
| 29 |
if isinstance(output, dict) and "generated_text" in output:
|
| 30 |
return output["generated_text"]
|
| 31 |
elif isinstance(output, list) and "generated_text" in output[0]:
|
|
|
|
| 14 |
}
|
| 15 |
|
| 16 |
def generate(self, prompt: str, stop: List[str] = []) -> str:
|
| 17 |
+
print("📤 [generate()] Sending prompt to model.")
|
| 18 |
+
print(prompt[:200]) # Print first 200 chars of the prompt for sanity
|
| 19 |
+
|
| 20 |
payload = {
|
| 21 |
"inputs": prompt,
|
| 22 |
"parameters": {
|
| 23 |
+
"temperature": 0.0,
|
| 24 |
+
"max_new_tokens": 1024,
|
| 25 |
+
"stop": stop,
|
|
|
|
| 26 |
}
|
| 27 |
+
}
|
| 28 |
response = requests.post(self.api_url, headers=self.headers, json=payload)
|
| 29 |
response.raise_for_status()
|
| 30 |
output = response.json()
|
| 31 |
+
|
| 32 |
if isinstance(output, dict) and "generated_text" in output:
|
| 33 |
return output["generated_text"]
|
| 34 |
elif isinstance(output, list) and "generated_text" in output[0]:
|