tools

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Azure

type Azure struct {
	Operation string `` /* 158-byte string literal not displayed */
}

func NewAzure

func NewAzure() *Azure

func (*Azure) Connect

func (azure *Azure) Connect(ctx context.Context, conn io.ReadWriteCloser) error

func (*Azure) Description

func (azure *Azure) Description() string

func (*Azure) GenerateSchema

func (azure *Azure) GenerateSchema() interface{}

func (*Azure) Name

func (azure *Azure) Name() string

func (*Azure) Use

func (azure *Azure) Use(ctx context.Context, params map[string]any) string

type BrowseAction

type BrowseAction struct {
	Type    string      `json:"type"`
	Data    interface{} `json:"data"`
	Result  string      `json:"result"`
	Time    time.Time   `json:"time"`
	Success bool        `json:"success"`
}

type Browser

type Browser struct {
	Operation  string `json:"operation" jsonschema:"title=Operation,description=The operation to perform,enum=navigate,enum=script"`
	URL        string `json:"url" jsonschema:"title=URL,description=The URL to navigate to,required"`
	Javascript string `` /* 253-byte string literal not displayed */
	// contains filtered or unexported fields
}

func NewBrowser

func NewBrowser() *Browser

func (*Browser) Close

func (browser *Browser) Close() error

func (*Browser) Connect

func (browser *Browser) Connect(ctx context.Context, conn io.ReadWriteCloser) error

func (*Browser) Description

func (browser *Browser) Description() string

func (*Browser) ExecuteScript

func (browser *Browser) ExecuteScript(script string) string

ExecuteScript runs custom JavaScript and returns the result

func (*Browser) GenerateSchema

func (browser *Browser) GenerateSchema() interface{}

func (*Browser) Initialize

func (browser *Browser) Initialize() error

func (*Browser) Name

func (browser *Browser) Name() string

func (*Browser) Navigate

func (browser *Browser) Navigate(url string) error

Navigate goes to a URL and waits for the page to load

func (*Browser) Run

func (browser *Browser) Run(args map[string]any) (string, error)

Run implements the enhanced interface with all new capabilities

func (*Browser) SetProxy

func (browser *Browser) SetProxy(proxyURL string)

SetProxy configures a proxy for the browser

func (*Browser) StartSession

func (browser *Browser) StartSession() error

StartSession initializes a new browsing session with stealth mode

func (*Browser) Use

func (browser *Browser) Use(ctx context.Context, args map[string]any) string

type BrowserArgs

type BrowserArgs struct {
	URL        string `json:"url" jsonschema:"required,description=The URL to navigate to"`
	Selector   string `json:"selector" jsonschema:"description=CSS selector to find elements"`
	Timeout    int    `json:"timeout" jsonschema:"description=Timeout in seconds"`
	Screenshot bool   `json:"screenshot" jsonschema:"description=Whether to take a screenshot"`
}

type Container

type Container struct {
	Reasoning string `json:"reasoning" jsonschema:"title=Reasoning,description=Your reasoning for the next step."`
	Command   string `json:"command" jsonschema:"title=Command,description=The valid bash command to execute for the next step."`
	// contains filtered or unexported fields
}

func NewContainer

func NewContainer() *Container

func (*Container) Connect

func (c *Container) Connect(ctx context.Context, conn io.ReadWriteCloser) error

func (*Container) Description

func (c *Container) Description() string

func (*Container) GenerateSchema

func (c *Container) GenerateSchema() interface{}

func (*Container) Initialize

func (c *Container) Initialize() error

func (*Container) Name

func (c *Container) Name() string

func (*Container) Use

func (c *Container) Use(ctx context.Context, params map[string]any) string

Use the docker container to run the command. This allows the agent to use a fully featured, isolated Debian environment.

type Cookie struct {
	Name     string    `json:"name"`
	Value    string    `json:"value"`
	Domain   string    `json:"domain"`
	Path     string    `json:"path"`
	Expires  time.Time `json:"expires"`
	Secure   bool      `json:"secure"`
	HTTPOnly bool      `json:"http_only"`
}

