mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-12 20:12:33 +00:00
incorporate feedback
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
This commit is contained in:
parent
eb8acd24b0
commit
08305203d3
1 changed files with 16 additions and 9 deletions
|
|
@ -158,9 +158,9 @@ 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)."
|
||||||
)
|
)
|
||||||
|
|
||||||
content_items.append(
|
content_items.append(
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue