ai

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenerateImageTool

type GenerateImageTool struct {
	// contains filtered or unexported fields
}

GenerateImageTool creates images from text descriptions using the OpenAI DALL-E 3 API.

Agents use this to produce illustrations, diagrams, or visual assets as part of a report or creative pipeline. Images are saved to disk and the file path is returned so downstream agents can reference them.

API key: https://platform.openai.com Cost: ~$0.04 per standard image, ~$0.08 per HD image

agents.yaml:

tools:
  - name: "generate_image"
    api_key: "env:OPENAI_API_KEY"
    base_dir: "./outputs/images"   # optional: where to save images

func GenerateImage

func GenerateImage(apiKey, baseDir string) *GenerateImageTool

GenerateImage returns a ready-to-use GenerateImageTool. apiKey is the OpenAI API key. baseDir is where generated images are saved — defaults to "./outputs/images".

func (*GenerateImageTool) Execute

Execute generates an image and saves it to disk when the LLM requests it. This satisfies the tools.Tool interface.

func (*GenerateImageTool) Name

func (t *GenerateImageTool) Name() string

Name returns the tool identifier. This satisfies the tools.Tool interface.

func (*GenerateImageTool) Schema

func (t *GenerateImageTool) Schema() tools.Schema

Schema describes this tool to the LLM. This satisfies the tools.Tool interface.

type SummariseTool

type SummariseTool struct {
	// contains filtered or unexported fields
}

SummariseTool compresses long text into a concise summary using Claude Haiku.

Agents use this to shrink scraped content, long documents, or search results before passing them downstream — keeping token counts manageable across the crew.

Uses Claude Haiku (fast and cheap) rather than the main runtime model. The same ANTHROPIC_API_KEY used for the runtime works here.

agents.yaml:

tools:
  - name: "summarise"
    api_key: "env:ANTHROPIC_API_KEY"

func Summarise

func Summarise(apiKey string) *SummariseTool

Summarise returns a ready-to-use SummariseTool using the given Anthropic API key.

func (*SummariseTool) Execute

func (t *SummariseTool) Execute(ctx context.Context, input json.RawMessage) (json.RawMessage, error)

Execute summarises the given text when the LLM requests it. This satisfies the tools.Tool interface.

func (*SummariseTool) Name

func (t *SummariseTool) Name() string

Name returns the tool identifier. This satisfies the tools.Tool interface.

func (*SummariseTool) Schema

func (t *SummariseTool) Schema() tools.Schema

Schema describes this tool to the LLM. This satisfies the tools.Tool interface.

type TranslateTool

type TranslateTool struct {
	// contains filtered or unexported fields
}

TranslateTool translates text between languages using the DeepL API.

DeepL consistently produces higher quality output than LLM-based translation for European languages, especially for formal or technical content. Source language is detected automatically if not specified.

API key: https://www.deepl.com/pro-api Free tier: 500,000 characters/month Free API keys end with ":fx" and use a different endpoint automatically.

agents.yaml:

tools:
  - name: "translate"
    api_key: "env:DEEPL_API_KEY"

func Translate

func Translate(apiKey string) *TranslateTool

Translate returns a ready-to-use TranslateTool configured with the given DeepL API key. Keys ending in ":fx" automatically use the free API endpoint.

func (*TranslateTool) Execute

func (t *TranslateTool) Execute(ctx context.Context, input json.RawMessage) (json.RawMessage, error)

Execute translates the given text when the LLM requests it. This satisfies the tools.Tool interface.

func (*TranslateTool) Name

func (t *TranslateTool) Name() string

Name returns the tool identifier. This satisfies the tools.Tool interface.

func (*TranslateTool) Schema

func (t *TranslateTool) Schema() tools.Schema

Schema describes this tool to the LLM. This satisfies the tools.Tool interface.

Jump to

Keyboard shortcuts

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