type Github

type Github struct {
	Repo      string `json:"repository" jsonschema:"title=Repository,description=The repository to use,required"`
	Operation string `json:"operation" jsonschema:"title=Operation,description=The operation to perform,enum=clone,enum=pull,enum=push,required"`
}

func NewGithub

func NewGithub() *Github

func (*Github) Connect

func (github *Github) Connect(ctx context.Context, conn io.ReadWriteCloser) error

func (*Github) Description

func (g *Github) Description() string

func (*Github) GenerateSchema

func (g *Github) GenerateSchema() interface{}

func (*Github) Name

func (g *Github) Name() string

func (*Github) Use

func (github *Github) Use(ctx context.Context, params map[string]any) string

type Human

type Human struct {
	Message string `json:"message" jsonschema:"title=Message,description=The message to send to the human user,required"`
	// contains filtered or unexported fields
}

Human is a tool wrapper that has two distinct modes:

  1. It can be configured to call back to the human user to ask for intermediate input.
  2. It can be configured to act as a human user proxy, where an agent will perform the role of the human user.

func NewHuman

func NewHuman(mode HumanMode) *Human

func (*Human) Connect

func (human *Human) Connect(ctx context.Context, conn io.ReadWriteCloser) error

func (*Human) Description

func (human *Human) Description() string

func (*Human) GenerateSchema

func (human *Human) GenerateSchema() interface{}

func (*Human) Name

func (human *Human) Name() string

func (*Human) Use

func (human *Human) Use(ctx context.Context, params map[string]any) string

type HumanMode

type HumanMode uint
const (
	HumanUser HumanMode = iota
	HumanProxy
)

type Neo4j

type Neo4j struct {
	Operation string `json:"operation" jsonschema:"title=Operation,description=The operation to perform,enum=recall,enum=store,required"`
	Cypher    string `json:"cypher" jsonschema:"title=Cypher,description=The Cypher query to execute,required"`
	Reasoning string `json:"reasoning" jsonschema:"title=Reasoning,description=Explanation of why this relationship pattern is relevant"`
	// contains filtered or unexported fields
}

Neo4j is a wrapper around the Neo4j database that turns it into a tool, usable by the agent.

func NewNeo4j

func NewNeo4j() *Neo4j

NewNeo4j creates a new Neo4j client.

func (*Neo4j) Close

func (n *Neo4j) Close() error

Close closes the Neo4j client connection.

func (*Neo4j) Connect

func (n *Neo4j) Connect() error

func (*Neo4j) GenerateSchema

func (neo4j *Neo4j) GenerateSchema() string

GenerateSchema implements the Tool interface and renders the schema as a jsonschema string, which can be injected into the prompt. It is used to explain to the agent how to use the tool.

func (*Neo4j) Initialize

func (n *Neo4j) Initialize() error

Initialize initializes the Neo4j client.

func (*Neo4j) Query

func (n *Neo4j) Query(query string) (out []map[string]interface{}, err error)

Query executes a Cypher query on the Neo4j database and returns the results.

func (*Neo4j) Use

func (neo4j *Neo4j) Use(ctx context.Context, args map[string]any) string

Use implements the Tool interface and is used to execute the tool.

func (*Neo4j) Write

func (n *Neo4j) Write(query string) neo4j.ResultWithContext

Write executes a Cypher query on the Neo4j database and returns the results.

type Neo4jQuery

type Neo4jQuery struct {
	Cypher    string `json:"cypher" jsonschema:"title=Cypher Query,description=The Cypher query to execute,required"`
	Reasoning string `json:"reasoning" jsonschema:"title=Reasoning,description=Explanation of why this query pattern is relevant"`
	// contains filtered or unexported fields
}

Neo4jQuery is a tool wrapper for querying a Neo4j database.

func NewNeo4jQuery

func NewNeo4jQuery() *Neo4jQuery

func (*Neo4jQuery) Connect

