builtin_tools

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ImageGenerateSuccessStatus = "success"
	ImageGenerateErrorStatus   = "error"
)
View Source
const (
	DefaultScheme  = "https"
	DefaultTimeout = 600
)
View Source
const (
	VideoGenerateSuccessStatus = "success"
	VideoGenerateErrorStatus   = "error"
)

Variables

View Source
var (
	ErrInvalidAppID  = errors.New("LLM Shield App ID is not configured. Please configure it via environment TOOL_LLM_SHIELD_APP_ID")
	ErrInvalidApiKey = errors.New("LLM Shield auth invalid, Please configure it via environment TOOL_LLM_SHIELD_API_KEY or VOLCENGINE_ACCESS_KEY and VOLCENGINE_SECRET_KEY")
)
View Source
var CategoryMap = map[string]string{
	"101": "Model Misuse",
	"103": "Sensitive Information",
	"104": "Prompt Injection",
	"106": "General Topic Control",
	"107": "Computational Resource Consumption",
}
View Source
var ErrInvalidToolID = errors.New("agentkit tool id is invalid")

Functions

func LoadKnowledgeBaseTool

func LoadKnowledgeBaseTool(knowledge *knowledgebase.KnowledgeBase) (tool.Tool, error)

LoadKnowledgeBaseTool Loads the knowledgebase tools from a backend. Args: query: The query to load the knowledgebase for. Returns: A list of knowledge base results.

func LoadLongMemoryTool

func LoadLongMemoryTool() (tool.Tool, error)

func NewImageGenerateTool

func NewImageGenerateTool(config *ImageGenerateConfig) (tool.Tool, error)

func NewLLMShieldPlugins added in v0.0.5

func NewLLMShieldPlugins() (*plugin.Plugin, error)

func NewMcpRouter added in v0.0.3

func NewMcpRouter() tool.Toolset

func NewRunCodeSandboxTool added in v0.0.2

func NewRunCodeSandboxTool() (tool.Tool, error)

func NewVideoGenerateTool

func NewVideoGenerateTool(config *VideoGenerateConfig) (tool.Tool, error)

Types

type Args

type Args struct {
	Query string `json:"query" jsonschema:"The query to search for in the memory."`
}

type Decision added in v0.0.5

type Decision struct {
	DecisionType   int             `json:"DecisionType"`
	DecisionDetail *DecisionDetail `json:"DecisionDetail"`
	HitStrategyIDs []string        `json:"HitStrategyIDs"`
}

type DecisionDetail added in v0.0.5

type DecisionDetail struct {
	BlockDetail   map[string]interface{} `json:"BlockDetail"`
	ReplaceDetail *ReplaceDetail         `json:"ReplaceDetail"`
}

type GenerateImagesRequest

type GenerateImagesRequest struct {
	TaskType                  string      `json:"task_type"`
	Prompt                    string      `json:"prompt"`
	Size                      string      `json:"size,omitempty"`
	ResponseFormat            string      `json:"response_format,omitempty"`
	Watermark                 *bool       `json:"watermark,omitempty"`
	Image                     interface{} `json:"image,omitempty"`
	SequentialImageGeneration string      `json:"sequential_image_generation,omitempty"`
	MaxImages                 int         `json:"max_images,omitempty"`
}

type GenerateVideosRequest

type GenerateVideosRequest struct {
	VideoName  string  `json:"video_name"`
	Prompt     string  `json:"prompt"`
	FirstFrame *string `json:"first_frame,omitempty"`
	LastFrame  *string `json:"last_frame,omitempty"`
}

type ImageGenerateConfig

type ImageGenerateConfig struct {
	ModelName string
	APIKey    string
	BaseURL   string
}

type ImageGenerateToolChanelMessage

type ImageGenerateToolChanelMessage struct {
	Status       string
	ErrorMessage string
	Result       *ImageResult
}

type ImageGenerateToolRequest

type ImageGenerateToolRequest struct {
	Tasks []GenerateImagesRequest `json:"tasks"`
}

