feat: optimize ILLMService interface to support different models for each component

- Add LLMServiceConfig to support mixed model configuration
- Enable Planner, Asserter, Querier to use different optimal models
- Provide recommended configurations for various use cases
- Maintain backward compatibility with existing API
- Update documentation to reflect current state without iteration history
- Merge test files and add comprehensive configuration tests
- Resolve circular dependency by moving config to option package
This commit is contained in:
lilong.129
2025-06-11 12:18:31 +08:00
parent 50414ec74d
commit fbc888655f
6 changed files with 444 additions and 708 deletions

View File

@@ -33,13 +33,24 @@ func NewXTDriver(driver IDriver, opts ...option.AIServiceOption) (*XTDriver, err
return nil, err
}
}
if services.LLMService != "" {
// Handle LLM service initialization
if services.LLMConfig != nil {
// Use advanced LLM configuration if provided
driverExt.LLMService, err = ai.NewLLMServiceWithOptionConfig(services.LLMConfig)
if err != nil {
return nil, errors.Wrap(err, "init llm service with config failed")
}
} else if services.LLMService != "" {
// Fallback to simple LLM service if no config provided
driverExt.LLMService, err = ai.NewLLMService(services.LLMService)
if err != nil {
return nil, errors.Wrap(err, "init llm service failed")
}
}
// Register uixt MCP tools to LLM service
// Register uixt MCP tools to LLM service if it exists
if driverExt.LLMService != nil {
mcpTools := driverExt.client.Server.ListTools()
einoTools := ai.ConvertMCPToolsToEinoToolInfos(mcpTools, "uixt")
if err := driverExt.LLMService.RegisterTools(einoTools); err != nil {