Versions in this module Expand all Collapse all v0 v0.1.12 Aug 22, 2024 Changes in this version + const APITypeAzure + const APITypeAzureAD + const APITypeOpenAI + const DefaultAPIVersion + const RoleAssistant + const RoleFunction + const RoleSystem + const RoleTool + const RoleUser + var ErrEmptyResponse = errors.New("no response") + var ErrMissingAzureEmbeddingModel = errors.New("embeddings model needs to be provided when using Azure API") + var ErrMissingAzureModel = errors.New("model needs to be provided when using Azure API") + var ErrMissingToken = errors.New(...) + var ErrUnexpectedResponseLength = errors.New("unexpected length of response") + var ResponseFormatJSON = &ResponseFormat + func ExtractToolParts(msg *ChatMessage) ([]llms.ContentPart, []llms.ToolCall) + type APIType openaiclient.APIType + type ChatMessage = openaiclient.ChatMessage + type LLM struct + CallbacksHandler callbacks.Handler + func New(opts ...Option) (*LLM, error) + func (o *LLM) Call(ctx context.Context, prompt string, options ...llms.CallOption) (string, error) + func (o *LLM) CreateEmbedding(ctx context.Context, inputTexts []string) ([][]float32, error) + func (o *LLM) GenerateContent(ctx context.Context, messages []llms.MessageContent, ...) (*llms.ContentResponse, error) + type Option func(*options) + func WithAPIType(apiType APIType) Option + func WithAPIVersion(apiVersion string) Option + func WithBaseURL(baseURL string) Option + func WithCallback(callbackHandler callbacks.Handler) Option + func WithEmbeddingModel(embeddingModel string) Option + func WithHTTPClient(client openaiclient.Doer) Option + func WithModel(model string) Option + func WithOrganization(organization string) Option + func WithResponseFormat(responseFormat *ResponseFormat) Option + func WithToken(token string) Option + type ResponseFormat = openaiclient.ResponseFormat