Support local in-process vLLM LLMs for agentic retrieval#2380
Conversation
bbee8aa to
7acc5af
Compare
Greptile SummaryThis PR adds an in-process vLLM LLM adapter (
|
| Filename | Overview |
|---|---|
| nemo_retriever/src/nemo_retriever/models/local/agent_llm.py | New file: in-process vLLM chat-completion adapter with tool-call parsing, message normalization for Llama chat templates, and proper GPU teardown via EngineCore shutdown. |
| nemo_retriever/src/nemo_retriever/query/agentic.py | Adds in-process LLM backend selection, lazy-loads the local LLM on first retrieve() call, and ensures unload() is called in all public entry points. |
| nemo_retriever/src/nemo_retriever/harness/resolution.py | Adds four new local vLLM override paths; gpu_memory_utilization and tensor_parallel_size are explicitly cast, but local_max_model_len and local_max_num_seqs are left as raw strings. |
| nemo_retriever/src/nemo_retriever/operators/graph_ops/react_agent_operator.py | Adds chat_completion_fn injection, removes enforce_top_k (previously a public parameter), unconditionally emits the exact-count instruction, and adds doc-ID hallucination validation. |
| nemo_retriever/src/nemo_retriever/operators/graph_ops/selection_agent_operator.py | Adds chat_completion_fn injection; strengthens input validation by rejecting non-list doc_ids and out-of-candidate-set IDs with structured LLM feedback. |
| nemo_retriever/tests/test_agentic_local_llm.py | New test file with broad unit coverage of VLLMAgentChatLLM: alias resolution, tool-call parsing, message normalization, EngineCore shutdown, and AgenticRetriever unload lifecycle. |
Sequence Diagram
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant CLI as CLI / Harness
participant AR as AgenticRetriever
participant GCCF as _get_chat_completion_fn()
participant VLLM as VLLMAgentChatLLM
participant React as ReActAgentOperator
participant Select as SelectionAgentOperator
CLI->>AR: retrieve(query_ids, queries)
AR->>GCCF: lazy-init (self._lock)
GCCF-->>VLLM: create_local_agent_llm() [first call only]
GCCF-->>AR: chat_completion_fn
AR->>React: "run(df, chat_completion_fn=fn)"
loop ReAct steps
React->>VLLM: __call__(messages, tools)
VLLM-->>React: OpenAI-compatible response dict
end
AR->>Select: "run(df, chat_completion_fn=fn)"
loop Selection steps
Select->>VLLM: __call__(messages, tools)
VLLM-->>Select: OpenAI-compatible response dict
end
AR-->>CLI: ranked DataFrame
CLI->>AR: unload()
AR->>VLLM: unload() → EngineCore.shutdown()
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant CLI as CLI / Harness
participant AR as AgenticRetriever
participant GCCF as _get_chat_completion_fn()
participant VLLM as VLLMAgentChatLLM
participant React as ReActAgentOperator
participant Select as SelectionAgentOperator
CLI->>AR: retrieve(query_ids, queries)
AR->>GCCF: lazy-init (self._lock)
GCCF-->>VLLM: create_local_agent_llm() [first call only]
GCCF-->>AR: chat_completion_fn
AR->>React: "run(df, chat_completion_fn=fn)"
loop ReAct steps
React->>VLLM: __call__(messages, tools)
VLLM-->>React: OpenAI-compatible response dict
end
AR->>Select: "run(df, chat_completion_fn=fn)"
loop Selection steps
Select->>VLLM: __call__(messages, tools)
VLLM-->>Select: OpenAI-compatible response dict
end
AR-->>CLI: ranked DataFrame
CLI->>AR: unload()
AR->>VLLM: unload() → EngineCore.shutdown()
Reviews (8): Last reviewed commit: "Merge branch 'main' into dev/wasonmahika..." | Re-trigger Greptile
|
Also found these two possible snags, would like to know if these are by design or actual problems (found by codex):
|
Handling these in-process boundary issues as described below:
|
5cc26bc to
ac95fbb
Compare
Description
Validation
uv run pytest tests/test_agentic_local_llm.py tests/test_agentic_eval.py tests/test_harness_agentic_eval.py tests/test_root_query_cli.py -quvx pre-commit run --all-filesChecklist