-
Notifications
You must be signed in to change notification settings - Fork 3.2k
improvement(tool-input): general abstraction to enrich agent context, reuse visibility helpers #2872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nce for tags, fix visibility of subblocks
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR introduces a general abstraction for enriching agent context with runtime-dependent schema information, with the primary use case being Knowledge Base tags. The implementation consolidates visibility helpers and improves parameter handling across the codebase. Key Changes:
Issues Found:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant UI as Tool Input UI
participant Store as Block Store
participant Params as params.ts
participant Enricher as schema-enrichers.ts
participant API as Tag Definitions API
participant Handler as Agent Handler
participant Provider as Provider Utils
participant Tool as Tool Execution
Note over UI,Store: User configures KB ID
UI->>Store: Set knowledgeBaseId
Note over UI,Params: Build preview context
UI->>Params: buildPreviewContextValues()
Params-->>UI: Resolved canonical values
Note over UI,API: Fetch tag definitions for UI
UI->>API: GET /api/knowledge/{id}/tag-definitions
API-->>UI: Tag definitions array
UI->>UI: Render document-tag-entry/tag-filters
Note over Handler,Tool: Agent executes tool with params
Handler->>Provider: prepareToolExecution(tool, llmArgs)
Provider->>Params: mergeToolParameters(userParams, llmArgs)
Params-->>Provider: Merged tool params
Note over Provider,Tool: Create LLM tool schema
Provider->>Params: createLLMToolSchema(toolConfig, userParams)
Params->>Params: Check schemaEnrichment config
alt documentTags/tagFilters has enrichment
Params->>Enricher: enrichKBTagsSchema(knowledgeBaseId)
Enricher->>API: GET /api/knowledge/{id}/tag-definitions
API-->>Enricher: Tag definitions
Enricher-->>Params: Dynamic schema with KB tags
Params-->>Provider: LLM schema with enriched params
end
Provider->>Tool: Execute with merged params + enriched schema
Note over Tool,Params: Parse and normalize tags
Tool->>Params: parseDocumentTags(value)
Params-->>Tool: Normalized tag entries
Tool->>Params: formatDocumentTagsForAPI(tags)
Params-->>Tool: documentTagsData JSON
Tool-->>Handler: Tool execution result
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
25 files reviewed, 3 comments
Summary
Type of Change
Testing
Tested manually
Checklist