Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,10 +26,12 @@ class BasicAgent:
|
|
| 26 |
def __call__(self, question: str) -> str:
|
| 27 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 28 |
|
|
|
|
|
|
|
| 29 |
url = "https://api.fireworks.ai/inference/v1/chat/completions"
|
| 30 |
payload = {
|
| 31 |
-
"model": "accounts/fireworks/models/
|
| 32 |
-
"max_tokens":
|
| 33 |
"top_p": 1,
|
| 34 |
"top_k": 40,
|
| 35 |
"presence_penalty": 0,
|
|
@@ -38,34 +40,24 @@ class BasicAgent:
|
|
| 38 |
"messages": [
|
| 39 |
{
|
| 40 |
"role": "user",
|
| 41 |
-
"content":
|
| 42 |
-
{
|
| 43 |
-
"type": "text",
|
| 44 |
-
"text": f"{question}"
|
| 45 |
-
},
|
| 46 |
-
{
|
| 47 |
-
"type": "image_url",
|
| 48 |
-
"image_url": {
|
| 49 |
-
"url": "https://images.unsplash.com/photo-1582538885592-e70a5d7ab3d3?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1770&q=80"
|
| 50 |
-
}
|
| 51 |
-
}
|
| 52 |
-
]
|
| 53 |
}
|
| 54 |
]
|
| 55 |
}
|
| 56 |
headers = {
|
| 57 |
"Accept": "application/json",
|
| 58 |
"Content-Type": "application/json",
|
| 59 |
-
"Authorization": "Bearer
|
| 60 |
}
|
| 61 |
requests.request("POST", url, headers=headers, data=json.dumps(payload))
|
|
|
|
| 62 |
|
|
|
|
|
|
|
| 63 |
|
| 64 |
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
fixed_answer = "This is a default answer."
|
| 69 |
|
| 70 |
|
| 71 |
|
|
|
|
| 26 |
def __call__(self, question: str) -> str:
|
| 27 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 28 |
|
| 29 |
+
|
| 30 |
+
|
| 31 |
url = "https://api.fireworks.ai/inference/v1/chat/completions"
|
| 32 |
payload = {
|
| 33 |
+
"model": "accounts/fireworks/models/qwen3-30b-a3b",
|
| 34 |
+
"max_tokens": 5000,
|
| 35 |
"top_p": 1,
|
| 36 |
"top_k": 40,
|
| 37 |
"presence_penalty": 0,
|
|
|
|
| 40 |
"messages": [
|
| 41 |
{
|
| 42 |
"role": "user",
|
| 43 |
+
"content": f"{question}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
}
|
| 45 |
]
|
| 46 |
}
|
| 47 |
headers = {
|
| 48 |
"Accept": "application/json",
|
| 49 |
"Content-Type": "application/json",
|
| 50 |
+
"Authorization": "Bearer fw_3ZSrkw3Qv5eeA1yx65x1eD5H"
|
| 51 |
}
|
| 52 |
requests.request("POST", url, headers=headers, data=json.dumps(payload))
|
| 53 |
+
|
| 54 |
|
| 55 |
+
response_data = response.json()
|
| 56 |
+
assistant_reply = response_data["choices"][0]["message"]["content"]
|
| 57 |
|
| 58 |
|
| 59 |
+
fixed_answer = assistant_reply
|
| 60 |
+
#fixed_answer = "This is a default answer."
|
|
|
|
|
|
|
| 61 |
|
| 62 |
|
| 63 |
|