Documentation
¶
Index ¶
- Constants
- Variables
- type Bash
- type Cat
- type CommandExecutor
- type Curl
- type CurlConfig
- type DBConnection
- type Docker
- type EmailMessage
- type FileSystem
- type FileSystemConfig
- type Git
- type GitConfig
- type GitHub
- type GitHubConfig
- type Gmail
- type GmailConfig
- type Grep
- type MockLogger
- func (m *MockLogger) Debug(args ...interface{})
- func (m *MockLogger) Debugf(format string, args ...interface{})
- func (m *MockLogger) Error(args ...interface{})
- func (m *MockLogger) Errorf(format string, args ...interface{})
- func (m *MockLogger) Fatal(args ...interface{})
- func (m *MockLogger) Fatalf(format string, args ...interface{})
- func (m *MockLogger) Info(args ...interface{})
- func (m *MockLogger) Infof(format string, args ...interface{})
- func (m *MockLogger) Panic(args ...interface{})
- func (m *MockLogger) Panicf(format string, args ...interface{})
- func (m *MockLogger) Warn(args ...interface{})
- func (m *MockLogger) Warnf(format string, args ...interface{})
- func (m *MockLogger) WithContext(ctx context.Context) goai.Logger
- func (m *MockLogger) WithErr(err error) goai.Logger
- func (m *MockLogger) WithFields(fields map[string]interface{}) goai.Logger
- type PostgreSQL
- type PostgreSQLConfig
- type RealCommandExecutor
- type Sed
Constants ¶
const ( GitHubIssuesToolName = "github_issues" GitHubPullRequestsToolName = "github_pull_requests" GitHubRepositoryToolName = "github_repository" GitHubSearchToolName = "github_search" )
const BashToolName = "bash"
const CatToolName = "cat"
const CurlToolName = "curl"
const DockerToolName = "docker"
const FileSystemToolName = "filesystem"
const GitToolName = "git"
const (
GmailToolName = "gmail"
)
const GrepToolName = "grep"
const PostgreSQLToolName = "postgresql"
PostgreSQLToolName is the name of the PostgreSQL tool
const SedToolName = "sed"
Variables ¶
var GetWeather = goai.Tool{ Name: "get_weather", Description: "Get the current weather for a given location.", InputSchema: json.RawMessage(`{ "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA" } }, "required": ["location"] }`), Handler: func(ctx context.Context, params goai.CallToolParams) (goai.CallToolResult, error) { _, span := goai.StartSpan(ctx, fmt.Sprintf("%s.Handler", params.Name)) span.SetAttributes( attribute.String("tool_name", params.Name), attribute.String("tool_argument", string(params.Arguments)), ) defer span.End() var err error defer func() { if err != nil { span.RecordError(err) } }() var input struct { Location string `json:"location"` } if err := json.Unmarshal(params.Arguments, &input); err != nil { return goai.CallToolResult{}, err } return goai.CallToolResult{ Content: []goai.ToolResultContent{ { Type: "text", Text: fmt.Sprintf("Weather in %s: Sunny, 72°F", input.Location), }, }, }, nil }, }
GetWeather is a tool that provides the current weather for a specified location. The tool expects an input schema that includes a "location" field, which specifies the city and state (e.g., "San Francisco, CA"). It returns the weather information as text content.
Functions ¶
This section is empty.
Types ¶
type Bash ¶ added in v0.0.5
type Bash struct {
// contains filtered or unexported fields
}
Bash represents a wrapper around the system's bash command-line tool
func (*Bash) BashAllInOneTool ¶ added in v0.0.5
BashAllInOneTool returns a goai.Tool that can execute bash commands
type Cat ¶ added in v0.0.5
type Cat struct {
// contains filtered or unexported fields
}
Cat represents a wrapper around the system's cat command-line tool
func (*Cat) CatAllInOneTool ¶ added in v0.0.5
CatAllInOneTool returns a goai.Tool that can execute cat commands
type CommandExecutor ¶
type CommandExecutor interface {
ExecuteCommand(ctx context.Context, cmd *exec.Cmd) ([]byte, error)
}
CommandExecutor interface for executing commands
type Curl ¶
type Curl struct {
// contains filtered or unexported fields
}
Curl represents a wrapper around the system's curl command-line tool, providing a programmatic interface for making HTTP requests.
func NewCurl ¶
func NewCurl(logger goai.Logger, config CurlConfig) *Curl
NewCurl creates and returns a new instance of the Curl wrapper with the provided configuration.
func (*Curl) CurlAllInOneTool ¶
CurlAllInOneTool returns a goai.Tool that can perform various HTTP requests
type CurlConfig ¶
type CurlConfig struct {
BlockedMethods []string
}
CurlConfig holds the configuration for the Curl tool
type DBConnection ¶
type DBConnection struct {
Host string
Port string
User string
Password string
DBName string
SSLMode string
}
DBConnection represents a PostgreSQL database connection configuration
type Docker ¶
type Docker struct {
// contains filtered or unexported fields
}
Docker represents a wrapper around the system's docker command-line tool
func (*Docker) DockerAllInOneTool ¶
DockerAllInOneTool returns a goai.Tool that can execute Docker commands
type EmailMessage ¶ added in v0.0.3
type FileSystem ¶
type FileSystem struct {
// contains filtered or unexported fields
}
FileSystem represents a wrapper around filesystem operations
func NewFileSystem ¶
func NewFileSystem(logger goai.Logger, config FileSystemConfig) *FileSystem
NewFileSystem creates a new instance of FileSystem
func (*FileSystem) FileSystemAllInOneTool ¶
func (fs *FileSystem) FileSystemAllInOneTool() goai.Tool
FileSystemAllInOneTool returns a Tool that performs filesystem operations
type FileSystemConfig ¶
type FileSystemConfig struct {
AllowedDirectory string // Base directory for all operations
BlockedPatterns []string // Patterns to block (e.g., "*.exe", "*.dll")
}
FileSystemConfig holds the configuration for the FileSystem tool
type Git ¶
type Git struct {
// contains filtered or unexported fields
}
Git represents a wrapper around the system's git command-line tool, providing a programmatic interface for executing git commands.
func NewGit ¶
NewGit creates and returns a new instance of the Git wrapper with the provided configuration.
func (*Git) GitAllInOneTool ¶
GitAllInOneTool returns a goai.Tool that can perform various Git operations
type GitConfig ¶
type GitConfig struct {
// Add any configuration options here
// For example, you might want to add:
DefaultRepoPath string
BlockedCommands []string
}
GitConfig holds the configuration for the Git tool
type GitHub ¶
type GitHub struct {
// contains filtered or unexported fields
}
GitHub represents a wrapper around GitHub API client
func NewGitHubTool ¶
func NewGitHubTool(logger goai.Logger, config GitHubConfig) *GitHub
NewGitHubTool to perform operations on GitHub
func (*GitHub) GetIssuesTool ¶
GetIssuesTool returns a tool for managing GitHub issues
func (*GitHub) GetPullRequestsTool ¶
GetPullRequestsTool returns a tool for managing GitHub pull requests
func (*GitHub) GetRepositoryTool ¶
GetRepositoryTool returns a tool for managing GitHub repositories
func (*GitHub) GetSearchTool ¶
GetSearchTool returns a tool for GitHub search operations
type GitHubConfig ¶
type GitHubConfig struct {
Token string
}
type Gmail ¶ added in v0.0.3
type Gmail struct {
// contains filtered or unexported fields
}
Gmail represents a wrapper around the Gmail API service, providing a programmatic interface for executing Gmail operations.
func NewGmail ¶ added in v0.0.3
func NewGmail(logger goai.Logger, service *gmail.Service, config GmailConfig) *Gmail
NewGmail creates and returns a new instance of the Gmail wrapper with the provided configuration.
func (*Gmail) GmailAllInOneTool ¶ added in v0.0.3
GmailAllInOneTool returns a goai.Tool that can perform various Gmail operations
type GmailConfig ¶ added in v0.0.3
GmailConfig holds the configuration for the Gmail tool
type Grep ¶ added in v0.0.5
type Grep struct {
// contains filtered or unexported fields
}
Grep represents a wrapper around the system's grep command-line tool
func (*Grep) GrepAllInOneTool ¶ added in v0.0.5
GrepAllInOneTool returns a goai.Tool that can execute grep commands
type MockLogger ¶
MockLogger is a mock implementation of goai.Logger
func (*MockLogger) Debug ¶
func (m *MockLogger) Debug(args ...interface{})
Debug logs a debug message.
func (*MockLogger) Debugf ¶
func (m *MockLogger) Debugf(format string, args ...interface{})
Debugf logs a formatted debug message.
func (*MockLogger) Error ¶
func (m *MockLogger) Error(args ...interface{})
Error logs an error message.
func (*MockLogger) Errorf ¶
func (m *MockLogger) Errorf(format string, args ...interface{})
Errorf logs a formatted error message.
func (*MockLogger) Fatal ¶
func (m *MockLogger) Fatal(args ...interface{})
Fatal logs a fatal message.
func (*MockLogger) Fatalf ¶
func (m *MockLogger) Fatalf(format string, args ...interface{})
Fatalf logs a formatted fatal message.
func (*MockLogger) Infof ¶
func (m *MockLogger) Infof(format string, args ...interface{})
Infof logs a formatted info message.
func (*MockLogger) Panic ¶
func (m *MockLogger) Panic(args ...interface{})
Panic logs a panic message.
func (*MockLogger) Panicf ¶
func (m *MockLogger) Panicf(format string, args ...interface{})
Panicf logs a formatted panic message.
func (*MockLogger) Warn ¶
func (m *MockLogger) Warn(args ...interface{})
Warn logs a warning message.
func (*MockLogger) Warnf ¶
func (m *MockLogger) Warnf(format string, args ...interface{})
Warnf logs a formatted warning message.
func (*MockLogger) WithContext ¶
func (m *MockLogger) WithContext(ctx context.Context) goai.Logger
WithContext adds a context to the logger and returns a new logger instance.
func (*MockLogger) WithErr ¶
func (m *MockLogger) WithErr(err error) goai.Logger
WithErr adds an error to the logger and returns a new logger instance.
func (*MockLogger) WithFields ¶
func (m *MockLogger) WithFields(fields map[string]interface{}) goai.Logger
WithFields adds fields to the logger and returns a new logger instance.
type PostgreSQL ¶
type PostgreSQL struct {
// contains filtered or unexported fields
}
PostgreSQL represents a tool for performing PostgreSQL operations
func NewPostgreSQL ¶
func NewPostgreSQL(logger goai.Logger, config PostgreSQLConfig) *PostgreSQL
NewPostgreSQL creates a new PostgreSQL tool with the given logger and configuration
func (*PostgreSQL) PostgreSQLAllInOneTool ¶
func (p *PostgreSQL) PostgreSQLAllInOneTool() goai.Tool
PostgreSQLAllInOneTool remains mostly the same, but uses getConnection instead
type PostgreSQLConfig ¶
PostgreSQLConfig represents the configuration for the PostgreSQL tool
type RealCommandExecutor ¶
type RealCommandExecutor struct{}
RealCommandExecutor implements CommandExecutor for real command execution
func (*RealCommandExecutor) ExecuteCommand ¶
type Sed ¶ added in v0.0.5
type Sed struct {
// contains filtered or unexported fields
}
Sed represents a wrapper around the system's sed command-line tool
func (*Sed) SedAllInOneTool ¶ added in v0.0.5
SedAllInOneTool returns a goai.Tool that can execute sed commands