Documentation
¶
Index ¶
- Variables
- func COT() *predictor
- func FunCall(opts ...option) *predictor
- func NewPredictor(opts ...option) *predictor
- func Predictor(opts ...option) *predictor
- func ReAct(opts ...option) *react
- func SetLLM(provider, model string)
- func WithLLM(provider string, model string, opts ...llm.Option) option
- func WithLLMInstance(model *llm.Instance) option
- type Action
- type Adapter
- type DefaultAdapter
- type Field
- type InputAdapter
- type Invoker
- type JSONAdapter
- type MarkableAdapter
- type MarkableInputAdapter
- type MarkableOutputAdapter
- type OutputAdapter
- type Program
- type ProgramFunc
- type Promptx
- type RawAdapter
- type RawInputAdapter
- type RawOutputAdapter
- type ReactResult
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var MaxIterationNum = 20
View Source
var ReactPrompt = `` /* 2740-byte string literal not displayed */
Functions ¶
func NewPredictor ¶
func NewPredictor(opts ...option) *predictor
func WithLLMInstance ¶ added in v0.0.8
Types ¶
type DefaultAdapter ¶ added in v0.0.7
type DefaultAdapter struct {
RawInputAdapter
MarkableOutputAdapter
}
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 InputAdapter ¶ added in v0.0.7
type JSONAdapter ¶
type JSONAdapter struct {
// contains filtered or unexported fields
}
JSONAdapter ...
type MarkableAdapter ¶
type MarkableAdapter struct {
MarkableInputAdapter
MarkableOutputAdapter
}
type MarkableInputAdapter ¶ added in v0.0.7
type MarkableInputAdapter struct {
}
MarkableInputAdapter ...
type MarkableOutputAdapter ¶ added in v0.0.7
type MarkableOutputAdapter struct {
}
type OutputAdapter ¶ added in v0.0.7
type Program ¶
type Program interface {
Prompt() *Promptx
Update(...option)
Forward(context.Context, map[string]any) (any, error)
}
Program defines the interface for a program Program 定义了一个可运行的程序,不会保存状态,随用随 new
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 RawInputAdapter ¶ added in v0.0.7
type RawInputAdapter struct {
}
type RawOutputAdapter ¶ added in v0.0.7
type RawOutputAdapter struct {
}
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 Response ¶ added in v0.0.8
type Response struct {
HasToolCalls bool
// contains filtered or unexported fields
}
func NewResponse ¶ added in v0.0.8
func NewResponse() *Response
func (*Response) Completion ¶ added in v0.0.8
Click to show internal directories.
Click to hide internal directories.