llm

package
v0.0.0-...-de63469 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLlmAgent

func NewLlmAgent(client CompletionClient) *nlcall.Agent

Types

type ChoiceContent

type ChoiceContent struct {
	Content   string
	ToolCalls []*ToolCall
}

type CompletionClient

type CompletionClient interface {
	Complete(ctx context.Context, messages []*MessageContent) ([]*ChoiceContent, error)
}

type CompletionWithToolClient

type CompletionWithToolClient interface {
	CompletionClient
	CompleteWithTool(ctx context.Context, messages []*MessageContent, tools []*Tool) ([]*ChoiceContent, error)
}

type Definer

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

func NewDefiner

func NewDefiner(completionClient CompletionClient) *Definer

func (*Definer) Define

func (l *Definer) Define(ctx context.Context, fn any) (*function.Definition, error)

type MessageContent

type MessageContent struct {
	Role    string
	Content string
}

type Resolver

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

func NewResolver

func NewResolver(completionClient CompletionClient) *Resolver

func (*Resolver) AddFunc

func (r *Resolver) AddFunc(f *function.Function) bool

func (*Resolver) GetFuncDefs

func (r *Resolver) GetFuncDefs() []*function.Definition

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, userInput string) (call *function.Call, err error)

type Tool

type Tool = function.Definition

type ToolCall

type ToolCall struct {
	Name string
	Args string // should be a json string
}

Jump to

Keyboard shortcuts

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