type ImageGenerateToolResult

type ImageGenerateToolResult struct {
	SuccessList []*ImageResult `json:"success_list,omitempty"`
	ErrorList   []*ImageResult `json:"error_list,omitempty"`
	Status      string
}

type ImageResult

type ImageResult struct {
	ImageName string `json:"image_name"`
	Url       string `json:"url"`
}

type KnowledgeBaseResult

type KnowledgeBaseResult struct {
	Result []ktypes.KnowledgeEntry `json:"result,omitempty"`
}

type LLMShieldClient added in v0.0.5

type LLMShieldClient struct {
	URL     string
	Region  string
	AppID   string
	APIKey  string
	Timeout int
}

func NewLLMShieldClient added in v0.0.5

func NewLLMShieldClient(timeout int) (*LLMShieldClient, error)

type LLMShieldData added in v0.0.5

type LLMShieldData struct {
	MsgID         string      `json:"MsgID"`
	RiskInfo      *RiskInfo   `json:"RiskInfo"`
	Decision      *Decision   `json:"Decision"`
	PermitInfo    *PermitInfo `json:"PermitInfo"`
	ContentInfo   string      `json:"ContentInfo"`
	Degraded      bool        `json:"Degraded"`
	DegradeReason string      `json:"DegradeReason"`
}

type LLMShieldResult added in v0.0.5

type LLMShieldResult struct {
	ResponseMetadata *ResponseMetadata `json:"ResponseMetadata"`
	Result           *LLMShieldData    `json:"Result"`
}

type Matches added in v0.0.5

type Matches struct {
	Word   string `json:"Word"`
	Source int    `json:"Source"`
}

type PermitInfo added in v0.0.5

type PermitInfo struct {
	Permits interface{} `json:"Permits"`
}

type QueryKnowledgeReq

type QueryKnowledgeReq struct {
	Query string `json:"query" jsonschema:"The query for loading the knowledge base for this tools"`
}

type ReplaceDetail added in v0.0.5

type ReplaceDetail struct {
	Replacement interface{} `json:"Replacement"`
}

type ResponseMetadata added in v0.0.5

type ResponseMetadata struct {
	RequestID string `json:"RequestId"`
	Service   string `json:"Service"`
	Region    string `json:"Region"`
	Action    string `json:"Action"`
	Version   string `json:"Version"`
}

type Result

type Result struct {
	Results []string `json:"results"`
}

type RiskInfo added in v0.0.5

type RiskInfo struct {
	Risks []*Risks `json:"Risks"`
}

type Risks added in v0.0.5

type Risks struct {
	Category string     `json:"Category"`
	Label    string     `json:"Label"`
	Prob     float64    `json:"Prob,omitempty"`
	Matches  []*Matches `json:"Matches,omitempty"`
}

type RunCodeArgs added in v0.0.2

type RunCodeArgs struct {
	Code     string `json:"code" jsonschema:"The code to run."`
	Language string `json:"language" jsonschema:"The programming language of the code. Language must be one of the supported languages: python3."`
	Timeout  uint   `json:"timeout" jsonschema:"The timeout in seconds for the code execution. Defaults to 30."`
}

type VideoGenerateConfig

type VideoGenerateConfig struct {
	ModelName string
	APIKey    string
	BaseURL   string
}

type VideoGenerateResult

type VideoGenerateResult struct {
	SuccessList []*VideoResult `json:"success_list,omitempty"`
	ErrorList   []*VideoResult `json:"error_list,omitempty"`
	Status      string
}

type VideoGenerateToolChanelMessage

type VideoGenerateToolChanelMessage struct {
	Status       string
	ErrorMessage string
	Result       *VideoResult
}

type VideoGenerateToolRequest

type VideoGenerateToolRequest struct {
	Params    []GenerateVideosRequest `json:"params"`
	BatchSize int                     `json:"batch_size,omitempty"`
}

type VideoResult

type VideoResult struct {
	VideoName string `json:"video_name"`
	Url       string `json:"video_url"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL