Documentation ¶
Index ¶
- Variables
- func HandleToken(req *http.Request)
- func NewOpenAIReverseProxy() *httputil.ReverseProxy
- type AudioTranscriptionRequest
- type AudioTranscriptionResponse
- type AzureAIStudioDeployment
- type AzureConfig
- type Capabilities
- type ChatMessage
- type DeployedModel
- type DeploymentCapability
- type DeploymentDetails
- type Deprecation
- type ImageData
- type ImageGenerationRequest
- type ImageGenerationResponse
- type JSONChoice
- type JSONModeRequest
- type JSONModeResponse
- type ListDeployedModelsResponse
- type ListModelResponse
- type ListVoicesResponse
- type Model
- type ModelList
- type ModelPermission
- type ResponseFormat
- type ScaleSettings
- type ServerlessDeployment
- type SpeechRequest
- type SpeechResponse
- type Usage
- type VoiceInfo
Constants ¶
This section is empty.
Variables ¶
var ( AzureOpenAIAPIVersion = "2024-06-01" AzureOpenAIEndpoint = "" ServerlessDeploymentInfo = make(map[string]ServerlessDeployment) AzureOpenAIModelMapper = make(map[string]string) )
Functions ¶
func HandleToken ¶
func NewOpenAIReverseProxy ¶
func NewOpenAIReverseProxy() *httputil.ReverseProxy
Types ¶
type AudioTranscriptionRequest ¶
type AudioTranscriptionRequest struct { Model string `json:"model"` Audio []byte `json:"audio"` Language string `json:"language,omitempty"` }
AudioTranscriptionRequest represents the request structure for audio transcription
type AudioTranscriptionResponse ¶
type AudioTranscriptionResponse struct {
Text string `json:"text"`
}
AudioTranscriptionResponse represents the response structure from audio transcription
type AzureAIStudioDeployment ¶
type AzureAIStudioDeployment struct { ModelName string `json:"model_name"` DeploymentName string `json:"deployment_name"` Region string `json:"region"` }
AzureAIStudioDeployment represents a deployment in Azure AI Studio
type AzureConfig ¶
type AzureConfig struct { APIVersion string `json:"api_version"` Endpoint string `json:"endpoint"` Token string `json:"token"` ModelMapperMode string `json:"model_mapper_mode"` AIStudioDeploymentsRaw string `json:"ai_studio_deployments_raw"` }
AzureConfig represents the configuration for Azure OpenAI
type Capabilities ¶
type Capabilities struct { ChatCompletion bool `json:"chat_completion"` Completion bool `json:"completion"` Embeddings bool `json:"embeddings"` FineTune bool `json:"fine_tune"` Inference bool `json:"inference"` }
Update if there are any changes to the capabilities
type ChatMessage ¶
ChatMessage represents a message in a chat conversation
type DeployedModel ¶
type DeployedModel struct { ID string `json:"id"` ModelID string `json:"model"` DeploymentID string `json:"deployment_id"` Status string `json:"status"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` CapabilityVersions []string `json:"capability_versions,omitempty"` }
DeployedModel represents a model deployed in Azure
type DeploymentCapability ¶
DeploymentCapability represents the capabilities of a deployment
type DeploymentDetails ¶
type DeploymentDetails struct { ID string `json:"id"` ModelID string `json:"model"` OwnerID string `json:"owner"` Status string `json:"status"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` Capabilities []DeploymentCapability `json:"capabilities"` ScaleSettings ScaleSettings `json:"scale_settings"` RaiPolicy string `json:"rai_policy"` }
DeploymentDetails represents detailed information about a deployment
type Deprecation ¶
type Deprecation struct { FineTune int `json:"fine_tune,omitempty"` Inference int `json:"inference,omitempty"` }
Update if there are any changes to the deprecation structure
type ImageData ¶
type ImageData struct {
URL string `json:"url"`
}
ImageData represents data of a generated image
type ImageGenerationRequest ¶
type ImageGenerationRequest struct { Model string `json:"model"` Prompt string `json:"prompt"` NumImages int `json:"num_images,omitempty"` Size string `json:"size,omitempty"` ResponseFormat string `json:"response_format,omitempty"` }
ImageGenerationRequest represents the request structure for image generation
type ImageGenerationResponse ¶
type ImageGenerationResponse struct { Created int64 `json:"created"` Data []ImageData `json:"data"` }
ImageGenerationResponse represents the response structure from image generation
type JSONChoice ¶
type JSONChoice struct { Index int `json:"index"` Message ChatMessage `json:"message"` FinishReason string `json:"finish_reason"` }
JSONChoice represents a choice in the JSON mode response
type JSONModeRequest ¶
type JSONModeRequest struct { Model string `json:"model"` Messages []ChatMessage `json:"messages"` Temperature float64 `json:"temperature,omitempty"` MaxTokens int `json:"max_tokens,omitempty"` ResponseFormat *ResponseFormat `json:"response_format,omitempty"` }
JSONModeRequest represents a request with JSON mode enabled
type JSONModeResponse ¶
type JSONModeResponse struct { ID string `json:"id"` Object string `json:"object"` Created int64 `json:"created"` Model string `json:"model"` Choices []JSONChoice `json:"choices"` Usage Usage `json:"usage"` }
JSONModeResponse represents a response when JSON mode is enabled
type ListDeployedModelsResponse ¶
type ListDeployedModelsResponse struct {
Data []DeployedModel `json:"data"`
}
ListDeployedModelsResponse represents the response for listing deployed models
type ListModelResponse ¶
type ListVoicesResponse ¶
type ListVoicesResponse struct {
Voices []VoiceInfo `json:"voices"`
}
ListVoicesResponse represents the response structure for listing available voices
type Model ¶
type Model struct { ID string `json:"id"` Object string `json:"object"` CreatedAt int64 `json:"created_at"` Capabilities Capabilities `json:"capabilities"` LifecycleStatus string `json:"lifecycle_status"` Status string `json:"status"` Deprecation Deprecation `json:"deprecation,omitempty"` FineTune string `json:"fine_tune,omitempty"` Created int `json:"created"` OwnedBy string `json:"owned_by"` Permission []ModelPermission `json:"permission"` Root string `json:"root"` Parent any `json:"parent"` }
Update Model struct to include new fields if necessary
type ModelPermission ¶
type ModelPermission struct { ID string `json:"id"` Object string `json:"object"` Created int `json:"created"` AllowCreateEngine bool `json:"allow_create_engine"` AllowSampling bool `json:"allow_sampling"` AllowLogprobs bool `json:"allow_logprobs"` AllowSearchIndices bool `json:"allow_search_indices"` AllowView bool `json:"allow_view"` AllowFineTuning bool `json:"allow_fine_tuning"` Organization string `json:"organization"` Group any `json:"group"` IsBlocking bool `json:"is_blocking"` }
type ResponseFormat ¶
type ResponseFormat struct {
Type string `json:"type"` // Can be "text" or "json_object"
}
ResponseFormat specifies the desired format for the model's output
type ScaleSettings ¶
ScaleSettings represents the scale settings for a deployment
type ServerlessDeployment ¶
type SpeechRequest ¶
type SpeechRequest struct { Model string `json:"model"` Input string `json:"input"` Voice string `json:"voice"` ResponseFormat string `json:"response_format,omitempty"` Speed float64 `json:"speed,omitempty"` }
SpeechRequest represents the request structure for text-to-speech
type SpeechResponse ¶
SpeechResponse represents the response structure from text-to-speech