Documentation
¶
Overview ¶
Pachage model include Base IO Schema etc.
Index ¶
- func GetTenantAndChatID(ctx context.Context) (string, string, error)
- func NewChatID() string
- func Stringify(s any) string
- func ToBytes(s any) []byte
- func WithChatContext(ctx context.Context, chatCtx ChatContext) context.Context
- type BaseClarificationResult
- type ChatContext
- type ContentProvider
- type FewShotExample
- type FewShotExamples
- type Input
- type Output
- type OutputParser
- type String
- type Stringer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTenantAndChatID ¶ added in v0.1.7
GetTenantAndChatID retrieves the tenant and chat ID from the provided context. If the context does not contain a ChatContext, it returns error.
func NewChatID ¶
func NewChatID() string
NewChatID generates a new chat ID using the flake ID generator.
func WithChatContext ¶
func WithChatContext(ctx context.Context, chatCtx ChatContext) context.Context
WithChatContext returns a new context with ChatContext value
Types ¶
type BaseClarificationResult ¶
type ChatContext ¶
type ChatContext interface {
// GetTenantID retrieves the tenant ID from the context
GetTenantID() string
// GetChatID retrieves the chat ID from the context
GetChatID() string
// AppData returns immutable app data
AppData() any
// GetMetadata retrieves metadata by key
GetMetadata(key string) (value any, ok bool)
// SetMetadata sets metadata by key
SetMetadata(key string, value any)
}
ChatContext is the context for the chat agent,
func GetChatContext ¶
func GetChatContext(ctx context.Context) ChatContext
GetChatContext retrieves the ChatContext from the context
func NewChatContext ¶
func NewChatContext(tenantID, chatID string, appData any) ChatContext
type ContentProvider ¶
type ContentProvider interface {
// GetContent gets the content of the message for the chat history
GetContent() string
}
type FewShotExample ¶
type FewShotExamples ¶
type FewShotExamples []FewShotExample
type Input ¶
type Input struct {
// Content is the chat message sent by the user to the assistant.
Content string `` /* 126-byte string literal not displayed */
}
Input represents the input from the user to the AI agent.
type Output ¶
type Output struct {
// contains the markdown-enabled response generated by the chat agent.
Content string `` /* 141-byte string literal not displayed */
}
Output represents the response generated by the chat agent.
func (Output) GetContent ¶
GetContent gets the content of the message for the chat history
type OutputParser ¶
type OutputParser[T any] interface { // Parse parses the output of an LLM call. Parse(text string) (*T, error) // GetFormatInstructions returns a string describing the format of the output. GetFormatInstructions() string // Type returns the string type key uniquely identifying this class of parser Type() string }
OutputParser is an interface for parsing the output of an LLM call.
type String ¶ added in v0.2.10
type String struct {
// contains filtered or unexported fields
}
String is a simple string type that implements the ContentProvider interface.
func (String) GetContent ¶ added in v0.2.10
GetContent gets the content of the message for the chat history