Spaces:
Runtime error
Runtime error
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -13,13 +13,9 @@ qa_pipeline = pipeline("text2text-generation", model="Qwen/Qwen1.5-1.8B-Chat")
|
|
| 13 |
|
| 14 |
def run_agent_on_question(question_obj):
|
| 15 |
question = question_obj["question"]
|
| 16 |
-
|
| 17 |
-
prompt = f"Answer the following question as concisely as possible:\n{question}"
|
| 18 |
result = qa_pipeline(prompt, max_new_tokens=50, do_sample=False)[0]["generated_text"]
|
| 19 |
-
|
| 20 |
-
# Strip any prefix like "Answer:" or whitespace
|
| 21 |
-
return result.strip().split("\n")[0].replace("Answer: ", "").strip()
|
| 22 |
-
|
| 23 |
|
| 24 |
def simple_llm_call(prompt: str) -> str:
|
| 25 |
"""
|
|
|
|
| 13 |
|
| 14 |
def run_agent_on_question(question_obj):
|
| 15 |
question = question_obj["question"]
|
| 16 |
+
prompt = f"Answer this question:\n{question}"
|
|
|
|
| 17 |
result = qa_pipeline(prompt, max_new_tokens=50, do_sample=False)[0]["generated_text"]
|
| 18 |
+
return result.strip().replace("Answer: ", "").split("\n")[0]
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
def simple_llm_call(prompt: str) -> str:
|
| 21 |
"""
|