Add data source registry and update related configurations#90
Add data source registry and update related configurations#90AjayThorve wants to merge 4 commits intoNVIDIA-AI-Blueprints:developfrom
Conversation
Greptile SummaryReplaces fragile string pattern matching ( Key improvements:
Backward compatibility:
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[YAML Config] -->|data_source_registry| B[NAT WorkflowBuilder.from_config]
B -->|Calls register function| C[data_source_registry_fn]
C -->|Detects function groups| D[builder._function_groups]
C -->|Populates| E[Global Registry State]
E -->|_registry| F[DataSourceMeta objects]
E -->|_tool_source_map| G[Exact tool → source ID]
E -->|_group_source_map| H[Group prefix → source ID]
I[GET /v1/data_sources] -->|get_all_sources| F
J[Chat Request] -->|data_sources filter| K[filter_tools_by_sources]
K -->|get_source_id_for_tool| G
K -->|Prefix match longest-first| H
K -->|Filtered tools| L[Agent Execution]
M[Unknown tools] -->|source_id = None| N[Always included]
N --> L
Last reviewed commit: 0dd5bd2 |
77edd8f to
734ff44
Compare
…AML configuration and API integration
…prefixes and add corresponding unit tests
…ion and improving group name handling for deterministic prefix matching. Update related functions to utilize the new structure and ensure consistent tool mapping.
|
I'm wondering if we could reduce the number of places we need to change config by registering the data source in each agent code itself if the tool is set by the agent config. Right now, we already repeatedly list tools in each agent function. This would make the config harder to maintain as tools/agents increase. Is this feasible? |
good feedback, let me see if that can be done |
Replace hardcoded data source pattern matching with a config-driven registry.
Problem
Data source filtering (web search, knowledge base, etc.) relied on fragile string pattern matching — checking if tool names contain substrings like
"web","tavily", or"knowledge". This caused real bugs:search—"knowledge" in "search"failsawesome_retrieversilently breaks filtering"web" in "web_calculator"produces false positivesdata_sources.py,jobs.py, pattern lists)Solution
A new
data_source_registryNAT function type that makes data sources fully config-driven:UI Integration
All registered data sources are automatically available via the GET /v1/data_sources API endpoint, which the new UI consumes to render source toggles. Any source added to the YAML config will appear in the UI
with its configured display name and description — no frontend changes needed. Per-message filtering via data_sources: ["web_search", "knowledge_layer"] in the chat payload continues to work as before.
Backward Compatibility is maintained.