Sub-issue: Implement Web Search Tool - Backend (NF.SM3.B) #117
Labels
No labels
Epic 5
MCP
P1
PR-0
PR-1
api
api-layer
architecture
area:backend
area:frontend
arrow
authentication
backend
bug
chat
client
clipboard
common-module
compose
cross-cutting
cross-cutting-requirement
data-layer
data-models
database
desktop-client
documentation
duplicate
enhancement
epic
epic-1
epic-2
epic-3
epic-4
epic-5
epic-6
epic-7
epic-llm-config
error-handling
feature
frontend
good first issue
help wanted
implementation
infrastructure
installer
invalid
kotlin
ktor
llm
medium-priority
message
multiplatform
needs-review
needs-triage
packaging
performance
phase-1
phase-2
phase-3
phase-4
phase-5
phase3
phase:3
priority: high
question
refactor
refactoring
resource-sharing
security
server
server-module
services
session
session-management
settings
setup
shutdown
state
storage
streaming
sub-issue
tests
tooling
type:task
ui
ui/ux
user-accounts
user-management
ux
viewmodel
websocket
windows
windows-integration
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Torvian.eu/chatbot#117
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Sub-issue: Implement Web Search Tool - Backend (NF.SM3.B)
Labels:
backend,feature,LLM,tooling,sub-issueParent Issue: https://github.com/rwachters/chatbot/issues/115
Executive Summary
This sub-issue covers all backend development required for the web search tool feature. This includes setting up the data layer, implementing core tool services, integrating tool calling with LLM strategies, and exposing necessary APIs for tool management and session-specific configurations.
User Story Requirements (Backend Focus)
Implementation Plan
Phase 1: Foundation (Backend Data & Services)
ToolDefinitionTable,ToolCallTable,SessionToolConfigTable) and updateExposedDataManager(server main).ToolDefinition,ToolCall, andSessionToolConfig.ToolDefinition,ToolType,ToolCall,ToolCallStatus, andRawChatMessage.ToolServiceand its implementation.ToolExecutorinterface,WebSearchToolExecutor, andToolExecutorFactory.Phase 2: LLM Integration
LLMCompletionResultandLLMStreamChunkto include tool calls.ChatCompletionStrategyinterface and implementations (OpenAIChatStrategy, OllamaChatStrategy) to handle tools.MessageServiceImplto implement the tool calling loop, context building withRawChatMessage, and tool execution.LLMApiClientandLLMApiClientKtorto pass tools.Phase 3: API Layer
configureToolRoutes.kt.ToolResource,CreateToolRequest,UpdateToolRequest,SetToolEnabledRequest).configureToolRoutestoApiRoutesKtor.Key Considerations (Backend)
MessageServiceImplwill implement a loop to handle multiple tool calls in a single turn, creating/updating a single assistant message.buildContextmethod will convertChatMessagehistory intoRawChatMessageobjects, including tool calls and their results, for LLM API communication. Tool results are not stored as separate chat messages but are reconstructed for context.LLMModel.hasCapability(LLMModelCapabilities.TOOL_CALLING)to ensure tool usage is restricted to capable models.DatabaseInitializer.Estimated Effort
Approximately 10-14 days.
Reference
This issue is based on the detailed implementation report: docs/plans/web search tool/report.md