Trial and error with mistralai/Mistral-7B-Instruct-v0.3.
Browse files
app.py
CHANGED
@@ -24,16 +24,9 @@ class BasicAgent:
|
|
24 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
25 |
|
26 |
try:
|
27 |
-
# Create messages for the model
|
28 |
-
messages = [
|
29 |
-
{"role": "system", "content": "You are Mistral, a helpful AI assistant. Answer the user's questions accurately and helpfully."},
|
30 |
-
{"role": "user", "content": question}
|
31 |
-
]
|
32 |
-
|
33 |
# Generate response
|
34 |
print("Using Inference API for generation...")
|
35 |
response = self.client.text_generation(question)
|
36 |
-
print(f"Inference API response received.")
|
37 |
answer = response
|
38 |
print(f"Agent generated response (first 50 chars): {answer[:50]}...")
|
39 |
return answer
|
@@ -106,6 +99,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
106 |
continue
|
107 |
try:
|
108 |
submitted_answer = agent(question_text)
|
|
|
109 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
110 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
111 |
except Exception as e:
|
@@ -169,7 +163,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
169 |
|
170 |
# --- Build Gradio Interface using Blocks ---
|
171 |
with gr.Blocks() as demo:
|
172 |
-
gr.Markdown("# Basic Agent Evaluation Runner #
|
173 |
gr.Markdown(
|
174 |
"""
|
175 |
**Instructions:**
|
|
|
24 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
25 |
|
26 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
# Generate response
|
28 |
print("Using Inference API for generation...")
|
29 |
response = self.client.text_generation(question)
|
|
|
30 |
answer = response
|
31 |
print(f"Agent generated response (first 50 chars): {answer[:50]}...")
|
32 |
return answer
|
|
|
99 |
continue
|
100 |
try:
|
101 |
submitted_answer = agent(question_text)
|
102 |
+
print(f"Agent is going to sumbit answer for task {task_id} (first 50 chars): {submitted_answer[:50]}...")
|
103 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
104 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
105 |
except Exception as e:
|
|
|
163 |
|
164 |
# --- Build Gradio Interface using Blocks ---
|
165 |
with gr.Blocks() as demo:
|
166 |
+
gr.Markdown("# Basic Agent Evaluation Runner #13")
|
167 |
gr.Markdown(
|
168 |
"""
|
169 |
**Instructions:**
|