func (n *Neo4jQuery) Connect(ctx context.Context, rw io.ReadWriteCloser) error

func (*Neo4jQuery) Description

func (n *Neo4jQuery) Description() string

func (*Neo4jQuery) GenerateSchema

func (n *Neo4jQuery) GenerateSchema() interface{}

func (*Neo4jQuery) Initialize

func (n *Neo4jQuery) Initialize() error

func (*Neo4jQuery) Name

func (n *Neo4jQuery) Name() string

func (*Neo4jQuery) Use

func (n *Neo4jQuery) Use(ctx context.Context, args map[string]any) string

type Neo4jStore

type Neo4jStore struct {
	Cypher    string `json:"cypher" jsonschema:"title=Cypher Query,description=The Cypher query to create or update relationships,required"`
	Reasoning string `json:"reasoning" jsonschema:"title=Reasoning,description=Explanation of why these relationships should be stored"`
	// contains filtered or unexported fields
}

func NewNeo4jStore

func NewNeo4jStore() *Neo4jStore

func (*Neo4jStore) Connect

func (n *Neo4jStore) Connect(ctx context.Context, rw io.ReadWriteCloser) error

func (*Neo4jStore) Description

func (n *Neo4jStore) Description() string

func (*Neo4jStore) GenerateSchema

func (n *Neo4jStore) GenerateSchema() interface{}

func (*Neo4jStore) Initialize

func (n *Neo4jStore) Initialize() error

func (*Neo4jStore) Name

func (n *Neo4jStore) Name() string

func (*Neo4jStore) Use

func (n *Neo4jStore) Use(ctx context.Context, args map[string]any) string

type NetworkRequest

type NetworkRequest struct {
	URL     string            `json:"url"`
	Method  string            `json:"method"`
	Headers map[string]string `json:"headers"`
	Body    string            `json:"body"`
}

type Qdrant

type Qdrant struct {
	Operation  string         `json:"operation" jsonschema:"title=Operation,description=The operation to perform,enum=add,enum=query,required"`
	SearchText string         `json:"query" jsonschema:"title=Query,description=The search text for query operation"`
	Documents  []string       `json:"documents" jsonschema:"title=Documents,description=The text content to add"`
	Metadata   map[string]any `json:"metadata" jsonschema:"title=Metadata,description=Additional context for stored documents"`
	Reasoning  string         `json:"reasoning" jsonschema:"title=Reasoning,description=Explanation of why this content is semantically relevant"`
	// contains filtered or unexported fields
}

Qdrant is a wrapper around the vector store that turns it into a tool, usable by the agent.

func NewQdrant

func NewQdrant(collection string, dimension uint64) *Qdrant

NewQdrant creates a new Qdrant tool.

func (*Qdrant) Add

func (q *Qdrant) Add(docs []string, metadata map[string]any) string

Add is a wrapper around the qdrant.Store.AddDocuments method.

func (*Qdrant) AddDocuments

func (q *Qdrant) AddDocuments(docs []schema.Document) error

AddDocuments is a wrapper around the qdrant.Store.AddDocuments method.

func (*Qdrant) Connect

func (q *Qdrant) Connect() error

Connect connects to the Qdrant client.

func (*Qdrant) GenerateSchema

func (qdrant *Qdrant) GenerateSchema() string

GenerateSchema implements the Tool interface and renders the schema as a jsonschema string, which can be injected into the prompt. It is used to explain to the agent how to use the tool.

func (*Qdrant) Initialize

func (q *Qdrant) Initialize() error

Initialize initializes the Qdrant client.

func (*Qdrant) Query

func (q *Qdrant) Query(query string) ([]map[string]interface{}, error)

Query is a wrapper around the qdrant.Store.SimilaritySearch method.

func (*Qdrant) SimilaritySearch

func (q *Qdrant) SimilaritySearch(query string, k int, opts ...vectorstores.Option) ([]schema.Document, error)

SimilaritySearch is a wrapper around the qdrant.Store.SimilaritySearch method.

func (*Qdrant) Use

