Documentation
¶
Index ¶
- Variables
- func ChunkToMessage[T messages.Response, M messages.ModelMessage](dst *messages.Message[M], src Chunk[T])
- func ResponseToMessage[T messages.Response, M messages.ModelMessage](dst *messages.Message[M], src Response[T])
- func ToDynamicJSON(val any) (map[string]any, error)
- type Chunk
- type CompletionParams
- type Delim
- type Error
- type KnownModel
- type Provider
- type Response
- type StreamEvent
- type ToolDefinition
Constants ¶
This section is empty.
Variables ¶
View Source
var ( GPT4o = KnownModel(openai.ChatModelChatgpt4oLatest) GPT4oMini = KnownModel(openai.ChatModelGPT4oMini) O1 = KnownModel(openai.ChatModelO1) O1Mini = KnownModel(openai.ChatModelO1Mini) )
Functions ¶
func ChunkToMessage ¶ added in v0.0.10
func ResponseToMessage ¶ added in v0.0.10
Types ¶
type Chunk ¶ added in v0.0.10
type Chunk[T messages.Response] struct { RunID uuid.UUID `json:"run_id"` TurnID uuid.UUID `json:"turn_id"` Chunk T `json:"chunk"` Timestamp strfmt.DateTime `json:"timestamp,omitempty"` Meta gjson.Result `json:"meta,omitempty"` }
func (Chunk[T]) MarshalJSON ¶ added in v0.0.10
MarshalJSON implements custom JSON marshaling for Chunk[T]
func (*Chunk[T]) UnmarshalJSON ¶ added in v0.0.10
UnmarshalJSON implements custom JSON unmarshaling for Chunk[T]
type CompletionParams ¶ added in v0.0.10
type CompletionParams struct { RunID uuid.UUID Instructions string Thread *runstate.Aggregator Stream bool ResponseSchema *jsonschema.Schema Model KnownModel Tools []ToolDefinition // contains filtered or unexported fields }
type Delim ¶ added in v0.0.10
type Delim struct { RunID uuid.UUID `json:"run_id"` TurnID uuid.UUID `json:"turn_id"` Delim string `json:"delim"` }
func (Delim) MarshalJSON ¶ added in v0.0.10
MarshalJSON implements custom JSON marshaling for Delim
func (*Delim) UnmarshalJSON ¶ added in v0.0.10
UnmarshalJSON implements custom JSON unmarshaling for Delim
type Error ¶ added in v0.0.10
type Error struct { RunID uuid.UUID `json:"run_id"` TurnID uuid.UUID `json:"turn_id"` Err error `json:"error"` Timestamp strfmt.DateTime `json:"timestamp,omitempty"` Meta gjson.Result `json:"meta,omitempty"` }
func (Error) MarshalJSON ¶ added in v0.0.10
MarshalJSON implements custom JSON marshaling for Error
func (*Error) UnmarshalJSON ¶ added in v0.0.10
UnmarshalJSON implements custom JSON unmarshaling for Error
type KnownModel ¶ added in v0.0.10
type KnownModel string
type Provider ¶
type Provider interface {
ChatCompletion(context.Context, CompletionParams) (<-chan StreamEvent, error)
}
type Response ¶ added in v0.0.10
type Response[T messages.Response] struct { RunID uuid.UUID `json:"run_id"` TurnID uuid.UUID `json:"turn_id"` Checkpoint runstate.Checkpoint `json:"checkpoint"` Response T `json:"response"` Timestamp strfmt.DateTime `json:"timestamp,omitempty"` Meta gjson.Result `json:"meta,omitempty"` }
func (Response[T]) MarshalJSON ¶ added in v0.0.10
MarshalJSON implements custom JSON marshaling for Response[T]
func (*Response[T]) UnmarshalJSON ¶ added in v0.0.10
UnmarshalJSON implements custom JSON unmarshaling for Response[T]
type StreamEvent ¶ added in v0.0.10
type StreamEvent interface {
// contains filtered or unexported methods
}
type ToolDefinition ¶ added in v0.0.10
type ToolDefinition struct { Name string Description string Parameters map[string]string Function any }
func (ToolDefinition) ToNameAndSchema ¶ added in v0.0.10
func (td ToolDefinition) ToNameAndSchema() (string, *jsonschema.Schema)
Click to show internal directories.
Click to hide internal directories.