Update app.py
Browse files
app.py
CHANGED
|
@@ -19,7 +19,7 @@ class BasicAgent:
|
|
| 19 |
token=os.getenv("HF_TOKEN")
|
| 20 |
)
|
| 21 |
def __call__(self, question: str) -> str:
|
| 22 |
-
|
| 23 |
response = self.client.chat_completion(
|
| 24 |
model="meta-llama/Llama-3.1-8B-Instruct",
|
| 25 |
messages=[
|
|
@@ -28,7 +28,7 @@ class BasicAgent:
|
|
| 28 |
max_tokens=512
|
| 29 |
)
|
| 30 |
|
| 31 |
-
|
| 32 |
|
| 33 |
# fixed_answer = "This is a default answer."
|
| 34 |
# print(f"Agent returning fixed answer: {fixed_answer}")
|
|
@@ -161,11 +161,9 @@ with gr.Blocks() as demo:
|
|
| 161 |
gr.Markdown(
|
| 162 |
"""
|
| 163 |
**Instructions:**
|
| 164 |
-
|
| 165 |
1. Please clone this space, then modify the code to define your agent's logic, the tools, the necessary packages, etc ...
|
| 166 |
2. Log in to your Hugging Face account using the button below. This uses your HF username for submission.
|
| 167 |
3. Click 'Run Evaluation & Submit All Answers' to fetch questions, run your agent, submit answers, and see the score.
|
| 168 |
-
|
| 169 |
---
|
| 170 |
**Disclaimers:**
|
| 171 |
Once clicking on the "submit button, it can take quite some time ( this is the time for the agent to go through all the questions).
|
|
|
|
| 19 |
token=os.getenv("HF_TOKEN")
|
| 20 |
)
|
| 21 |
def __call__(self, question: str) -> str:
|
| 22 |
+
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 23 |
response = self.client.chat_completion(
|
| 24 |
model="meta-llama/Llama-3.1-8B-Instruct",
|
| 25 |
messages=[
|
|
|
|
| 28 |
max_tokens=512
|
| 29 |
)
|
| 30 |
|
| 31 |
+
return response.choices[0].message.content
|
| 32 |
|
| 33 |
# fixed_answer = "This is a default answer."
|
| 34 |
# print(f"Agent returning fixed answer: {fixed_answer}")
|
|
|
|
| 161 |
gr.Markdown(
|
| 162 |
"""
|
| 163 |
**Instructions:**
|
|
|
|
| 164 |
1. Please clone this space, then modify the code to define your agent's logic, the tools, the necessary packages, etc ...
|
| 165 |
2. Log in to your Hugging Face account using the button below. This uses your HF username for submission.
|
| 166 |
3. Click 'Run Evaluation & Submit All Answers' to fetch questions, run your agent, submit answers, and see the score.
|
|
|
|
| 167 |
---
|
| 168 |
**Disclaimers:**
|
| 169 |
Once clicking on the "submit button, it can take quite some time ( this is the time for the agent to go through all the questions).
|