Modify the system instruction to try to give better answer.
Browse files
app.py
CHANGED
|
@@ -19,7 +19,6 @@ class BasicAgent:
|
|
| 19 |
print("BasicAgent initialized.")
|
| 20 |
|
| 21 |
print("Loading huggingface default model...")
|
| 22 |
-
# self.client = InferenceClient(model="mistralai/Mistral-7B-Instruct-v0.3", token=os.getenv("HF_TOKEN"))
|
| 23 |
self.client = OpenAI(base_url="https://openrouter.ai/api/v1", api_key=os.getenv("OR_TOKEN"))
|
| 24 |
|
| 25 |
def __call__(self, question: str) -> str:
|
|
@@ -28,9 +27,6 @@ class BasicAgent:
|
|
| 28 |
try:
|
| 29 |
# Generate response
|
| 30 |
print("Using Inference API for generation...")
|
| 31 |
-
# prompt = f"""<s>[INST] Answer the following question directly without any explanations, introductions, or conclusions. Just provide the answer itself: {question} [/INST]</s>"""
|
| 32 |
-
# response = self.client.text_generation(prompt, max_new_tokens=512, do_sample=True, temperature=0.1)
|
| 33 |
-
# answer = response
|
| 34 |
completion = self.client.chat.completions.create(
|
| 35 |
extra_headers={
|
| 36 |
"HTTP-Referer": "<YOUR_SITE_URL>", # Optional. Site URL for rankings on openrouter.ai.
|
|
@@ -41,7 +37,7 @@ class BasicAgent:
|
|
| 41 |
messages=[
|
| 42 |
{
|
| 43 |
"role": "system",
|
| 44 |
-
"content": "Answer the
|
| 45 |
},
|
| 46 |
{
|
| 47 |
"role": "user",
|
|
@@ -202,7 +198,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
| 202 |
|
| 203 |
# --- Build Gradio Interface using Blocks ---
|
| 204 |
with gr.Blocks() as demo:
|
| 205 |
-
gr.Markdown("# Basic Agent Evaluation Runner #
|
| 206 |
gr.Markdown(
|
| 207 |
"""
|
| 208 |
**Instructions:**
|
|
|
|
| 19 |
print("BasicAgent initialized.")
|
| 20 |
|
| 21 |
print("Loading huggingface default model...")
|
|
|
|
| 22 |
self.client = OpenAI(base_url="https://openrouter.ai/api/v1", api_key=os.getenv("OR_TOKEN"))
|
| 23 |
|
| 24 |
def __call__(self, question: str) -> str:
|
|
|
|
| 27 |
try:
|
| 28 |
# Generate response
|
| 29 |
print("Using Inference API for generation...")
|
|
|
|
|
|
|
|
|
|
| 30 |
completion = self.client.chat.completions.create(
|
| 31 |
extra_headers={
|
| 32 |
"HTTP-Referer": "<YOUR_SITE_URL>", # Optional. Site URL for rankings on openrouter.ai.
|
|
|
|
| 37 |
messages=[
|
| 38 |
{
|
| 39 |
"role": "system",
|
| 40 |
+
"content": "Answer the follow question with EXACT ANSWER with no explanation, introduction, or conclusions. Always give answer in same language as question."
|
| 41 |
},
|
| 42 |
{
|
| 43 |
"role": "user",
|
|
|
|
| 198 |
|
| 199 |
# --- Build Gradio Interface using Blocks ---
|
| 200 |
with gr.Blocks() as demo:
|
| 201 |
+
gr.Markdown("# Basic Agent Evaluation Runner #23")
|
| 202 |
gr.Markdown(
|
| 203 |
"""
|
| 204 |
**Instructions:**
|