func (qdrant *Qdrant) Use(ctx context.Context, args map[string]any) string

Use implements the Tool interface

type QdrantQuery

type QdrantQuery struct {
	Query     string `json:"query" jsonschema:"title=Query,description=The search text to find similar content,required"`
	Reasoning string `json:"reasoning" jsonschema:"title=Reasoning,description=Explanation of why this search is relevant"`
	// contains filtered or unexported fields
}

func NewQdrantQuery

func NewQdrantQuery(collection string, dimension uint64) *QdrantQuery

func (*QdrantQuery) Connect

func (q *QdrantQuery) Connect(ctx context.Context, rw io.ReadWriteCloser) error

func (*QdrantQuery) Description

func (q *QdrantQuery) Description() string

func (*QdrantQuery) GenerateSchema

func (q *QdrantQuery) GenerateSchema() interface{}

func (*QdrantQuery) Initialize

func (q *QdrantQuery) Initialize() error

func (*QdrantQuery) Name

func (q *QdrantQuery) Name() string

func (*QdrantQuery) Use

func (q *QdrantQuery) Use(ctx context.Context, args map[string]any) string

type QdrantResult

type QdrantResult struct {
	Metadata map[string]any `json:"metadata"`
	Content  string         `json:"content"`
}

Query is a wrapper around the qdrant.Store.SimilaritySearch method.

type QdrantStore

type QdrantStore struct {
	Documents []string       `json:"documents" jsonschema:"title=Documents,description=The text content to store,required"`
	Metadata  map[string]any `json:"metadata" jsonschema:"title=Metadata,description=Additional context for stored documents"`
	Reasoning string         `json:"reasoning" jsonschema:"title=Reasoning,description=Explanation of why this content should be stored"`
	// contains filtered or unexported fields
}

func NewQdrantStore

func NewQdrantStore(collection string, dimension uint64) *QdrantStore

func (*QdrantStore) Connect

func (q *QdrantStore) Connect(ctx context.Context, rw io.ReadWriteCloser) error

func (*QdrantStore) Description

func (q *QdrantStore) Description() string

func (*QdrantStore) GenerateSchema

func (q *QdrantStore) GenerateSchema() interface{}

func (*QdrantStore) Initialize

func (q *QdrantStore) Initialize() error

func (*QdrantStore) Name

func (q *QdrantStore) Name() string

func (*QdrantStore) Use

func (q *QdrantStore) Use(ctx context.Context, args map[string]any) string

type Slack

type Slack struct {
	Operation string `json:"operation" jsonschema:"title=Operation,description=The operation to perform,enum=send_message,enum=search,required"`
	Channel   string `json:"channel" jsonschema:"title=Channel,description=The channel to send the message to"`
	Message   string `json:"message" jsonschema:"title=Message,description=The message to send"`
}

Slack wraps the Slack API and turns it into a tool for agents to use. As a special case, this tool needs to also bring up a server to listen for incoming events.

func NewSlack

func NewSlack() *Slack

func (*Slack) Connect

func (slack *Slack) Connect(ctx context.Context, rw io.ReadWriteCloser) error

func (*Slack) Description

func (slack *Slack) Description() string

func (*Slack) GenerateSchema

func (slack *Slack) GenerateSchema() interface{}

func (*Slack) Name

func (slack *Slack) Name() string

func (*Slack) Use

func (slack *Slack) Use(ctx context.Context, params map[string]any) string

type Trengo

type Trengo struct {
	Operation string `` /* 135-byte string literal not displayed */
}

func NewTrengo

func NewTrengo() *Trengo

func (*Trengo) Connect

func (trengo *Trengo) Connect(ctx context.Context, rw io.ReadWriteCloser) error

func (*Trengo) Description

func (trengo *Trengo) Description() string

func (*Trengo) GenerateSchema

func (trengo *Trengo) GenerateSchema() interface{}

func (*Trengo) Name

func (trengo *Trengo) Name() string

func (*Trengo) Use

func (trengo *Trengo) Use(ctx context.Context, params map[string]any) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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