Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Chat ¶ added in v0.1.1
func Chat(ctx context.Context, provider TextProvider, reasoningTokens int, in io.Reader, out io.Writer) error
Chat is a basic util that reads a line of text from in, and writes the response to out
func HandleStreamedResponse ¶
func HandleStreamedResponse(ctx context.Context, tokens <-chan *TextResponse, errs <-chan error, handler func(token *TextResponse) error) error
*
- A utility method to assist with reading the streamed response, returns the first encountered error
Types ¶
type TextProvider ¶
type TextProvider interface {
Ask(ctx context.Context, history []string, reasoningTokens int) (*TextResponse, error)
StreamedAsk(ctx context.Context, history []string, reasoningTokens int) (<-chan *TextResponse, <-chan error)
}
* An abstracted concept of an LLM provider
type TextResponse ¶
type TextResponse struct {
Answer string // If the empty string, then it implies its a reasoning token/response
Reasoning string // If the empty string, then it implies its an answer with no reasoning
}
* The most generic response from a provider * this may be used for entire enswers, or single tokens * If both fields are empty, then its undefined
Click to show internal directories.
Click to hide internal directories.