Documentation
¶
Index ¶
- func Decode(holder *cffi.CFFIValueHolder) any
- func DecodeList[T any](valueHolder *cffi.CFFIValueHolder, decodeFunc func(*cffi.CFFIValueHolder) T) []T
- func DecodeMap[T any](valueHolder cffi.CFFIValueHolder, ...) map[string]T
- func DecodeOptional[T any](valueHolder *cffi.CFFIValueHolder, decodeFunc func(*cffi.CFFIValueHolder) T) *T
- func Encode(builder *flatbuffers.Builder, value any) (flatbuffers.UOffsetT, error)
- func EncodeClass(builder *flatbuffers.Builder, name string, fields map[string]any, ...) (valueType cffi.CFFIValueUnion, offset flatbuffers.UOffsetT, err error)
- func EncodeEnum(builder *flatbuffers.Builder, name string, value string, isDynamic bool) (cffi.CFFIValueUnion, flatbuffers.UOffsetT, error)
- func EncodeRoot(value any) ([]byte, error)
- func EncodeUnion(builder *flatbuffers.Builder, name string, variantName string, value any) (cffi.CFFIValueUnion, flatbuffers.UOffsetT, error)
- func InvokeRuntimeCli(args []string) int
- func SetTypeMap(t TypeMap)
- type BamlClassDeserializer
- type BamlClientError
- type BamlClientHttpError
- type BamlDecoder
- type BamlEnumDeserializer
- type BamlError
- type BamlFunctionArguments
- type BamlRuntime
- type BamlSerializer
- type BamlUnionDeserializer
- type CallbackData
- type Check
- type Checked
- type ClientRegistry
- type ClientRegistryMap
- type DynamicClass
- type DynamicEnum
- type ResultCallback
- type StreamResult
- type StreamState
- type StreamStateType
- type TypeMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
func Decode(holder *cffi.CFFIValueHolder) any
func DecodeList ¶
func DecodeList[T any](valueHolder *cffi.CFFIValueHolder, decodeFunc func(*cffi.CFFIValueHolder) T) []T
func DecodeMap ¶
func DecodeMap[T any](valueHolder cffi.CFFIValueHolder, decodeFunc func(*cffi.CFFIValueHolder, TypeMap) T) map[string]T
func DecodeOptional ¶
func DecodeOptional[T any](valueHolder *cffi.CFFIValueHolder, decodeFunc func(*cffi.CFFIValueHolder) T) *T
func Encode ¶
func Encode(builder *flatbuffers.Builder, value any) (flatbuffers.UOffsetT, error)
Encode now accepts and passes TypeMap. Encode takes a builder and a Go value, encodes the value, wraps it in a CFFIValueHolder, and returns the offset of the holder.
func EncodeClass ¶
func EncodeClass(builder *flatbuffers.Builder, name string, fields map[string]any, dynamicFields *map[string]any) (valueType cffi.CFFIValueUnion, offset flatbuffers.UOffsetT, err error)
implment BamlSerializer for anything that implements BamlClassSerializer, BamlEnumSerializer, or BamlUnionSerializer
func EncodeEnum ¶
func EncodeEnum(builder *flatbuffers.Builder, name string, value string, isDynamic bool) (cffi.CFFIValueUnion, flatbuffers.UOffsetT, error)
func EncodeRoot ¶
EncodeRoot now accepts a TypeMap. Encode takes a Go value and returns the FlatBuffers encoded bytes for a CFFIValueHolder. It creates a new builder internally.
func EncodeUnion ¶
func EncodeUnion(builder *flatbuffers.Builder, name string, variantName string, value any) (cffi.CFFIValueUnion, flatbuffers.UOffsetT, error)
func InvokeRuntimeCli ¶
func SetTypeMap ¶
func SetTypeMap(t TypeMap)
Types ¶
type BamlClassDeserializer ¶
type BamlClassDeserializer interface {
Decode(holder cffi.CFFIValueClass)
}
type BamlClientError ¶
type BamlClientError struct {
BamlError
}
type BamlClientHttpError ¶
type BamlClientHttpError struct {
BamlClientError
}
type BamlDecoder ¶
type BamlEnumDeserializer ¶
type BamlEnumDeserializer interface {
Decode(holder cffi.CFFIValueEnum)
}
type BamlFunctionArguments ¶ added in v0.86.1
type BamlFunctionArguments struct {
Kwargs map[string]any
ClientRegistry *ClientRegistry
}
type BamlRuntime ¶
type BamlRuntime struct {
// contains filtered or unexported fields
}
func CreateRuntime ¶
func (*BamlRuntime) CallFunction ¶
func (r *BamlRuntime) CallFunction(ctx context.Context, functionName string, encoded_args []byte) (*ResultCallback, error)
func (*BamlRuntime) CallFunctionStream ¶
func (r *BamlRuntime) CallFunctionStream(ctx context.Context, functionName string, encoded_args []byte) (<-chan ResultCallback, error)
type BamlSerializer ¶
type BamlSerializer interface {
Encode(builder *flatbuffers.Builder) (cffi.CFFIValueUnion, flatbuffers.UOffsetT, error)
BamlTypeName() string
}
BamlSerializer interface for custom class encoding
type BamlUnionDeserializer ¶
type BamlUnionDeserializer interface {
Decode(holder *cffi.CFFIValueUnionVariant)
}
type CallbackData ¶
type CallbackData struct {
// contains filtered or unexported fields
}
type Check ¶
type Check struct {
Name string `json:"name"`
Expression string `json:"expression"`
Status string `json:"status"`
}
Check corresponds to the Python Check model.
type Checked ¶
Checked is a generic struct that contains a value of any type T and a map of checks, where the key type CN has an underlying type string.
type ClientRegistry ¶ added in v0.89.0
type ClientRegistry struct {
// contains filtered or unexported fields
}
func NewClientRegistry ¶ added in v0.89.0
func NewClientRegistry() *ClientRegistry
func (*ClientRegistry) AddLlmClient ¶ added in v0.89.0
func (c *ClientRegistry) AddLlmClient(name string, provider string, options map[string]any)
func (*ClientRegistry) SetPrimaryClient ¶ added in v0.89.0
func (c *ClientRegistry) SetPrimaryClient(name string)
type ClientRegistryMap ¶ added in v0.89.0
type ClientRegistryMap map[string]clientProperty
type DynamicClass ¶
func (*DynamicClass) Decode ¶
func (d *DynamicClass) Decode(holder cffi.CFFIValueClass)
type DynamicEnum ¶
func (*DynamicEnum) Decode ¶
func (d *DynamicEnum) Decode(holder cffi.CFFIValueEnum)
type ResultCallback ¶
type StreamResult ¶
func (*StreamResult[Partial, Final]) Error ¶
func (result *StreamResult[Partial, Final]) Error() error
func (*StreamResult[Partial, Final]) Final ¶
func (result *StreamResult[Partial, Final]) Final() Final
func (*StreamResult[Partial, Final]) IsFinal ¶
func (result *StreamResult[Partial, Final]) IsFinal() bool
func (*StreamResult[Partial, Final]) IsPartial ¶
func (result *StreamResult[Partial, Final]) IsPartial() bool
func (*StreamResult[Partial, Final]) Partial ¶
func (result *StreamResult[Partial, Final]) Partial() Partial
type StreamState ¶
type StreamState[T any] struct { Value T `json:"value"` State StreamStateType `json:"state"` }
type StreamStateType ¶
type StreamStateType string
const ( StreamStatePending StreamStateType = "Pending" StreamStateIncomplete StreamStateType = "Incomplete" StreamStateComplete StreamStateType = "Complete" )
func (StreamStateType) IsValid ¶
func (e StreamStateType) IsValid() bool
IsValid checks whether the given AliasedEnum value is valid.
func (StreamStateType) MarshalJSON ¶
func (e StreamStateType) MarshalJSON() ([]byte, error)
MarshalJSON customizes JSON marshaling for AliasedEnum.
func (*StreamStateType) UnmarshalJSON ¶
func (e *StreamStateType) UnmarshalJSON(data []byte) error
UnmarshalJSON customizes JSON unmarshaling for AliasedEnum.
func (StreamStateType) Values ¶
func (StreamStateType) Values() []StreamStateType
Values returns all allowed values for the AliasedEnum type.