LCORE-1560: Output vector stores in user-facing format#1385
Merged
tisnik merged 1 commit intolightspeed-core:mainfrom Mar 26, 2026
Merged
LCORE-1560: Output vector stores in user-facing format#1385tisnik merged 1 commit intolightspeed-core:mainfrom
tisnik merged 1 commit intolightspeed-core:mainfrom
Conversation
Contributor
WalkthroughAdds LCORE↔Llama Stack vector-store-ID translation: new utility to remap Changes
Sequence DiagramsequenceDiagram
participant Client
participant RequestHandler as Request Handler
participant Translator as ID Translator
participant CoreLogic as Core Logic
participant ResponseGen as Response Generator
Client->>RequestHandler: Send request with LCORE `vector_store_ids`
RequestHandler->>Translator: echoed_params(tools, rag_id_mapping)
Translator->>RequestHandler: Return tools with Llama Stack IDs
RequestHandler->>CoreLogic: Invoke core logic using Llama Stack IDs
CoreLogic->>ResponseGen: Produce response containing tools (Llama Stack IDs)
ResponseGen->>Translator: translate_vector_store_ids_to_user_facing(tools, rag_id_mapping)
Translator->>ResponseGen: Return tools with LCORE IDs
ResponseGen->>Client: Stream/return response with LCORE `vector_store_ids`
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/app/endpoints/responses.py`:
- Around line 486-493: The response currently only translates top-level
response["tools"] but misses translating response["tool_choice"] when
tool_choice.type == "allowed_tools", leaving internal vector DB IDs in the
echoed payload; update the code that handles chunk_dict["response"] (and the
similar block at the other response path) to call
translate_vector_store_ids_to_user_facing for both response["tools"] and
response["tool_choice"]["tools"] (when tool_choice is a dict and type ==
"allowed_tools"), using configuration.rag_id_mapping and preserving other
tool_choice fields (i.e., replace tool_choice.tools with the translated list
while keeping the rest of tool_choice intact) so both streaming and
non-streaming responses return user-facing IDs.
In `@src/models/requests.py`:
- Around line 768-780: The response currently translates data["tools"] but not
data["tool_choice"], so internal llama-stack vector IDs can be echoed; after you
assign data["tools"] using translate_vector_store_ids_to_user_facing, also
translate the echoed tool choice(s) using the same helper and mapping: locate
the code around model_dump / tools handling (symbols: model_dump, tools,
OutputToolMCP, translate_vector_store_ids_to_user_facing,
configuration.rag_id_mapping) and, if data contains "tool_choice", call
translate_vector_store_ids_to_user_facing on that value (or map its contained
IDs) to replace internal vector_store IDs with user-facing IDs before returning
data.
In `@src/utils/tool_formatter.py`:
- Around line 151-152: The function currently returns the original tools list
when rag_id_mapping is falsy, violating the "return new list" contract; change
the early return to return a shallow copy of tools (e.g., tools.copy() or
list(tools)) so the caller receives a new list object while preserving the same
tool dict identities—modify the return at the rag_id_mapping falsy check in
tool_formatter (the block containing "if not rag_id.mapping: return tools")
accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 893fc8d4-2cd3-4fda-9d54-0258a71049a8
📒 Files selected for processing (5)
docs/responses.mdsrc/app/endpoints/responses.pysrc/models/requests.pysrc/utils/tool_formatter.pytests/unit/utils/test_tool_formatter.py
c03bec1 to
6ff6acb
Compare
are-ces
approved these changes
Mar 25, 2026
Contributor
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Currently, LCORE users specify vector store IDs in user-facing format that is internally translated into LLS format.
POST v1/responsesendpoint echoes configured tools intoolsattribute that currently contains vector store IDs in LLS format.This PR introduces reverse translation to user-facing format during response processing.
Type of change
Tools used to create PR
Identify any AI code assistants used in this PR (for transparency and review context)
Related Tickets & Documents
Checklist before requesting a review
Testing
Summary by CodeRabbit
New Features
Documentation