[Recon-Chatbot] Call Recon methods directly instead of using HTTP-calls.#10524
Draft
ArafatKhan2198 wants to merge 4 commits into
Draft
[Recon-Chatbot] Call Recon methods directly instead of using HTTP-calls.#10524ArafatKhan2198 wants to merge 4 commits into
ArafatKhan2198 wants to merge 4 commits into
Conversation
Use validateToolCall/validateToolCalls for pre-execution checks, raise summarization max_tokens for reasoning models, and handle null provider text. Co-authored-by: Cursor <cursoragent@cursor.com>
…trics tool, and improve tool semantics. - Introduce GenParams (typed temperature + maxTokens) to replace untyped Map<String,Object> parameter passing; delete four dead parse helpers in LangChain4jDispatcher. - Decompose chatWithTools into buildChatRequest / toLangChain4jToolSpecs / invokeModel / toLLMResponse private helpers; merge chatWithTools into a single chatCompletion method. - Rename getToolCall → chooseToolsForQuery for clarity. - Inline ReconQueryRequest (single-use DTO); ReconQueryExecutor now accepts (toolName, params) directly. - Remove write-only LLMResponse.metadata field; retype ReconQueryResult.responseBody to JsonNode; delete dead ChatbotUtils.extractFirstJsonObject and its test class. - Replace if/else if chain in ReconEndpointRouter with a switch; extract dense multi-arg dispatch branches into named helpers; fix checkstyle (import order, missing braces, long lines). - Remove api_v1_metrics_api tool (Prometheus proxy): drop from allowlist, LlmToolSpecFactory, router, and test fixtures; router is now entirely in-JVM. - Rewrite recon-tool-semantics.md as a method-call/tool-selection guide: endpoint-by-endpoint coverage, explicit open-vs-committed/FSO-trap and task-status disambiguation, parameter extraction rules, behavior-honesty contract (1000-record cap, not-randomized), and a ~55-row regression test matrix. - Update test fixtures for all signature changes; delete TestChatbotAgentJsonExtraction. Co-Authored-By: Claude <noreply@anthropic.com>
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.
What changes were proposed in this pull request?
This PR refactors the Recon chatbot so it fetches cluster data by calling Recon methods in-process, instead of making HTTP requests back to the same Recon server.
Previously, the chatbot ran inside the Recon JVM but still used the Recon REST API to answer questions. That added unnecessary overhead: URL construction, HTTP handling, and response parsing for data Recon already exposes in Java.
This change introduces a direct query path (
ReconQueryExecutor,ReconEndpointRouter, and related helpers) that maps LLM-selected tools to the corresponding Recon logic. LangChain4j native tool-calling is used end to end for tool selection and execution. The old HTTP-based tool executor and OpenAPI-driven prompt resources are removed in favor of a simpler tool semantics model.Existing safety behavior is preserved: only allowlisted tools can run, query limits are enforced, and scoped queries (for example, bucket-scoped key listing) still apply. The public Recon REST API used by the UI is unchanged.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15570
How was this patch tested?
TestReconQueryExecutor,TestReconEndpointRouter,TestReconApiAllowlist,TestLlmRouting, and related agent/LLM tests)