Documentation
¶
Index ¶
- Constants
- func Ptr[T any](v T) *T
- type AnthropicClient
- type ChatModel
- type Completer
- type CompletionResponse
- type GoogleClient
- type Message
- type MessagePart
- type MessagePartType
- type MessageRole
- type NewAnthropicClientOptions
- type NewGoogleClientOptions
- type NewOpenAIClientOptions
- type OpenAIClient
- type Prompt
Constants ¶
View Source
const ( ModelGPT4o = ChatModel(openai.ChatModelGPT4o) ModelGPT4oMini = ChatModel(openai.ChatModelGPT4oMini) )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AnthropicClient ¶
type AnthropicClient struct { Client *anthropic.Client // contains filtered or unexported fields }
func NewAnthropicClient ¶
func NewAnthropicClient(opts NewAnthropicClientOptions) *AnthropicClient
type Completer ¶
type Completer interface {
Complete(ctx context.Context, p Prompt) CompletionResponse
}
Completer is satisfied by clients supporting chat completion. Streaming chat completion is preferred where possible, so that methods on CompletionResponse like CompletionResponse.Parts can be used to stream the response.
type CompletionResponse ¶
type CompletionResponse struct {
// contains filtered or unexported fields
}
func NewCompletionResponse ¶
func NewCompletionResponse(partsFunc iter.Seq2[MessagePart, error]) CompletionResponse
func (CompletionResponse) Parts ¶
func (c CompletionResponse) Parts() iter.Seq2[MessagePart, error]
type GoogleClient ¶
func NewGoogleClient ¶
func NewGoogleClient(opts NewGoogleClientOptions) *GoogleClient
type Message ¶
type Message struct { Role MessageRole Parts []MessagePart }
func NewUserTextMessage ¶
NewUserTextMessage is a convenience function to create a new user text message.
type MessagePart ¶
type MessagePart struct { Type MessagePartType Data io.Reader // contains filtered or unexported fields }
func TextMessagePart ¶
func TextMessagePart(text string) MessagePart
func (MessagePart) Text ¶
func (m MessagePart) Text() string
type MessagePartType ¶
type MessagePartType string
MessagePartType for MessagePart.
const (
MessagePartTypeText MessagePartType = "text"
)
type MessageRole ¶
type MessageRole string
MessageRole for Message.
const ( MessageRoleUser MessageRole = "user" MessageRoleAssistant MessageRole = "assistant" )
type NewGoogleClientOptions ¶
type NewOpenAIClientOptions ¶
type OpenAIClient ¶
type OpenAIClient struct { Client *openai.Client // contains filtered or unexported fields }
func NewOpenAIClient ¶
func NewOpenAIClient(opts NewOpenAIClientOptions) *OpenAIClient
func (*OpenAIClient) Complete ¶
func (c *OpenAIClient) Complete(ctx context.Context, p Prompt) CompletionResponse
Complete satisfies Completer.
Click to show internal directories.
Click to hide internal directories.