Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- type OpenAI
- func New(config Config, httpClient *http.Client) *OpenAI
- func NewAzure(config Config, httpClient *http.Client) *OpenAI
- func NewCompatible(config Config, httpClient *http.Client) *OpenAI
- func NewCompatibleEmbeddings(config Config, httpClient *http.Client) *OpenAI
- func NewEmbeddings(config Config, httpClient *http.Client) *OpenAI
- func (s *OpenAI) BatchCreateEmbeddings(ctx context.Context, texts []string) ([][]float32, error)
- func (s *OpenAI) ChatCompletion(request llm.CompletionRequest, opts ...llm.LanguageModelOption) (*llm.TextStreamResult, error)
- func (s *OpenAI) ChatCompletionNoStream(request llm.CompletionRequest, opts ...llm.LanguageModelOption) (string, error)
- func (s *OpenAI) CountTokens(text string) int
- func (s *OpenAI) CreateEmbedding(ctx context.Context, text string) ([]float32, error)
- func (s *OpenAI) Dimensions() int
- func (s *OpenAI) GenerateImage(prompt string) (image.Image, error)
- func (s *OpenAI) GetDefaultConfig() llm.LanguageModelConfig
- func (s *OpenAI) InputTokenLimit() int
- func (s *OpenAI) Transcribe(file io.Reader) (*subtitles.Subtitles, error)
- type ToolBufferElement
Constants ¶
View Source
const ( MaxFunctionCalls = 10 OpenAIMaxImageSize = 20 * 1024 * 1024 // 20 MB )
Variables ¶
View Source
var ErrStreamingTimeout = errors.New("timeout streaming")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
APIKey string `json:"apiKey"`
APIURL string `json:"apiURL"`
OrgID string `json:"orgID"`
DefaultModel string `json:"defaultModel"`
InputTokenLimit int `json:"inputTokenLimit"`
OutputTokenLimit int `json:"outputTokenLimit"`
StreamingTimeout time.Duration `json:"streamingTimeout"`
SendUserID bool `json:"sendUserID"`
EmbeddingModel string `json:"embeddingModel"`
EmbeddingDimensions int `json:"embeddingDimensions"`
UseResponsesAPI bool `json:"useResponsesAPI"`
EnabledNativeTools []string `json:"enabledNativeTools"`
ReasoningEnabled bool `json:"reasoningEnabled"`
ReasoningEffort string `json:"reasoningEffort"`
}
type OpenAI ¶
type OpenAI struct {
// contains filtered or unexported fields
}
func NewCompatibleEmbeddings ¶
NewCompatibleEmbeddings creates a new OpenAI client configured only for embeddings functionality
func NewEmbeddings ¶
NewEmbeddings creates a new OpenAI client configured only for embeddings functionality
func (*OpenAI) BatchCreateEmbeddings ¶
BatchCreateEmbeddings generates embeddings for multiple texts in a single API call
func (*OpenAI) ChatCompletion ¶
func (s *OpenAI) ChatCompletion(request llm.CompletionRequest, opts ...llm.LanguageModelOption) (*llm.TextStreamResult, error)
func (*OpenAI) ChatCompletionNoStream ¶
func (s *OpenAI) ChatCompletionNoStream(request llm.CompletionRequest, opts ...llm.LanguageModelOption) (string, error)
func (*OpenAI) CountTokens ¶
func (*OpenAI) CreateEmbedding ¶
func (*OpenAI) Dimensions ¶
func (*OpenAI) GetDefaultConfig ¶
func (s *OpenAI) GetDefaultConfig() llm.LanguageModelConfig
func (*OpenAI) InputTokenLimit ¶
type ToolBufferElement ¶
type ToolBufferElement struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.