Support local in-process vLLM LLMs for agentic retrieval#2380
Conversation
bbee8aa to
7acc5af
Compare
Greptile SummaryThis PR introduces an in-process vLLM backend for agentic retrieval, defaulting
|
| Filename | Overview |
|---|---|
| nemo_retriever/src/nemo_retriever/models/local/agent_llm.py | New file: in-process vLLM adapter for agentic LLM inference. Well-structured with process-level model caching, thread-safe call path, and tool-call JSON parsing fallback. Key concern: VLLMAgentChatLLM is constructed while holding _LOCAL_AGENT_LLM_CACHE_LOCK, blocking concurrent unload operations for the full model-load duration. |
| nemo_retriever/src/nemo_retriever/query/agentic.py | Adds in-process backend routing, lazy chat_completion_fn initialisation, and new local vLLM config knobs to AgenticRetrievalConfig. Breaking change: custom model names without invoke_url previously reached the NVIDIA endpoint; now they raise ValueError at construction time. |
| nemo_retriever/src/nemo_retriever/operators/graph_ops/react_agent_operator.py | Wires optional chat_completion_fn injection, removes enforce_top_k parameter (now always-on), and adds valid-doc-id validation to final_results. enforce_top_k removal is a breaking API change without a deprecation shim. |
| nemo_retriever/src/nemo_retriever/operators/graph_ops/selection_agent_operator.py | Adds chat_completion_fn injection and replaces the silent invalid-doc-id filter with an explicit LLM feedback loop that retries on hallucinated IDs. |
| nemo_retriever/src/nemo_retriever/harness/resolution.py | Adds four new local vLLM override paths and wires them into build_query_request. Uses the or-based fallback for agentic_local_gpu_memory_utilization which silently substitutes 0.8 for any falsy value, though downstream validation catches 0.0. |
| nemo_retriever/src/nemo_retriever/models/init.py | Adds create_local_agent_llm factory with a backend-normalisation guard. Lazy-imports the vLLM adapter and delegates to create_cached_vllm_agent_chat_llm. Clean addition. |
| nemo_retriever/src/nemo_retriever/models/hf_model_registry.py | Adds pinned HF revisions for nvidia/Llama-3.1-Nemotron-Nano-8B-v1 and nvidia/Llama-3_3-Nemotron-Super-49B-v1. Straightforward, safe addition. |
| nemo_retriever/tests/test_agentic_local_llm.py | New test file covering alias resolution, config propagation, tool-call JSON parsing, consecutive-tool-message collapsing, unload lifecycle, and cache clearing, all without real GPU requirements. Good unit coverage. |
Comments Outside Diff (1)
-
nemo_retriever/src/nemo_retriever/query/agentic.py, line 223-234 (link)Breaking config contract for existing in-process callers
AgenticRetrievalConfig(llm_model="custom-model")(withoutinvoke_url) previously resolved to the NVIDIA endpoint silently; now it raisesValueError("Unsupported in-process agentic LLM model"). Any integration that constructsAgenticRetrievalConfigwith a non-allowlisted model name and noinvoke_urlwill break at config construction time. The error message is clear and the new behaviour is arguably better, but under theapi-backward-compatibilityrule this is a breaking change to a public configuration class that requires a migration note or deprecation period.Rule Used: Changes to public API surfaces (FastAPI endpoints,... (source)
Prompt To Fix With AI
This is a comment left during a code review. Path: nemo_retriever/src/nemo_retriever/query/agentic.py Line: 223-234 Comment: **Breaking config contract for existing in-process callers** `AgenticRetrievalConfig(llm_model="custom-model")` (without `invoke_url`) previously resolved to the NVIDIA endpoint silently; now it raises `ValueError("Unsupported in-process agentic LLM model")`. Any integration that constructs `AgenticRetrievalConfig` with a non-allowlisted model name and no `invoke_url` will break at config construction time. The error message is clear and the new behaviour is arguably better, but under the `api-backward-compatibility` rule this is a breaking change to a public configuration class that requires a migration note or deprecation period. **Rule Used:** Changes to public API surfaces (FastAPI endpoints,... ([source](.greptile)) How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
nemo_retriever/src/nemo_retriever/query/agentic.py:223-234
**Breaking config contract for existing in-process callers**
`AgenticRetrievalConfig(llm_model="custom-model")` (without `invoke_url`) previously resolved to the NVIDIA endpoint silently; now it raises `ValueError("Unsupported in-process agentic LLM model")`. Any integration that constructs `AgenticRetrievalConfig` with a non-allowlisted model name and no `invoke_url` will break at config construction time. The error message is clear and the new behaviour is arguably better, but under the `api-backward-compatibility` rule this is a breaking change to a public configuration class that requires a migration note or deprecation period.
Reviews (4): Last reviewed commit: "cleanup and added local llm agentic conf..." | Re-trigger Greptile
|
Also found these two possible snags, would like to know if these are by design or actual problems (found by codex):
|
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