toolhouse

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 9 Imported by: 0

README

Toolhouse

This is an extension for pegwings-go that allows you to use the Toolhouse API to give tools to your ai models.

toolhouse

import "github.com/pegwings/pegwings-go/extensions/toolhouse"

Package toolhouse provides a Toolhouse extension for groq-go.

It allows you to use the Toolhouse API to give tools to your ai models.

Package toolhouse provides a Toolhouse extension for groq-go.

Index

type Extension

Extension is a Toolhouse extension.

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

func NewExtension
func NewExtension(apiKey string, opts ...Options) (e *Extension, err error)

NewExtension creates a new Toolhouse extension.

func (*Extension) GetTools
func (e *Extension) GetTools(ctx context.Context) ([]pegwings.Tool, error)

GetTools returns a list of tools that the extension can use.

func (*Extension) MustGetTools
func (e *Extension) MustGetTools(ctx context.Context) []pegwings.Tool

MustGetTools returns a list of tools that the extension can use.

It panics if an error occurs.

func (*Extension) MustRun
func (e *Extension) MustRun(ctx context.Context, response pegwings.ChatCompletionResponse) []pegwings.ChatCompletionMessage

MustRun runs the extension on the given history.

It panics if an error occurs.

func (*Extension) Run
func (e *Extension) Run(ctx context.Context, response pegwings.ChatCompletionResponse) ([]pegwings.ChatCompletionMessage, error)

Run runs the extension on the given history.

type Options

Options is a function that sets options for a Toolhouse extension.

type Options func(*Extension)

func WithBaseURL
func WithBaseURL(baseURL string) Options

WithBaseURL sets the base URL for the Toolhouse extension.

func WithClient
func WithClient(client *http.Client) Options

WithClient sets the client for the Toolhouse extension.

func WithLogger
func WithLogger(logger *slog.Logger) Options

WithLogger sets the logger for the Toolhouse extension.

func WithMetadata
func WithMetadata(metadata map[string]any) Options

WithMetadata sets the metadata for the get tools request.

Generated by gomarkdoc

Documentation

Overview

Package toolhouse provides a Toolhouse extension for pegwings-go.

It allows you to use the Toolhouse API to give tools to your ai models.

Package toolhouse provides a Toolhouse extension for pegwings-go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options func(*Toolhouse)

Options is a function that sets options for a Toolhouse extension.

func WithBaseURL

func WithBaseURL(baseURL string) Options

WithBaseURL sets the base URL for the Toolhouse extension.

func WithClient

func WithClient(client *http.Client) Options

WithClient sets the client for the Toolhouse extension.

func WithLogger

func WithLogger(logger *slog.Logger) Options

WithLogger sets the logger for the Toolhouse extension.

func WithMetadata

func WithMetadata(metadata map[string]any) Options

WithMetadata sets the metadata for the get tools request.

type Toolhouse

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

Toolhouse is a Toolhouse extension.

func NewExtension

func NewExtension(apiKey string, opts ...Options) (e *Toolhouse, err error)

NewExtension creates a new Toolhouse extension.

func (*Toolhouse) GetTools

func (e *Toolhouse) GetTools(
	ctx context.Context,
) ([]tools.Tool, error)

GetTools returns a list of tools that the extension can use.

func (*Toolhouse) Run

Run runs the extension on the given history.

Jump to

Keyboard shortcuts

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