Improve reference formatting to ensure URLs are included
This commit is contained in:
parent
d53198d5ab
commit
3b75436423
|
@ -365,6 +365,7 @@ class ReportSynthesizer:
|
|||
context += f"Document {i+1}:\n"
|
||||
context += f"Title: {title}\n"
|
||||
context += f"URL: {url}\n"
|
||||
context += f"Source URL: {url}\n" # Duplicate for emphasis
|
||||
context += f"Extracted information:\n{chunk.get('extracted_info', '')}\n\n"
|
||||
|
||||
# Get template modifier based on detail level and query type
|
||||
|
@ -377,11 +378,13 @@ class ReportSynthesizer:
|
|||
|
||||
[1] Title of the Article/Page. URL
|
||||
|
||||
DO NOT use generic placeholders like "Document 1" for references.
|
||||
Always use the actual title and URL from the source documents.
|
||||
|
||||
Always ensure the References section is complete and properly formatted at the end of the report.
|
||||
Ensure all references are properly closed with brackets and there are no incomplete references.
|
||||
IMPORTANT:
|
||||
1. DO NOT use generic placeholders like "Document 1" for references
|
||||
2. ALWAYS include the actual URL from the source documents
|
||||
3. Each reference MUST include both the title and the URL
|
||||
4. Make sure all references are complete and properly formatted
|
||||
5. Number the references sequentially starting from 1
|
||||
6. Include the URL for EACH reference - this is critical.
|
||||
"""
|
||||
|
||||
# Special handling for Gemini models
|
||||
|
@ -432,13 +435,15 @@ class ReportSynthesizer:
|
|||
1. Use the actual title and URL from each document
|
||||
2. DO NOT use generic placeholders like "Document 1"
|
||||
3. Format each reference as: [1] Title of the Article/Page. URL
|
||||
4. Make sure all references are complete and properly formatted
|
||||
5. Number the references sequentially starting from 1"""},
|
||||
4. Each reference MUST include both the title and the URL
|
||||
5. Make sure all references are complete and properly formatted
|
||||
6. Number the references sequentially starting from 1"""},
|
||||
{"role": "user", "content": f"""Here are the documents used in the report:
|
||||
|
||||
{context}
|
||||
|
||||
Create a complete, properly formatted References section in Markdown format."""}
|
||||
Create a complete, properly formatted References section in Markdown format.
|
||||
Remember to include the URL for EACH reference - this is critical."""}
|
||||
]
|
||||
|
||||
references = await self.generate_completion(ref_messages)
|
||||
|
|
Loading…
Reference in New Issue