final changes to this branch
Browse files- api.py +1 -1
- retriever/generator.py +0 -7
api.py
CHANGED
|
@@ -118,7 +118,7 @@ def _title_from_hf(query: str, client: InferenceClient, model_id: str) -> str |
|
|
| 118 |
{"role": "user", "content": user_prompt},
|
| 119 |
],
|
| 120 |
max_tokens=24,
|
| 121 |
-
temperature=0.
|
| 122 |
)
|
| 123 |
if not response or not response.choices:
|
| 124 |
return None
|
|
|
|
| 118 |
{"role": "user", "content": user_prompt},
|
| 119 |
],
|
| 120 |
max_tokens=24,
|
| 121 |
+
temperature=0.3,
|
| 122 |
)
|
| 123 |
if not response or not response.choices:
|
| 124 |
return None
|
retriever/generator.py
CHANGED
|
@@ -5,16 +5,9 @@ class RAGGenerator:
|
|
| 5 |
def generate_prompt(self, query, retrieved_contexts):
|
| 6 |
"""Prepares the academic prompt template."""
|
| 7 |
context_text = "\n\n".join([f"--- Source {i+1} ---\n{c}" for i, c in enumerate(retrieved_contexts)])
|
| 8 |
-
|
| 9 |
return f"""You are an expert academic assistant. Use the following pieces of retrieved context to answer the question.
|
| 10 |
If the answer isn't in the context, say you don't know based on the provided documents.
|
| 11 |
|
| 12 |
-
Formatting requirements:
|
| 13 |
-
- Write the response in clean Markdown.
|
| 14 |
-
- Use short headings and bullet points when helpful.
|
| 15 |
-
- Use fenced code blocks for code.
|
| 16 |
-
- Use simple markdown tables only when they improve clarity.
|
| 17 |
-
|
| 18 |
Context:
|
| 19 |
{context_text}
|
| 20 |
|
|
|
|
| 5 |
def generate_prompt(self, query, retrieved_contexts):
|
| 6 |
"""Prepares the academic prompt template."""
|
| 7 |
context_text = "\n\n".join([f"--- Source {i+1} ---\n{c}" for i, c in enumerate(retrieved_contexts)])
|
|
|
|
| 8 |
return f"""You are an expert academic assistant. Use the following pieces of retrieved context to answer the question.
|
| 9 |
If the answer isn't in the context, say you don't know based on the provided documents.
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
Context:
|
| 12 |
{context_text}
|
| 13 |
|