Documentation ¶
Overview ¶
Package azopenai is used to provide the Azure OpenAI service
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AzureOpenAIProvider ¶
type AzureOpenAIProvider struct { APIKey string APIEndpoint string DeploymentID string APIVersion string }
AzureOpenAIProvider is the provider for Azure OpenAI
func NewProvider ¶ added in v1.18.1
func NewProvider(apiKey string, apiEndpoint string, deploymentID string, apiVersion string) *AzureOpenAIProvider
NewProvider creates a new AzureOpenAIProvider
func (*AzureOpenAIProvider) GetChatCompletions ¶
func (p *AzureOpenAIProvider) GetChatCompletions(userInstruction string, md metadata.M) (*ai.InvokeResponse, error)
GetChatCompletions get chat completions for ai service
func (*AzureOpenAIProvider) Name ¶
func (p *AzureOpenAIProvider) Name() string
Name returns the name of the provider
type ReqBody ¶
type ReqBody struct { Messages []ReqMessage `json:"messages"` Tools []ai.ToolCall `json:"tools"` // chatCompletionTool }
ReqBody is the request body
type ReqMessage ¶
type ReqMessage struct { Role string `json:"role"` Content string `json:"content"` ToolCallID string `json:"tool_call_id,omitempty"` }
ReqMessage is the message in Request
type RespBody ¶
type RespBody struct { ID string `json:"id"` Object string `json:"object"` Created int `json:"created"` Model string `json:"model"` Choices []RespChoice `json:"choices"` Usage RespUsage `json:"usage"` SystemFingerprint string `json:"system_fingerprint"` }
RespBody is the response body
type RespChoice ¶
type RespChoice struct { FinishReason string `json:"finish_reason"` Index int `json:"index"` Message RespMessage `json:"message"` }
RespChoice is used to indicate the choice in Response by `FinishReason`
Click to show internal directories.
Click to hide internal directories.