Documentation
¶
Index ¶
- type CompletionInput
- type Engine
- func (e *Engine) ChatStream(ctx context.Context, messages []llms.MessageContent, ...) (*llms.ContentResponse, error)
- func (e *Engine) Clear()
- func (e *Engine) CreateCompletion(input string) (*EngineExecOutput, error)
- func (e *Engine) CreateStreamCompletion(input string) tea.Msg
- func (e *Engine) GetChannel() chan StreamCompletionOutput
- func (e *Engine) GetMode() EngineMode
- func (e *Engine) Interrupt()
- func (e *Engine) Reset()
- func (e *Engine) SetMode(m EngineMode)
- func (e *Engine) SetPipe(pipe string)
- func (e *Engine) SummaryMessages(messages []llms.ChatMessage) (string, error)
- type EngineExecOutput
- type EngineLoggingCallbackOutput
- type EngineMode
- 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
- type SummaryContentOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompletionInput ¶ added in v0.1.10
type CompletionInput struct {
Content string
}
CompletionInput is a tea.Msg that wraps the content read from stdin.
type Engine ¶
func NewLLMEngine ¶
func NewLLMEngine(mode EngineMode, cfg *options.Config) (*Engine, error)
func (*Engine) ChatStream ¶ added in v0.1.4
func (e *Engine) ChatStream(ctx context.Context, messages []llms.MessageContent, options ...llms.CallOption) (*llms.ContentResponse, error)
func (*Engine) CreateCompletion ¶ added in v0.1.10
func (e *Engine) CreateCompletion(input string) (*EngineExecOutput, error)
func (*Engine) CreateStreamCompletion ¶ added in v0.1.10
func (*Engine) GetChannel ¶
func (e *Engine) GetChannel() chan StreamCompletionOutput
func (*Engine) GetMode ¶
func (e *Engine) GetMode() EngineMode
func (*Engine) SetMode ¶
func (e *Engine) SetMode(m EngineMode)
func (*Engine) SummaryMessages ¶
func (e *Engine) SummaryMessages(messages []llms.ChatMessage) (string, error)
type EngineExecOutput ¶
type EngineExecOutput struct { Command string `json:"cmd"` Explanation string `json:"exp"` Executable bool `json:"exec"` }
func (EngineExecOutput) GetCommand ¶
func (eo EngineExecOutput) GetCommand() string
func (EngineExecOutput) GetExplanation ¶
func (eo EngineExecOutput) GetExplanation() string
func (EngineExecOutput) IsExecutable ¶
func (eo EngineExecOutput) IsExecutable() bool
type EngineLoggingCallbackOutput ¶
type EngineLoggingCallbackOutput struct {
// contains filtered or unexported fields
}
func (EngineLoggingCallbackOutput) GetContent ¶
func (ec EngineLoggingCallbackOutput) GetContent() string
type EngineMode ¶
type EngineMode int
const ( ExecEngineMode EngineMode = iota ChatEngineMode )
func (EngineMode) String ¶
func (m EngineMode) String() string
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 ¶ added in v0.1.10
type StreamCompletionOutput struct {
// contains filtered or unexported fields
}
StreamCompletionOutput a tea.Msg that wraps the content returned from llm.
func (StreamCompletionOutput) GetContent ¶ added in v0.1.10
func (co StreamCompletionOutput) GetContent() string
func (StreamCompletionOutput) IsExecutable ¶ added in v0.1.10
func (co StreamCompletionOutput) IsExecutable() bool
func (StreamCompletionOutput) IsInterrupt ¶ added in v0.1.10
func (co StreamCompletionOutput) IsInterrupt() bool
func (StreamCompletionOutput) IsLast ¶ added in v0.1.10
func (co StreamCompletionOutput) IsLast() bool
type SummaryContentOutput ¶
type SummaryContentOutput struct {
Content string `json:"content"`
}
Click to show internal directories.
Click to hide internal directories.