Update DESIGN.md to clarify processing tool configurations and usage

- Revised the configuration details for keyword extraction, QueryDSL generation, and reranking tools, specifying the roles of built-in, agent, and MCP server options.
- Enhanced the formatting section to improve clarity on tool usage and examples, ensuring better understanding of the search module's capabilities.
- Updated examples to reflect the new configurations, providing clearer guidance on how to utilize the search processing tools effectively.
This commit is contained in:
Max 2025-12-12 10:01:19 +08:00
parent b5f0791f58
commit 0996a49617

View file

@ -661,13 +661,13 @@ uses:
fetch: "workers.system.fetch" fetch: "workers.system.fetch"
# Search processing tools # Search processing tools
keyword: "builtin" # Keyword extraction. "builtin", "model:gpt-4o-mini", "agent:xxx", "mcp:xxx" keyword: "builtin" # "builtin", "workers.nlp.keyword", "mcp:nlp-server"
dsl: "builtin" # QueryDSL generation. "builtin", "model:gpt-4o", "agent:xxx", "mcp:xxx" dsl: "builtin" # "builtin", "workers.nlp.dsl", "mcp:query-server"
rerank: "builtin" # Result reranking. "builtin", "model:cohere-rerank-v3", "agent:xxx", "mcp:xxx" rerank: "builtin" # "builtin", "workers.rerank", "mcp:rerank-server"
# Note: embedding & entity follow KB collection config # Note: embedding & entity follow KB collection config
``` ```
Tool format: `"builtin"`, `"model:<model-id>"`, `"agent:<assistant-id>"`, `"mcp:<server-id>"` Tool format: `"builtin"`, `"<assistant-id>"` (Agent), `"mcp:<server-id>"` (MCP)
### System Built-in Defaults ### System Built-in Defaults
@ -947,10 +947,9 @@ Request → Trace Start → Query Process → Search → Rerank → Citations
Configure via `uses.*` in `agent/agent.yml`: Configure via `uses.*` in `agent/agent.yml`:
| Format | Description | Use Case | | Format | Description | Use Case |
| ---------------------- | ----------------------------------------- | ------------------------------- | | ----------------- | ----------------------------------------- | ------------------------------ |
| `builtin` | Rule-based, template-driven (no LLM call) | Fast, low cost, simple queries | | `builtin` | Rule-based, template-driven (no LLM call) | Fast, low cost, simple queries |
| `model:<model-id>` | LLM-based extraction/generation | Complex queries, better quality | | `<assistant-id>` | Delegate to an assistant (Agent) | LLM-based, custom logic |
| `agent:<assistant-id>` | Delegate to another assistant | Custom logic, domain-specific |
| `mcp:<server-id>` | Call MCP server tool | External services integration | | `mcp:<server-id>` | Call MCP server tool | External services integration |
#### Keyword Extraction (Web Search) #### Keyword Extraction (Web Search)
@ -960,7 +959,7 @@ Configure via `uses.keyword`:
``` ```
"I want to find the best wireless headphones under $100" "I want to find the best wireless headphones under $100"
↓ builtin: simple tokenization + stopword removal ↓ builtin: simple tokenization + stopword removal
model: LLM extracts ["wireless headphones", "under $100", "best"] agent: LLM extracts ["wireless headphones", "under $100", "best"]
→ Keywords: ["wireless headphones", "under $100", "best"] → Keywords: ["wireless headphones", "under $100", "best"]
``` ```
@ -978,7 +977,7 @@ Configure via `uses.dsl`:
``` ```
"Products cheaper than $100 from Apple" "Products cheaper than $100 from Apple"
↓ builtin: template matching against model schema ↓ builtin: template matching against model schema
model: LLM generates DSL from NL + schema agent: LLM generates DSL from NL + schema
→ QueryDSL: {"wheres": [{"column": "price", "op": "<", "value": 100}, {"column": "brand", "value": "Apple"}]} → QueryDSL: {"wheres": [{"column": "price", "op": "<", "value": 100}, {"column": "brand", "value": "Apple"}]}
``` ```
@ -1015,10 +1014,9 @@ Integrates with Yao's Model/QueryDSL system:
Configure via `uses.rerank` in `agent/agent.yml`: Configure via `uses.rerank` in `agent/agent.yml`:
| Value | Notes | | Value | Notes |
| ------------------------ | ---------------------------------------- | | ------------------- | -------------------------------- |
| `builtin` | Simple score sorting (default) | | `builtin` | Simple score sorting (default) |
| `model:cohere-rerank-v3` | Cohere, BGE, Jina rerankers | | `workers.rerank` | Delegate to an assistant (Agent) |
| `agent:rerank-assistant` | Delegate to another assistant for rerank |
| `mcp:rerank-server` | Call MCP server rerank tool | | `mcp:rerank-server` | Call MCP server rerank tool |
## Error Handling ## Error Handling