Documentation
¶
Index ¶
- Variables
- func COT() *predictor
- func FunCall(opts ...option) *funcall
- func NewPredictor(i string, inputs map[string]string, opts ...option) *predictor
- func NewPredictorWithPrompt(prompt *Promptx, opts ...option) *predictor
- func Predictor(opts ...option) *predictor
- func ReAct(opts ...option) *react
- func SetLLM(provider, model string)
- func WithInstruction(info string) option
- func WithLLM(provider string, model string) option
- func WithOutput(tuple ...any) option
- type Adapter
- type Extra
- type Field
- type JSONAdapter
- type MarkableAdapter
- type Memory
- type Program
- type ProgramFunc
- type Promptx
- type RawAdapter
- type ReactResult
- type Result
Constants ¶
This section is empty.
Variables ¶
View Source
var FunCallPrompt = `` /* 414-byte string literal not displayed */
View Source
var MaxIterationNum = 50
View Source
var ReactPrompt = `` /* 2740-byte string literal not displayed */
Functions ¶
func NewPredictor ¶
NewPredictor ...
func NewPredictorWithPrompt ¶
func NewPredictorWithPrompt(prompt *Promptx, opts ...option) *predictor
NewPredictorWithPrompt ...
Types ¶
type Adapter ¶
type Adapter interface {
Format(p *predictor, inputs map[string]any, target any) ([]llm.Message, error)
Parse(string, any) error
}
Adapter ...
type Field ¶
type Field struct {
Name string
Type reflect.Kind
Description string
Marker string
Kind string // input or output
}
Field represents an input or output field in a signature
type JSONAdapter ¶
type JSONAdapter struct {
// contains filtered or unexported fields
}
JSONAdapter ...
type MarkableAdapter ¶
type MarkableAdapter struct {
}
MarkableAdapter ...
type Memory ¶
type Memory interface {
FetchMemories(context.Context, int64) ([]llm.Message, error)
SaveMemory(context.Context, int64, string, *Extra) error
}
Memory ...
type Program ¶
type Program interface {
Prompt() *Promptx
Update(...option)
Forward(context.Context, map[string]any) (any, error)
}
Program defines the interface for a program
type ProgramFunc ¶
ProgramFunc is a function that implements the Program interface
type Promptx ¶
type Promptx struct {
Name string
Description string
Instruction string
InputFields map[string]*Field
OutputFields map[string]*Field
}
Promptx defines the instruction and input/output about a program
func (*Promptx) ValidateInputs ¶
ValidateInputs checks if the provided inputs match the signature
type RawAdapter ¶
type RawAdapter struct {
// contains filtered or unexported fields
}
RawAdapter ...
type ReactResult ¶
type ReactResult struct {
Tool *struct {
Name string `json:"name"`
Args map[string]any `json:"args"`
}
Thoughts *struct {
SelfReason string `json:"self_reason"`
Text string `json:"text"`
Reason string `json:"reasoning"`
Plan any `json:"plan"`
Critism string `json:"criticism"`
Speak string `json:"speak"`
} `json:"thoughts"`
}
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
func (*Result) Completion ¶
Click to show internal directories.
Click to hide internal directories.