mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-06 07:57:27 +08:00
feat: add MCP tools registration to LLM service
- Add RegisterTools method to ILLMService interface - Create shared MCP to eino tool converter - Auto-register built-in uixt tools in XTDriver initialization - Refactor MCPHost to use shared converter - Add comprehensive test coverage for tool conversion This enables doubao-1.5-thinking-vision-pro model to access MCP tools through function calling mechanism.
This commit is contained in:
@@ -3,6 +3,7 @@ package ai
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/cloudwego/eino/schema"
|
||||
"github.com/httprunner/httprunner/v5/uixt/option"
|
||||
)
|
||||
|
||||
@@ -10,6 +11,8 @@ import (
|
||||
type ILLMService interface {
|
||||
Call(ctx context.Context, opts *PlanningOptions) (*PlanningResult, error)
|
||||
Assert(ctx context.Context, opts *AssertOptions) (*AssertionResult, error)
|
||||
// RegisterTools registers tools for function calling
|
||||
RegisterTools(tools []*schema.ToolInfo) error
|
||||
}
|
||||
|
||||
func NewLLMService(modelType option.LLMServiceType) (ILLMService, error) {
|
||||
@@ -49,3 +52,12 @@ func (c *combinedLLMService) Call(ctx context.Context, opts *PlanningOptions) (*
|
||||
func (c *combinedLLMService) Assert(ctx context.Context, opts *AssertOptions) (*AssertionResult, error) {
|
||||
return c.asserter.Assert(ctx, opts)
|
||||
}
|
||||
|
||||
// RegisterTools registers tools for function calling
|
||||
func (c *combinedLLMService) RegisterTools(tools []*schema.ToolInfo) error {
|
||||
// Only register tools to planner since asserter doesn't need tools
|
||||
if planner, ok := c.planner.(*Planner); ok {
|
||||
return planner.RegisterTools(tools)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user