modified: config.py
modified: services/llm_service.py modified: services/rag_service.py
This commit is contained in:
@@ -55,13 +55,18 @@ def ask(
|
||||
model = _get_model()
|
||||
|
||||
system_parts = [
|
||||
"You are a helpful AI assistant. Answer questions accurately based on the provided context.",
|
||||
"If the context does not contain enough information, say so clearly.",
|
||||
"You are a helpful AI assistant. You will be given excerpts from one or more documents "
|
||||
"as context. Synthesize the information from ALL relevant excerpts to give a complete answer. "
|
||||
"The excerpts are ordered by their position in the document.",
|
||||
"If specific information is not contained in the context, say so clearly.",
|
||||
"When the answer spans multiple sections, summarize each relevant part.",
|
||||
]
|
||||
|
||||
if context_chunks:
|
||||
context_text = "\n\n---\n\n".join(context_chunks)
|
||||
system_parts.append(f"\n\n## Context\n\n{context_text}")
|
||||
context_text = "\n\n---\n\n".join(
|
||||
f"[Excerpt {i+1}]\n{chunk}" for i, chunk in enumerate(context_chunks)
|
||||
)
|
||||
system_parts.append(f"\n\n## Document excerpts\n\n{context_text}")
|
||||
|
||||
if system_extra:
|
||||
system_parts.append(system_extra)
|
||||
|
||||
Reference in New Issue
Block a user