mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-04 04:04:14 +00:00
Address PR feedback: optimize logging and encapsulate document_id access
- Gate debug logging behind isEnabledFor check to avoid unnecessary computation - Add Chunk.document_id property to safely handle metadata/chunk_metadata extraction - Simplify RAG memory code using new property
This commit is contained in:
parent
a14f79a362
commit
2510bd349e
3 changed files with 24 additions and 11 deletions
|
@ -279,10 +279,7 @@ class MemoryToolRuntimeImpl(ToolGroupsProtocolPrivate, ToolRuntime, RAGToolRunti
|
|||
return RAGQueryResult(
|
||||
content=picked,
|
||||
metadata={
|
||||
"document_ids": [
|
||||
c.metadata.get("document_id") or (c.chunk_metadata.document_id if c.chunk_metadata else None)
|
||||
for c in chunks[: len(picked)]
|
||||
],
|
||||
"document_ids": [c.document_id for c in chunks[: len(picked)]],
|
||||
"chunks": [c.content for c in chunks[: len(picked)]],
|
||||
"scores": scores[: len(picked)],
|
||||
"vector_db_ids": [c.metadata["vector_db_id"] for c in chunks[: len(picked)]],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue