incorporate feedback

Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
This commit is contained in:
Francisco Javier Arceo 2025-10-07 13:54:41 -04:00
parent eb8acd24b0
commit 08305203d3

View file

@ -158,8 +158,8 @@ class ToolExecutor:
citation_instruction = "" citation_instruction = ""
if unique_files: if unique_files:
citation_instruction = " Cite sources immediately at the end of sentences before punctuation, using `<|file-id|>` format (e.g., 'This is a fact <|file-Cn3MSNn72ENTiiq11Qda4A|>.')." citation_instruction = (
citation_instruction += ( " Cite sources immediately at the end of sentences before punctuation, using `<|file-id|>` format (e.g., 'This is a fact <|file-Cn3MSNn72ENTiiq11Qda4A|>.'). "
"Do not add extra punctuation. Use only the file IDs provided (do not invent new ones)." "Do not add extra punctuation. Use only the file IDs provided (do not invent new ones)."
) )
@ -170,12 +170,19 @@ class ToolExecutor:
) )
# handling missing attributes for old versions # handling missing attributes for old versions
citation_files = { citation_files = {}
(r.file_id or (r.attributes.get("document_id") if r.attributes else None)): r.filename for result in search_results:
or (r.attributes.get("filename") if r.attributes else None) file_id = result.file_id
or "unknown" if not file_id and result.attributes:
for r in search_results file_id = result.attributes.get("document_id")
}
filename = result.filename
if not filename and result.attributes:
filename = result.attributes.get("filename")
if not filename:
filename = "unknown"
citation_files[file_id] = filename
return ToolInvocationResult( return ToolInvocationResult(
content=content_items, content=content_items,