Versions in this module Expand all Collapse all v1 v1.0.12 Sep 1, 2024 v1.0.11 Sep 1, 2024 Changes in this version type ChatRequest + RepeatPenalty float64 v1.0.10 Sep 1, 2024 v1.0.9 Sep 1, 2024 v1.0.8 Sep 1, 2024 v1.0.7 Sep 1, 2024 v1.0.6 Sep 1, 2024 Changes in this version type StreamedChatResponsePayload + Stop bool v1.0.5 Aug 31, 2024 v1.0.4 Aug 31, 2024 v1.0.3 Aug 31, 2024 Changes in this version + var ErrContentExclusive = errors.New("only one of Content / MultiContent allowed in message") + var ErrEmptyResponse = errors.New("empty response") + func IsAzure(apiType APIType) bool + type APIType string + const APITypeAzure + const APITypeAzureAD + const APITypeOpenAI + type ChatCompletionChoice struct + FinishReason FinishReason + Index int + LogProbs *LogProbs + Message ChatMessage + type ChatCompletionResponse struct + Choices []*ChatCompletionChoice + Created int64 + ID string + Model string + Object string + SystemFingerprint string + Usage ChatUsage + type ChatMessage struct + Content string + FunctionCall *FunctionCall + MultiContent []llms.ContentPart + Name string + Role string + ToolCallID string + ToolCalls []ToolCall + func (m *ChatMessage) UnmarshalJSON(data []byte) error + func (m ChatMessage) MarshalJSON() ([]byte, error) + type ChatRequest struct + FrequencyPenalty float64 + FunctionCallBehavior FunctionCallBehavior + Functions []FunctionDefinition + LogProbs bool + MaxTokens int + Messages []*ChatMessage + Metadata map[string]any + Model string + N int + PresencePenalty float64 + ResponseFormat *ResponseFormat + Seed int + StopWords []string + Stream bool + StreamOptions *StreamOptions + StreamingFunc func(ctx context.Context, chunk []byte) error + Temperature float64 + ToolChoice any + Tools []Tool + TopLogProbs int + TopP float64 + type ChatUsage struct + CompletionTokens int + PromptTokens int + TotalTokens int + type Client struct + EmbeddingModel string + Model string + func New(token string, model string, baseURL string, organization string, ...) (*Client, error) + func (c *Client) CreateChat(ctx context.Context, r *ChatRequest) (*ChatCompletionResponse, error) + func (c *Client) CreateCompletion(ctx context.Context, r *CompletionRequest) (*Completion, error) + func (c *Client) CreateEmbedding(ctx context.Context, r *EmbeddingRequest) ([][]float32, error) + type Completion struct + Text string + type CompletionRequest struct + FrequencyPenalty float64 + MaxTokens int + Model string + N int + PresencePenalty float64 + Prompt string + Seed int + StopWords []string + StreamingFunc func(ctx context.Context, chunk []byte) error + Temperature float64 + TopP float64 + type CompletionResponse struct + Choices []struct{ ... } + Created float64 + ID string + Model string + Object string + Usage struct{ ... } + type Doer interface + Do func(req *http.Request) (*http.Response, error) + type EmbeddingRequest struct + Input []string + Model string + type FinishReason string + const FinishReasonContentFilter + const FinishReasonFunctionCall + const FinishReasonLength + const FinishReasonNull + const FinishReasonStop + const FinishReasonToolCalls + func (r FinishReason) MarshalJSON() ([]byte, error) + type FunctionCall struct + Arguments string + Name string + type FunctionCallBehavior string + const FunctionCallBehaviorAuto + const FunctionCallBehaviorNone + const FunctionCallBehaviorUnspecified + type FunctionDefinition struct + Description string + Name string + Parameters any + type LogProb struct + Bytes []byte + LogProb float64 + Token string + TopLogProbs []TopLogProbs + type LogProbs struct + Content []LogProb + type Option func(*Client) error + type ResponseFormat struct + Type string + type StreamOptions struct + IncludeUsage bool + type StreamedChatResponsePayload struct + Choices []struct{ ... } + Created float64 + Error error + ID string + Model string + Object string + SystemFingerprint string + Usage *Usage + type Tool struct + Function FunctionDefinition + Type ToolType + type ToolCall struct + Function ToolFunction + ID string + Type ToolType + func StreamingChatResponseTools(tools []ToolCall, delta []*ToolCall) ([]byte, []ToolCall) + type ToolChoice struct + Function ToolFunction + Type ToolType + type ToolFunction struct + Arguments string + Name string + type ToolType string + const ToolTypeFunction + type TopLogProbs struct + Bytes []byte + LogProb float64 + Token string + type Usage struct + CompletionTokens int + PromptTokens int + TotalTokens int