Update DESIGN.md to refine reranking options and clarify configuration details

- Modified the reranking section to specify "builtin" as the default score-based reranking method, replacing previous terminology.
- Updated the RerankOptions structure to reflect changes in parameter names and types, including the transition from `topK` to `topN`.
- Enhanced documentation to clarify how reranker types are determined in the configuration file, improving overall understanding of the search module's reranking capabilities.
This commit is contained in:
Max 2025-12-12 10:12:22 +08:00
parent 7106b01f90
commit f54be0d909

View file

@ -18,7 +18,7 @@ The module follows the **Handler + Registry** pattern consistent with the `conte
- **Citation System**: Auto-generate citation IDs (`#ref:xxx`) for LLM reference - **Citation System**: Auto-generate citation IDs (`#ref:xxx`) for LLM reference
- **Real-time Output**: Stream search progress to client - **Real-time Output**: Stream search progress to client
- **Trace Integration**: Report search operations to user for transparency - **Trace Integration**: Report search operations to user for transparency
- **Reranking**: Score, Model, Agent, or MCP-based result reranking - **Reranking**: Builtin, Agent, or MCP-based result reranking
- **Graceful Degradation**: Search errors don't block agent flow - **Graceful Degradation**: Search errors don't block agent flow
## Quick Start ## Quick Start
@ -133,8 +133,7 @@ agent/search/
├── citation.go # Citation ID generation and tracking ├── citation.go # Citation ID generation and tracking
├── rerank/ # Result reranking ├── rerank/ # Result reranking
│ ├── interfaces.go # Reranker interface │ ├── interfaces.go # Reranker interface
│ ├── score.go # Score-based reranking (default) │ ├── builtin.go # Built-in score-based reranking (default)
│ ├── model.go # Model-based reranking (Cohere, etc.)
│ ├── agent.go # Agent-based reranking (delegate to another assistant) │ ├── agent.go # Agent-based reranking (delegate to another assistant)
│ └── mcp.go # MCP-based reranking (call MCP server tool) │ └── mcp.go # MCP-based reranking (call MCP server tool)
├── query/ # Query processing ├── query/ # Query processing
@ -225,18 +224,13 @@ const (
) )
``` ```
### RerankerType ### Note on Reranker
```go Reranker type is determined by `uses.rerank` in `agent/agent.yml`:
type RerankerType string
const ( - `"builtin"` - Simple score-based sorting
RerankerTypeScore RerankerType = "score" // Simple score-based sorting (default) - `"<assistant-id>"` - Delegate to an assistant (Agent)
RerankerTypeModel RerankerType = "model" // Model-based reranking (Cohere, BGE, etc.) - `"mcp:<server-id>"` - Call MCP server tool
RerankerTypeAgent RerankerType = "agent" // Agent-based reranking (delegate to assistant)
RerankerTypeMCP RerankerType = "mcp" // MCP-based reranking (call MCP server tool)
)
```
### Request ### Request
@ -284,12 +278,9 @@ type QueryOrder struct {
```go ```go
// RerankOptions controls result reranking // RerankOptions controls result reranking
// Reranker type is determined by uses.rerank in agent/agent.yml
type RerankOptions struct { type RerankOptions struct {
Type string `json:"type,omitempty"` // "score", "model", "agent", "mcp" TopN int `json:"top_n,omitempty"` // Return top N after reranking
Model string `json:"model,omitempty"` // Model ID (for type="model")
Agent string `json:"agent,omitempty"` // Agent ID (for type="agent")
MCP string `json:"mcp,omitempty"` // MCP server ID (for type="mcp")
TopK int `json:"top_k,omitempty"` // Return top K after reranking
} }
``` ```
@ -496,11 +487,8 @@ interface QueryOrder {
} }
interface RerankOptions { interface RerankOptions {
type?: string; // "score", "model", "agent", "mcp" topN?: number; // Return top N after reranking
model?: string; // Model ID (for type="model") // Note: Reranker type is determined by uses.rerank in agent/agent.yml
agent?: string; // Agent ID (for type="agent")
mcp?: string; // MCP server ID (for type="mcp")
topK?: number; // Return top K
} }
``` ```