Documentation ¶
Index ¶
- type CompletionInput
- type CompletionOutput
- type Engine
- func (e *Engine) CreateCompletion(ctx context.Context, messages []llms.ChatMessage) (*CompletionOutput, error)
- func (e *Engine) CreateStreamCompletion(ctx context.Context, messages []llms.ChatMessage) (*StreamCompletionOutput, error)
- func (e *Engine) GetChannel() chan StreamCompletionOutput
- func (e *Engine) GetConvoStore() convo.Store
- func (e *Engine) GetMode() EngineMode
- func (e *Engine) Interrupt()
- func (e *Engine) SetMode(m EngineMode)
- type EngineMode
- type EngineOption
- type LogHandler
- func (l LogHandler) HandleChainEnd(_ context.Context, outputs map[string]any)
- func (l LogHandler) HandleChainError(_ context.Context, err error)
- func (l LogHandler) HandleChainStart(_ context.Context, inputs map[string]any)
- func (l LogHandler) HandleLLMError(_ context.Context, err error)
- func (l LogHandler) HandleLLMGenerateContentEnd(_ context.Context, res *llms.ContentResponse)
- func (l LogHandler) HandleLLMGenerateContentStart(_ context.Context, ms []llms.MessageContent)
- func (l LogHandler) HandleLLMStart(_ context.Context, prompts []string)
- func (l LogHandler) HandleStreamingFunc(_ context.Context, chunk []byte)
- func (l LogHandler) HandleText(_ context.Context, text string)
- func (l LogHandler) HandleToolEnd(_ context.Context, output string)
- func (l LogHandler) HandleToolError(_ context.Context, err error)
- func (l LogHandler) HandleToolStart(_ context.Context, input string)
- type StreamCompletionOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompletionInput ¶
type CompletionInput struct {
Messages []llms.ChatMessage
}
CompletionInput is a tea.Msg that wraps the content read from stdin.
type CompletionOutput ¶
type CompletionOutput struct { Command string `json:"cmd"` Explanation string `json:"exp"` Executable bool `json:"exec"` }
func (CompletionOutput) GetCommand ¶
func (c CompletionOutput) GetCommand() string
func (CompletionOutput) GetExplanation ¶
func (c CompletionOutput) GetExplanation() string
func (CompletionOutput) IsExecutable ¶
func (c CompletionOutput) IsExecutable() bool
type Engine ¶
func NewLLMEngine ¶
func NewLLMEngine(ops ...EngineOption) (*Engine, error)
func (*Engine) CreateCompletion ¶
func (e *Engine) CreateCompletion(ctx context.Context, messages []llms.ChatMessage) (*CompletionOutput, error)
func (*Engine) CreateStreamCompletion ¶
func (e *Engine) CreateStreamCompletion(ctx context.Context, messages []llms.ChatMessage) (*StreamCompletionOutput, error)
func (*Engine) GetChannel ¶
func (e *Engine) GetChannel() chan StreamCompletionOutput
func (*Engine) GetConvoStore ¶
func (*Engine) GetMode ¶
func (e *Engine) GetMode() EngineMode
func (*Engine) SetMode ¶
func (e *Engine) SetMode(m EngineMode)
type EngineMode ¶
type EngineMode int
const ( ChatEngineMode EngineMode = iota ExecEngineMode )
func (EngineMode) String ¶
func (m EngineMode) String() string
type EngineOption ¶
type EngineOption func(*Engine)
func WithConfig ¶
func WithConfig(cfg *options.Config) EngineOption
func WithMode ¶
func WithMode(mode EngineMode) EngineOption
func WithStore ¶
func WithStore(store convo.Store) EngineOption
type LogHandler ¶
type LogHandler struct{}
LogHandler is a callback handler that prints to the standard output.
func (LogHandler) HandleChainEnd ¶
func (l LogHandler) HandleChainEnd(_ context.Context, outputs map[string]any)
func (LogHandler) HandleChainError ¶
func (l LogHandler) HandleChainError(_ context.Context, err error)
func (LogHandler) HandleChainStart ¶
func (l LogHandler) HandleChainStart(_ context.Context, inputs map[string]any)
func (LogHandler) HandleLLMError ¶
func (l LogHandler) HandleLLMError(_ context.Context, err error)
func (LogHandler) HandleLLMGenerateContentEnd ¶
func (l LogHandler) HandleLLMGenerateContentEnd(_ context.Context, res *llms.ContentResponse)
func (LogHandler) HandleLLMGenerateContentStart ¶
func (l LogHandler) HandleLLMGenerateContentStart(_ context.Context, ms []llms.MessageContent)
func (LogHandler) HandleLLMStart ¶
func (l LogHandler) HandleLLMStart(_ context.Context, prompts []string)
func (LogHandler) HandleStreamingFunc ¶
func (l LogHandler) HandleStreamingFunc(_ context.Context, chunk []byte)
func (LogHandler) HandleText ¶
func (l LogHandler) HandleText(_ context.Context, text string)
func (LogHandler) HandleToolEnd ¶
func (l LogHandler) HandleToolEnd(_ context.Context, output string)
func (LogHandler) HandleToolError ¶
func (l LogHandler) HandleToolError(_ context.Context, err error)
func (LogHandler) HandleToolStart ¶
func (l LogHandler) HandleToolStart(_ context.Context, input string)
type StreamCompletionOutput ¶
StreamCompletionOutput a tea.Msg that wraps the content returned from ai.
func (StreamCompletionOutput) GetContent ¶
func (c StreamCompletionOutput) GetContent() string
func (StreamCompletionOutput) IsExecutable ¶
func (c StreamCompletionOutput) IsExecutable() bool
func (StreamCompletionOutput) IsInterrupt ¶
func (c StreamCompletionOutput) IsInterrupt() bool
func (StreamCompletionOutput) IsLast ¶
func (c StreamCompletionOutput) IsLast() bool
Click to show internal directories.
Click to hide internal directories.