Documentation ¶
Overview ¶
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See License.txt in the project root for license information.
Package azopenai Azure OpenAI Service provides access to OpenAI's powerful language models including the GPT-4, GPT-35-Turbo, and Embeddings model series, as well as image generation using DALL-E.
The Client in this package can be used with Azure OpenAI or OpenAI.
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See License.txt in the project root for license information.
Index ¶
- type AddUploadPartOptions
- type AddUploadPartRequest
- type AddUploadPartResponse
- type AudioTaskLabel
- type AudioTranscription
- type AudioTranscriptionFormat
- type AudioTranscriptionOptions
- type AudioTranscriptionSegment
- type AudioTranscriptionTimestampGranularity
- type AudioTranscriptionWord
- type AudioTranslation
- type AudioTranslationFormat
- type AudioTranslationOptions
- type AudioTranslationSegment
- type AzureChatEnhancementConfiguration
- type AzureChatEnhancements
- type AzureChatExtensionConfiguration
- type AzureChatExtensionConfigurationClassification
- type AzureChatExtensionDataSourceResponseCitation
- type AzureChatExtensionOptions
- type AzureChatExtensionRetrieveDocumentFilterReason
- type AzureChatExtensionRetrievedDocument
- type AzureChatExtensionType
- type AzureChatExtensionsMessageContext
- type AzureChatGroundingEnhancementConfiguration
- type AzureChatOCREnhancementConfiguration
- type AzureCosmosDBChatExtensionConfiguration
- type AzureCosmosDBChatExtensionParameters
- type AzureCosmosDBFieldMappingOptions
- type AzureGroundingEnhancement
- type AzureGroundingEnhancementCoordinatePoint
- type AzureGroundingEnhancementLine
- type AzureGroundingEnhancementLineSpan
- type AzureSearchChatExtensionConfiguration
- type AzureSearchChatExtensionParameters
- type AzureSearchIndexFieldMappingOptions
- type AzureSearchQueryType
- type Batch
- type BatchCreateRequest
- type BatchCreateResponseRequestCounts
- type BatchErrorDatum
- type BatchErrorList
- type BatchRequestCounts
- type BatchRequestInput
- type BatchRequestOutput
- type BatchRequestOutputError
- type BatchRequestOutputResponse
- type BatchStatus
- type CancelBatchOptions
- type CancelBatchResponse
- type CancelUploadOptions
- type CancelUploadResponse
- type ChatChoice
- type ChatChoiceLogProbabilityInfo
- type ChatChoiceLogProbs
- type ChatCompletionRequestMessageContentPart
- type ChatCompletionRequestMessageContentPartClassification
- type ChatCompletionRequestMessageContentPartImage
- func (c *ChatCompletionRequestMessageContentPartImage) GetChatCompletionRequestMessageContentPart() *ChatCompletionRequestMessageContentPart
- func (c ChatCompletionRequestMessageContentPartImage) MarshalJSON() ([]byte, error)
- func (c *ChatCompletionRequestMessageContentPartImage) UnmarshalJSON(data []byte) error
- type ChatCompletionRequestMessageContentPartImageURL
- type ChatCompletionRequestMessageContentPartImageURLDetail
- type ChatCompletionRequestMessageContentPartText
- func (c *ChatCompletionRequestMessageContentPartText) GetChatCompletionRequestMessageContentPart() *ChatCompletionRequestMessageContentPart
- func (c ChatCompletionRequestMessageContentPartText) MarshalJSON() ([]byte, error)
- func (c *ChatCompletionRequestMessageContentPartText) UnmarshalJSON(data []byte) error
- type ChatCompletionRequestMessageContentPartType
- type ChatCompletionStreamOptions
- type ChatCompletions
- type ChatCompletionsFunctionToolCall
- type ChatCompletionsFunctionToolDefinition
- type ChatCompletionsFunctionToolDefinitionFunction
- type ChatCompletionsFunctionToolSelection
- type ChatCompletionsJSONResponseFormat
- type ChatCompletionsJSONSchemaResponseFormat
- type ChatCompletionsJSONSchemaResponseFormatJSONSchema
- type ChatCompletionsNamedFunctionToolSelection
- type ChatCompletionsNamedToolSelection
- type ChatCompletionsNamedToolSelectionClassification
- type ChatCompletionsOptions
- type ChatCompletionsOptionsFunctionCall
- type ChatCompletionsResponseFormat
- type ChatCompletionsResponseFormatClassification
- type ChatCompletionsStreamOptions
- type ChatCompletionsTextResponseFormat
- type ChatCompletionsToolCall
- type ChatCompletionsToolCallClassification
- type ChatCompletionsToolChoice
- type ChatCompletionsToolChoiceFunction
- type ChatCompletionsToolDefinition
- type ChatCompletionsToolDefinitionClassification
- type ChatCompletionsToolSelectionPreset
- type ChatFinishDetails
- type ChatFinishDetailsClassification
- type ChatMessageContentItem
- type ChatMessageContentItemClassification
- type ChatMessageImageContentItem
- type ChatMessageImageDetailLevel
- type ChatMessageImageURL
- type ChatMessageRefusalContentItem
- type ChatMessageTextContentItem
- type ChatRequestAssistantMessage
- type ChatRequestAssistantMessageContent
- type ChatRequestFunctionMessage
- type ChatRequestMessage
- type ChatRequestMessageClassification
- type ChatRequestSystemMessage
- type ChatRequestSystemMessageContent
- type ChatRequestToolMessage
- type ChatRequestToolMessageContent
- type ChatRequestUserMessage
- type ChatRequestUserMessageContent
- type ChatResponseMessage
- type ChatRole
- type ChatTokenLogProbabilityInfo
- type ChatTokenLogProbabilityResult
- type Choice
- type ChoiceLogProbs
- type Client
- func NewClient(endpoint string, credential azcore.TokenCredential, options *ClientOptions) (*Client, error)
- func NewClientForOpenAI(endpoint string, credential *azcore.KeyCredential, options *ClientOptions) (*Client, error)
- func NewClientWithKeyCredential(endpoint string, credential *azcore.KeyCredential, options *ClientOptions) (*Client, error)
- func (client *Client) AddUploadPart(ctx context.Context, uploadID string, data io.ReadSeekCloser, ...) (AddUploadPartResponse, error)
- func (client *Client) CancelBatch(ctx context.Context, batchID string, options *CancelBatchOptions) (CancelBatchResponse, error)
- func (client *Client) CancelUpload(ctx context.Context, uploadID string, options *CancelUploadOptions) (CancelUploadResponse, error)
- func (client *Client) CompleteUpload(ctx context.Context, uploadID string, requestBody CompleteUploadRequest, ...) (CompleteUploadResponse, error)
- func (client *Client) CreateBatch(ctx context.Context, createBatchRequest BatchCreateRequest, ...) (CreateBatchResponse, error)
- func (client *Client) CreateUpload(ctx context.Context, requestBody CreateUploadRequest, ...) (CreateUploadResponse, error)
- func (client *Client) DeleteFile(ctx context.Context, fileID string, options *DeleteFileOptions) (DeleteFileResponse, error)
- func (client *Client) GenerateSpeechFromText(ctx context.Context, body SpeechGenerationOptions, ...) (GenerateSpeechFromTextResponse, error)
- func (client *Client) GetAudioTranscription(ctx context.Context, body AudioTranscriptionOptions, ...) (GetAudioTranscriptionResponse, error)
- func (client *Client) GetAudioTranslation(ctx context.Context, body AudioTranslationOptions, ...) (GetAudioTranslationResponse, error)
- func (client *Client) GetBatch(ctx context.Context, batchID string, options *GetBatchOptions) (GetBatchResponse, error)
- func (client *Client) GetChatCompletions(ctx context.Context, body ChatCompletionsOptions, ...) (GetChatCompletionsResponse, error)
- func (client *Client) GetChatCompletionsStream(ctx context.Context, body ChatCompletionsStreamOptions, ...) (GetChatCompletionsStreamResponse, error)
- func (client *Client) GetCompletions(ctx context.Context, body CompletionsOptions, options *GetCompletionsOptions) (GetCompletionsResponse, error)
- func (client *Client) GetCompletionsStream(ctx context.Context, body CompletionsStreamOptions, ...) (GetCompletionsStreamResponse, error)
- func (client *Client) GetEmbeddings(ctx context.Context, body EmbeddingsOptions, options *GetEmbeddingsOptions) (GetEmbeddingsResponse, error)
- func (client *Client) GetFile(ctx context.Context, fileID string, options *GetFileOptions) (GetFileResponse, error)
- func (client *Client) GetFileContent(ctx context.Context, fileID string, options *GetFileContentOptions) (GetFileContentResponse, error)
- func (client *Client) GetImageGenerations(ctx context.Context, body ImageGenerationOptions, ...) (GetImageGenerationsResponse, error)
- func (client *Client) ListFiles(ctx context.Context, options *ListFilesOptions) (ListFilesResponse, error)
- func (c *Client) NewListBatchesPager(options *ListBatchesOptions) *runtime.Pager[ListBatchesResponse]
- func (client *Client) UploadFile(ctx context.Context, file io.ReadSeekCloser, purpose FilePurpose, ...) (UploadFileResponse, error)
- type ClientOptions
- type CompleteUploadOptions
- type CompleteUploadRequest
- type CompleteUploadResponse
- type Completions
- type CompletionsFinishReason
- type CompletionsLogProbabilityModel
- type CompletionsOptions
- type CompletionsStreamOptions
- type CompletionsUsage
- type CompletionsUsageCompletionTokensDetails
- type CompletionsUsagePromptTokensDetails
- type ContentFilterBlocklistIDResult
- type ContentFilterCitedDetectionResult
- type ContentFilterCompletionTextSpan
- type ContentFilterCompletionTextSpanResult
- type ContentFilterDetailedResults
- type ContentFilterDetectionResult
- type ContentFilterResponseError
- type ContentFilterResult
- type ContentFilterResultDetailsForPrompt
- type ContentFilterResults
- type ContentFilterResultsForChoice
- type ContentFilterResultsForPrompt
- type ContentFilterSeverity
- type CreateBatchOptions
- type CreateBatchResponse
- type CreateUploadOptions
- type CreateUploadRequest
- type CreateUploadRequestPurpose
- type CreateUploadResponse
- type DeleteFileOptions
- type DeleteFileResponse
- type ElasticsearchChatExtensionConfiguration
- type ElasticsearchChatExtensionParameters
- type ElasticsearchIndexFieldMappingOptions
- type ElasticsearchQueryType
- type EmbeddingEncodingFormat
- type EmbeddingItem
- type Embeddings
- type EmbeddingsOptions
- type EmbeddingsUsage
- type Error
- type EventReader
- type File
- type FileDeletionStatus
- type FileListResponse
- type FilePurpose
- type FileState
- type FunctionCall
- type FunctionCallPreset
- type FunctionDefinition
- type FunctionName
- type GenerateSpeechFromTextOptions
- type GenerateSpeechFromTextResponse
- type GetAudioTranscriptionBody
- type GetAudioTranscriptionOptions
- type GetAudioTranscriptionResponse
- type GetAudioTranslationBody
- type GetAudioTranslationOptions
- type GetAudioTranslationResponse
- type GetBatchOptions
- type GetBatchResponse
- type GetChatCompletionsOptions
- type GetChatCompletionsResponse
- type GetChatCompletionsStreamOptions
- type GetChatCompletionsStreamResponse
- type GetCompletionsOptions
- type GetCompletionsResponse
- type GetCompletionsStreamOptions
- type GetCompletionsStreamResponse
- type GetEmbeddingsOptions
- type GetEmbeddingsResponse
- type GetFileContentOptions
- type GetFileContentResponse
- type GetFileOptions
- type GetFileResponse
- type GetImageGenerationsOptions
- type GetImageGenerationsResponse
- type ImageGenerationContentFilterResults
- type ImageGenerationData
- type ImageGenerationOptions
- type ImageGenerationPromptFilterResults
- type ImageGenerationQuality
- type ImageGenerationResponseFormat
- type ImageGenerationStyle
- type ImageGenerations
- type ImageGenerationsDataItem
- type ImageSize
- type ListBatchesOptions
- type ListBatchesPage
- type ListBatchesResponse
- type ListFilesOptions
- type ListFilesResponse
- type MaxTokensFinishDetails
- type MongoDBChatExtensionConfiguration
- type MongoDBChatExtensionParameters
- type MongoDBChatExtensionParametersEmbeddingDependency
- type MongoDBChatExtensionParametersFieldsMapping
- type OnYourDataAPIKeyAuthenticationOptions
- type OnYourDataAccessTokenAuthenticationOptions
- type OnYourDataAuthenticationOptions
- type OnYourDataAuthenticationOptionsClassification
- type OnYourDataAuthenticationType
- type OnYourDataConnectionStringAuthenticationOptions
- func (o *OnYourDataConnectionStringAuthenticationOptions) GetOnYourDataAuthenticationOptions() *OnYourDataAuthenticationOptions
- func (o OnYourDataConnectionStringAuthenticationOptions) MarshalJSON() ([]byte, error)
- func (o *OnYourDataConnectionStringAuthenticationOptions) UnmarshalJSON(data []byte) error
- type OnYourDataContextProperty
- type OnYourDataDeploymentNameVectorizationSource
- type OnYourDataEncodedAPIKeyAuthenticationOptions
- type OnYourDataEndpointVectorizationSource
- type OnYourDataIntegratedVectorizationSource
- type OnYourDataKeyAndKeyIDAuthenticationOptions
- type OnYourDataModelIDVectorizationSource
- type OnYourDataSystemAssignedManagedIdentityAuthenticationOptions
- func (o *OnYourDataSystemAssignedManagedIdentityAuthenticationOptions) GetOnYourDataAuthenticationOptions() *OnYourDataAuthenticationOptions
- func (o OnYourDataSystemAssignedManagedIdentityAuthenticationOptions) MarshalJSON() ([]byte, error)
- func (o *OnYourDataSystemAssignedManagedIdentityAuthenticationOptions) UnmarshalJSON(data []byte) error
- type OnYourDataUserAssignedManagedIdentityAuthenticationOptions
- func (o *OnYourDataUserAssignedManagedIdentityAuthenticationOptions) GetOnYourDataAuthenticationOptions() *OnYourDataAuthenticationOptions
- func (o OnYourDataUserAssignedManagedIdentityAuthenticationOptions) MarshalJSON() ([]byte, error)
- func (o *OnYourDataUserAssignedManagedIdentityAuthenticationOptions) UnmarshalJSON(data []byte) error
- type OnYourDataUsernameAndPasswordAuthenticationOptions
- func (o *OnYourDataUsernameAndPasswordAuthenticationOptions) GetOnYourDataAuthenticationOptions() *OnYourDataAuthenticationOptions
- func (o OnYourDataUsernameAndPasswordAuthenticationOptions) MarshalJSON() ([]byte, error)
- func (o *OnYourDataUsernameAndPasswordAuthenticationOptions) UnmarshalJSON(data []byte) error
- type OnYourDataVectorSearchAPIKeyAuthenticationOptions
- func (o *OnYourDataVectorSearchAPIKeyAuthenticationOptions) GetOnYourDataVectorSearchAuthenticationOptions() *OnYourDataVectorSearchAuthenticationOptions
- func (o OnYourDataVectorSearchAPIKeyAuthenticationOptions) MarshalJSON() ([]byte, error)
- func (o *OnYourDataVectorSearchAPIKeyAuthenticationOptions) UnmarshalJSON(data []byte) error
- type OnYourDataVectorSearchAccessTokenAuthenticationOptions
- func (o *OnYourDataVectorSearchAccessTokenAuthenticationOptions) GetOnYourDataVectorSearchAuthenticationOptions() *OnYourDataVectorSearchAuthenticationOptions
- func (o OnYourDataVectorSearchAccessTokenAuthenticationOptions) MarshalJSON() ([]byte, error)
- func (o *OnYourDataVectorSearchAccessTokenAuthenticationOptions) UnmarshalJSON(data []byte) error
- type OnYourDataVectorSearchAuthenticationOptions
- func (o *OnYourDataVectorSearchAuthenticationOptions) GetOnYourDataVectorSearchAuthenticationOptions() *OnYourDataVectorSearchAuthenticationOptions
- func (o OnYourDataVectorSearchAuthenticationOptions) MarshalJSON() ([]byte, error)
- func (o *OnYourDataVectorSearchAuthenticationOptions) UnmarshalJSON(data []byte) error
- type OnYourDataVectorSearchAuthenticationOptionsClassification
- type OnYourDataVectorSearchAuthenticationType
- type OnYourDataVectorizationSource
- type OnYourDataVectorizationSourceClassification
- type OnYourDataVectorizationSourceType
- type PineconeChatExtensionConfiguration
- type PineconeChatExtensionParameters
- type PineconeFieldMappingOptions
- type SpeechGenerationOptions
- type SpeechGenerationResponse
- type SpeechGenerationResponseFormat
- type SpeechVoice
- type StopFinishDetails
- type Upload
- type UploadFile
- type UploadFileOptions
- type UploadFileResponse
- type UploadPart
- type UploadPurpose
- type UploadStatus
Examples ¶
- Client.GenerateSpeechFromText
- Client.GetAudioTranscription
- Client.GetChatCompletions
- Client.GetChatCompletions (BringYourOwnDataWithCognitiveSearch)
- Client.GetChatCompletions (Functions)
- Client.GetChatCompletions (LegacyFunctions)
- Client.GetChatCompletions (StructuredOutputs)
- Client.GetChatCompletions (StructuredOutputs_responseFormat)
- Client.GetChatCompletions (Vision)
- Client.GetChatCompletionsStream
- Client.GetCompletions
- Client.GetCompletionsStream
- Client.GetEmbeddings
- Client.GetImageGenerations
- NewClient
- NewClientForOpenAI
- NewClientWithKeyCredential
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddUploadPartOptions ¶ added in v0.7.0
type AddUploadPartOptions struct { }
AddUploadPartOptions contains the optional parameters for the Client.AddUploadPart method.
type AddUploadPartRequest ¶ added in v0.7.0
type AddUploadPartRequest struct { // REQUIRED; The chunk of bytes for this Part. Data []byte }
AddUploadPartRequest - The multipart/form-data request body of a data part addition request for an upload.
func (AddUploadPartRequest) MarshalJSON ¶ added in v0.7.0
func (a AddUploadPartRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AddUploadPartRequest.
func (*AddUploadPartRequest) UnmarshalJSON ¶ added in v0.7.0
func (a *AddUploadPartRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AddUploadPartRequest.
type AddUploadPartResponse ¶ added in v0.7.0
type AddUploadPartResponse struct { // The upload Part represents a chunk of bytes we can add to an Upload object. UploadPart }
AddUploadPartResponse contains the response from method Client.AddUploadPart.
type AudioTaskLabel ¶ added in v0.3.0
type AudioTaskLabel string
AudioTaskLabel - Defines the possible descriptors for available audio operation responses.
const ( // AudioTaskLabelTranscribe - Accompanying response data resulted from an audio transcription task. AudioTaskLabelTranscribe AudioTaskLabel = "transcribe" // AudioTaskLabelTranslate - Accompanying response data resulted from an audio translation task. AudioTaskLabelTranslate AudioTaskLabel = "translate" )
func PossibleAudioTaskLabelValues ¶ added in v0.3.0
func PossibleAudioTaskLabelValues() []AudioTaskLabel
PossibleAudioTaskLabelValues returns the possible values for the AudioTaskLabel const type.
type AudioTranscription ¶ added in v0.3.0
type AudioTranscription struct { // REQUIRED; The transcribed text for the provided audio data. Text *string // The total duration of the audio processed to produce accompanying transcription information. Duration *float32 // The spoken language that was detected in the transcribed audio data. This is expressed as a two-letter ISO-639-1 language // code like 'en' or 'fr'. Language *string // A collection of information about the timing, probabilities, and other detail of each processed audio segment. Segments []AudioTranscriptionSegment // The label that describes which operation type generated the accompanying response data. Task *AudioTaskLabel // A collection of information about the timing of each processed word. Words []AudioTranscriptionWord }
AudioTranscription - Result information for an operation that transcribed spoken audio into written text.
func (AudioTranscription) MarshalJSON ¶ added in v0.3.0
func (a AudioTranscription) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AudioTranscription.
func (*AudioTranscription) UnmarshalJSON ¶ added in v0.3.0
func (a *AudioTranscription) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AudioTranscription.
type AudioTranscriptionFormat ¶ added in v0.3.0
type AudioTranscriptionFormat string
AudioTranscriptionFormat - Defines available options for the underlying response format of output transcription information.
const ( // AudioTranscriptionFormatJSON - Use a response body that is a JSON object containing a single 'text' field for the transcription. AudioTranscriptionFormatJSON AudioTranscriptionFormat = "json" // AudioTranscriptionFormatSrt - Use a response body that is plain text in SubRip (SRT) format that also includes timing information. AudioTranscriptionFormatSrt AudioTranscriptionFormat = "srt" // AudioTranscriptionFormatText - Use a response body that is plain text containing the raw, unannotated transcription. AudioTranscriptionFormatText AudioTranscriptionFormat = "text" // AudioTranscriptionFormatVerboseJSON - Use a response body that is a JSON object containing transcription text along with // timing, segments, and other // metadata. AudioTranscriptionFormatVerboseJSON AudioTranscriptionFormat = "verbose_json" // AudioTranscriptionFormatVtt - Use a response body that is plain text in Web Video Text Tracks (VTT) format that also includes // timing information. AudioTranscriptionFormatVtt AudioTranscriptionFormat = "vtt" )
func PossibleAudioTranscriptionFormatValues ¶ added in v0.3.0
func PossibleAudioTranscriptionFormatValues() []AudioTranscriptionFormat
PossibleAudioTranscriptionFormatValues returns the possible values for the AudioTranscriptionFormat const type.
type AudioTranscriptionOptions ¶ added in v0.3.0
type AudioTranscriptionOptions struct { // REQUIRED; The audio data to transcribe. This must be the binary content of a file in one of the supported media formats: // flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm. File []byte // The optional filename or descriptive identifier to associate with with the audio data. Filename *string // The primary spoken language of the audio data to be transcribed, supplied as a two-letter ISO-639-1 language code such // as 'en' or 'fr'. Providing this known input language is optional but may improve // the accuracy and/or latency of transcription. Language *string // The model to use for this transcription request. DeploymentName *string // An optional hint to guide the model's style or continue from a prior audio segment. The written language of the prompt // should match the primary spoken language of the audio data. Prompt *string // The requested format of the transcription response data, which will influence the content and detail of the result. ResponseFormat *AudioTranscriptionFormat // The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values // like 0.2 will make it more focused and deterministic. If set to 0, the model will // use log probability to automatically increase the temperature until certain thresholds are hit. Temperature *float32 // The timestamp granularities to populate for this transcription.response_format must be set verbose_json to use timestamp // granularities. Either or both of these options are supported: word, or segment. // Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency. TimestampGranularities []AudioTranscriptionTimestampGranularity }
AudioTranscriptionOptions - The configuration information for an audio transcription request.
func (AudioTranscriptionOptions) MarshalJSON ¶ added in v0.3.0
func (a AudioTranscriptionOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AudioTranscriptionOptions.
func (*AudioTranscriptionOptions) UnmarshalJSON ¶ added in v0.3.0
func (a *AudioTranscriptionOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AudioTranscriptionOptions.
type AudioTranscriptionSegment ¶ added in v0.3.0
type AudioTranscriptionSegment struct { // REQUIRED; The average log probability associated with this audio segment. AvgLogProb *float32 // REQUIRED; The compression ratio of this audio segment. CompressionRatio *float32 // REQUIRED; The time at which this segment ended relative to the beginning of the transcribed audio. End *float32 // REQUIRED; The 0-based index of this segment within a transcription. ID *int32 // REQUIRED; The probability of no speech detection within this audio segment. NoSpeechProb *float32 // REQUIRED; The seek position associated with the processing of this audio segment. Seek positions are expressed as hundredths // of seconds. The model may process several segments from a single seek position, so // while the seek position will never represent a later time than the segment's start, the segment's start may represent a // significantly later time than the segment's associated seek position. Seek *int32 // REQUIRED; The time at which this segment started relative to the beginning of the transcribed audio. Start *float32 // REQUIRED; The temperature score associated with this audio segment. Temperature *float32 // REQUIRED; The transcribed text that was part of this audio segment. Text *string // REQUIRED; The token IDs matching the transcribed text in this audio segment. Tokens []int32 }
AudioTranscriptionSegment - Extended information about a single segment of transcribed audio data. Segments generally represent roughly 5-10 seconds of speech. Segment boundaries typically occur between words but not necessarily sentences.
func (AudioTranscriptionSegment) MarshalJSON ¶ added in v0.3.0
func (a AudioTranscriptionSegment) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AudioTranscriptionSegment.
func (*AudioTranscriptionSegment) UnmarshalJSON ¶ added in v0.3.0
func (a *AudioTranscriptionSegment) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AudioTranscriptionSegment.
type AudioTranscriptionTimestampGranularity ¶ added in v0.6.0
type AudioTranscriptionTimestampGranularity string
AudioTranscriptionTimestampGranularity - Defines the timestamp granularities that can be requested on a verbose transcription response.
const ( // AudioTranscriptionTimestampGranularitySegment - Indicates that responses should include timing and other information about // each transcribed audio segment. Audio // segment timestamp information does not incur any additional latency. AudioTranscriptionTimestampGranularitySegment AudioTranscriptionTimestampGranularity = "segment" // AudioTranscriptionTimestampGranularityWord - Indicates that responses should include timing information about each transcribed // word. Note that generating word // timestamp information will incur additional response latency. AudioTranscriptionTimestampGranularityWord AudioTranscriptionTimestampGranularity = "word" )
func PossibleAudioTranscriptionTimestampGranularityValues ¶ added in v0.6.0
func PossibleAudioTranscriptionTimestampGranularityValues() []AudioTranscriptionTimestampGranularity
PossibleAudioTranscriptionTimestampGranularityValues returns the possible values for the AudioTranscriptionTimestampGranularity const type.
type AudioTranscriptionWord ¶ added in v0.6.0
type AudioTranscriptionWord struct { // REQUIRED; The end time of the word relative to the beginning of the audio, expressed in seconds. End *float32 // REQUIRED; The start time of the word relative to the beginning of the audio, expressed in seconds. Start *float32 // REQUIRED; The textual content of the word. Word *string }
AudioTranscriptionWord - Extended information about a single transcribed word, as provided on responses when the 'word' timestamp granularity is provided.
func (AudioTranscriptionWord) MarshalJSON ¶ added in v0.6.0
func (a AudioTranscriptionWord) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AudioTranscriptionWord.
func (*AudioTranscriptionWord) UnmarshalJSON ¶ added in v0.6.0
func (a *AudioTranscriptionWord) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AudioTranscriptionWord.
type AudioTranslation ¶ added in v0.3.0
type AudioTranslation struct { // REQUIRED; The translated text for the provided audio data. Text *string // The total duration of the audio processed to produce accompanying translation information. Duration *float32 // The spoken language that was detected in the translated audio data. This is expressed as a two-letter ISO-639-1 language // code like 'en' or 'fr'. Language *string // A collection of information about the timing, probabilities, and other detail of each processed audio segment. Segments []AudioTranslationSegment // The label that describes which operation type generated the accompanying response data. Task *AudioTaskLabel }
AudioTranslation - Result information for an operation that translated spoken audio into written text.
func (AudioTranslation) MarshalJSON ¶ added in v0.3.0
func (a AudioTranslation) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AudioTranslation.
func (*AudioTranslation) UnmarshalJSON ¶ added in v0.3.0
func (a *AudioTranslation) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AudioTranslation.
type AudioTranslationFormat ¶ added in v0.3.0
type AudioTranslationFormat string
AudioTranslationFormat - Defines available options for the underlying response format of output translation information.
const ( // AudioTranslationFormatJSON - Use a response body that is a JSON object containing a single 'text' field for the translation. AudioTranslationFormatJSON AudioTranslationFormat = "json" // AudioTranslationFormatSrt - Use a response body that is plain text in SubRip (SRT) format that also includes timing information. AudioTranslationFormatSrt AudioTranslationFormat = "srt" // AudioTranslationFormatText - Use a response body that is plain text containing the raw, unannotated translation. AudioTranslationFormatText AudioTranslationFormat = "text" // AudioTranslationFormatVerboseJSON - Use a response body that is a JSON object containing translation text along with timing, // segments, and other // metadata. AudioTranslationFormatVerboseJSON AudioTranslationFormat = "verbose_json" // AudioTranslationFormatVtt - Use a response body that is plain text in Web Video Text Tracks (VTT) format that also includes // timing information. AudioTranslationFormatVtt AudioTranslationFormat = "vtt" )
func PossibleAudioTranslationFormatValues ¶ added in v0.3.0
func PossibleAudioTranslationFormatValues() []AudioTranslationFormat
PossibleAudioTranslationFormatValues returns the possible values for the AudioTranslationFormat const type.
type AudioTranslationOptions ¶ added in v0.3.0
type AudioTranslationOptions struct { // REQUIRED; The audio data to translate. This must be the binary content of a file in one of the supported media formats: // flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm. File []byte // The optional filename or descriptive identifier to associate with with the audio data. Filename *string // The model to use for this translation request. DeploymentName *string // An optional hint to guide the model's style or continue from a prior audio segment. The written language of the prompt // should match the primary spoken language of the audio data. Prompt *string // The requested format of the translation response data, which will influence the content and detail of the result. ResponseFormat *AudioTranslationFormat // The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values // like 0.2 will make it more focused and deterministic. If set to 0, the model will // use log probability to automatically increase the temperature until certain thresholds are hit. Temperature *float32 }
AudioTranslationOptions - The configuration information for an audio translation request.
func (AudioTranslationOptions) MarshalJSON ¶ added in v0.3.0
func (a AudioTranslationOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AudioTranslationOptions.
func (*AudioTranslationOptions) UnmarshalJSON ¶ added in v0.3.0
func (a *AudioTranslationOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AudioTranslationOptions.
type AudioTranslationSegment ¶ added in v0.3.0
type AudioTranslationSegment struct { // REQUIRED; The average log probability associated with this audio segment. AvgLogProb *float32 // REQUIRED; The compression ratio of this audio segment. CompressionRatio *float32 // REQUIRED; The time at which this segment ended relative to the beginning of the translated audio. End *float32 // REQUIRED; The 0-based index of this segment within a translation. ID *int32 // REQUIRED; The probability of no speech detection within this audio segment. NoSpeechProb *float32 // REQUIRED; The seek position associated with the processing of this audio segment. Seek positions are expressed as hundredths // of seconds. The model may process several segments from a single seek position, so // while the seek position will never represent a later time than the segment's start, the segment's start may represent a // significantly later time than the segment's associated seek position. Seek *int32 // REQUIRED; The time at which this segment started relative to the beginning of the translated audio. Start *float32 // REQUIRED; The temperature score associated with this audio segment. Temperature *float32 // REQUIRED; The translated text that was part of this audio segment. Text *string // REQUIRED; The token IDs matching the translated text in this audio segment. Tokens []int32 }
AudioTranslationSegment - Extended information about a single segment of translated audio data. Segments generally represent roughly 5-10 seconds of speech. Segment boundaries typically occur between words but not necessarily sentences.
func (AudioTranslationSegment) MarshalJSON ¶ added in v0.3.0
func (a AudioTranslationSegment) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AudioTranslationSegment.
func (*AudioTranslationSegment) UnmarshalJSON ¶ added in v0.3.0
func (a *AudioTranslationSegment) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AudioTranslationSegment.
type AzureChatEnhancementConfiguration ¶ added in v0.4.0
type AzureChatEnhancementConfiguration struct { // A representation of the available options for the Azure OpenAI grounding enhancement. Grounding *AzureChatGroundingEnhancementConfiguration // A representation of the available options for the Azure OpenAI optical character recognition (OCR) enhancement. Ocr *AzureChatOCREnhancementConfiguration }
AzureChatEnhancementConfiguration - A representation of the available Azure OpenAI enhancement configurations.
func (AzureChatEnhancementConfiguration) MarshalJSON ¶ added in v0.4.0
func (a AzureChatEnhancementConfiguration) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureChatEnhancementConfiguration.
func (*AzureChatEnhancementConfiguration) UnmarshalJSON ¶ added in v0.4.0
func (a *AzureChatEnhancementConfiguration) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureChatEnhancementConfiguration.
type AzureChatEnhancements ¶ added in v0.4.0
type AzureChatEnhancements struct { // The grounding enhancement that returns the bounding box of the objects detected in the image. Grounding *AzureGroundingEnhancement }
AzureChatEnhancements - Represents the output results of Azure enhancements to chat completions, as configured via the matching input provided in the request.
func (AzureChatEnhancements) MarshalJSON ¶ added in v0.4.0
func (a AzureChatEnhancements) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureChatEnhancements.
func (*AzureChatEnhancements) UnmarshalJSON ¶ added in v0.4.0
func (a *AzureChatEnhancements) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureChatEnhancements.
type AzureChatExtensionConfiguration ¶ added in v0.2.0
type AzureChatExtensionConfiguration struct {
// contains filtered or unexported fields
}
AzureChatExtensionConfiguration - A representation of configuration data for a single Azure OpenAI chat extension. This will be used by a chat completions request that should use Azure OpenAI chat extensions to augment the response behavior. The use of this configuration is compatible only with Azure OpenAI.
func (*AzureChatExtensionConfiguration) GetAzureChatExtensionConfiguration ¶ added in v0.4.0
func (a *AzureChatExtensionConfiguration) GetAzureChatExtensionConfiguration() *AzureChatExtensionConfiguration
GetAzureChatExtensionConfiguration implements the AzureChatExtensionConfigurationClassification interface for type AzureChatExtensionConfiguration.
func (AzureChatExtensionConfiguration) MarshalJSON ¶ added in v0.2.0
func (a AzureChatExtensionConfiguration) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureChatExtensionConfiguration.
func (*AzureChatExtensionConfiguration) UnmarshalJSON ¶ added in v0.2.0
func (a *AzureChatExtensionConfiguration) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureChatExtensionConfiguration.
type AzureChatExtensionConfigurationClassification ¶ added in v0.4.0
type AzureChatExtensionConfigurationClassification interface { // GetAzureChatExtensionConfiguration returns the AzureChatExtensionConfiguration content of the underlying type. GetAzureChatExtensionConfiguration() *AzureChatExtensionConfiguration }
AzureChatExtensionConfigurationClassification provides polymorphic access to related types. Call the interface's GetAzureChatExtensionConfiguration() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *AzureChatExtensionConfiguration, *AzureCosmosDBChatExtensionConfiguration, *AzureSearchChatExtensionConfiguration, *ElasticsearchChatExtensionConfiguration, - *MongoDBChatExtensionConfiguration, *PineconeChatExtensionConfiguration
type AzureChatExtensionDataSourceResponseCitation ¶ added in v0.5.0
type AzureChatExtensionDataSourceResponseCitation struct { // REQUIRED; The content of the citation. Content *string // The chunk ID of the citation. ChunkID *string // The file path of the citation. FilePath *string // The rerank score of the retrieved document. RerankScore *float64 // The title of the citation. Title *string // The URL of the citation. URL *string }
AzureChatExtensionDataSourceResponseCitation - A single instance of additional context information available when Azure OpenAI chat extensions are involved in the generation of a corresponding chat completions response. This context information is only populated when using an Azure OpenAI request configured to use a matching extension.
func (AzureChatExtensionDataSourceResponseCitation) MarshalJSON ¶ added in v0.5.0
func (a AzureChatExtensionDataSourceResponseCitation) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureChatExtensionDataSourceResponseCitation.
func (*AzureChatExtensionDataSourceResponseCitation) UnmarshalJSON ¶ added in v0.5.0
func (a *AzureChatExtensionDataSourceResponseCitation) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureChatExtensionDataSourceResponseCitation.
type AzureChatExtensionOptions ¶ added in v0.2.0
type AzureChatExtensionOptions struct { // Extensions is a slice of extensions to the chat completions endpoint, like Azure Cognitive Search. Extensions []AzureChatExtensionConfiguration }
AzureChatExtensionOptions provides Azure specific options to extend ChatCompletions.
type AzureChatExtensionRetrieveDocumentFilterReason ¶ added in v0.6.0
type AzureChatExtensionRetrieveDocumentFilterReason string
AzureChatExtensionRetrieveDocumentFilterReason - The reason for filtering the retrieved document.
const ( // AzureChatExtensionRetrieveDocumentFilterReasonRerank - The document is not filtered by original search score threshold, // but is filtered by rerank score and `top_n_documents` configure. AzureChatExtensionRetrieveDocumentFilterReasonRerank AzureChatExtensionRetrieveDocumentFilterReason = "rerank" // AzureChatExtensionRetrieveDocumentFilterReasonScore - The document is filtered by original search score threshold defined // by `strictness` configure. AzureChatExtensionRetrieveDocumentFilterReasonScore AzureChatExtensionRetrieveDocumentFilterReason = "score" )
func PossibleAzureChatExtensionRetrieveDocumentFilterReasonValues ¶ added in v0.6.0
func PossibleAzureChatExtensionRetrieveDocumentFilterReasonValues() []AzureChatExtensionRetrieveDocumentFilterReason
PossibleAzureChatExtensionRetrieveDocumentFilterReasonValues returns the possible values for the AzureChatExtensionRetrieveDocumentFilterReason const type.
type AzureChatExtensionRetrievedDocument ¶ added in v0.6.0
type AzureChatExtensionRetrievedDocument struct { // REQUIRED; The content of the citation. Content *string // REQUIRED; The index of the data source. DataSourceIndex *int32 // REQUIRED; The search queries used to retrieve the document. SearchQueries []string // The chunk ID of the citation. ChunkID *string // The file path of the citation. FilePath *string // Represents the rationale for filtering the document. If the document does not undergo filtering, this field will remain // unset. FilterReason *AzureChatExtensionRetrieveDocumentFilterReason // The original search score of the retrieved document. OriginalSearchScore *float64 // The rerank score of the retrieved document. RerankScore *float64 // The title of the citation. Title *string // The URL of the citation. URL *string }
AzureChatExtensionRetrievedDocument - The retrieved document.
func (AzureChatExtensionRetrievedDocument) MarshalJSON ¶ added in v0.6.0
func (a AzureChatExtensionRetrievedDocument) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureChatExtensionRetrievedDocument.
func (*AzureChatExtensionRetrievedDocument) UnmarshalJSON ¶ added in v0.6.0
func (a *AzureChatExtensionRetrievedDocument) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureChatExtensionRetrievedDocument.
type AzureChatExtensionType ¶ added in v0.2.0
type AzureChatExtensionType string
AzureChatExtensionType - A representation of configuration data for a single Azure OpenAI chat extension. This will be used by a chat completions request that should use Azure OpenAI chat extensions to augment the response behavior. The use of this configuration is compatible only with Azure OpenAI.
const ( // AzureChatExtensionTypeAzureCosmosDB - Represents the use of Azure Cosmos DB as an Azure OpenAI chat extension. AzureChatExtensionTypeAzureCosmosDB AzureChatExtensionType = "azure_cosmos_db" // AzureChatExtensionTypeAzureSearch - Represents the use of Azure AI Search as an Azure OpenAI chat extension. AzureChatExtensionTypeAzureSearch AzureChatExtensionType = "azure_search" // AzureChatExtensionTypeElasticsearch - Represents the use of Elasticsearch® index as an Azure OpenAI chat extension. AzureChatExtensionTypeElasticsearch AzureChatExtensionType = "elasticsearch" // AzureChatExtensionTypeMongoDB - Represents the use of a MongoDB chat extension. AzureChatExtensionTypeMongoDB AzureChatExtensionType = "mongo_db" // AzureChatExtensionTypePinecone - Represents the use of Pinecone index as an Azure OpenAI chat extension. AzureChatExtensionTypePinecone AzureChatExtensionType = "pinecone" )
func PossibleAzureChatExtensionTypeValues ¶ added in v0.2.0
func PossibleAzureChatExtensionTypeValues() []AzureChatExtensionType
PossibleAzureChatExtensionTypeValues returns the possible values for the AzureChatExtensionType const type.
type AzureChatExtensionsMessageContext ¶ added in v0.2.0
type AzureChatExtensionsMessageContext struct { // All the retrieved documents. AllRetrievedDocuments []AzureChatExtensionRetrievedDocument // The contextual information associated with the Azure chat extensions used for a chat completions request. These messages // describe the data source retrievals, plugin invocations, and other intermediate // steps taken in the course of generating a chat completions response that was augmented by capabilities from Azure OpenAI // chat extensions. Citations []AzureChatExtensionDataSourceResponseCitation // The detected intent from the chat history, used to pass to the next turn to carry over the context. Intent *string }
AzureChatExtensionsMessageContext - A representation of the additional context information available when Azure OpenAI chat extensions are involved in the generation of a corresponding chat completions response. This context information is only populated when using an Azure OpenAI request configured to use a matching extension.
func (AzureChatExtensionsMessageContext) MarshalJSON ¶ added in v0.2.0
func (a AzureChatExtensionsMessageContext) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureChatExtensionsMessageContext.
func (*AzureChatExtensionsMessageContext) UnmarshalJSON ¶ added in v0.2.0
func (a *AzureChatExtensionsMessageContext) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureChatExtensionsMessageContext.
type AzureChatGroundingEnhancementConfiguration ¶ added in v0.4.0
type AzureChatGroundingEnhancementConfiguration struct { // REQUIRED; Specifies whether the enhancement is enabled. Enabled *bool }
AzureChatGroundingEnhancementConfiguration - A representation of the available options for the Azure OpenAI grounding enhancement.
func (AzureChatGroundingEnhancementConfiguration) MarshalJSON ¶ added in v0.4.0
func (a AzureChatGroundingEnhancementConfiguration) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureChatGroundingEnhancementConfiguration.
func (*AzureChatGroundingEnhancementConfiguration) UnmarshalJSON ¶ added in v0.4.0
func (a *AzureChatGroundingEnhancementConfiguration) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureChatGroundingEnhancementConfiguration.
type AzureChatOCREnhancementConfiguration ¶ added in v0.4.0
type AzureChatOCREnhancementConfiguration struct { // REQUIRED; Specifies whether the enhancement is enabled. Enabled *bool }
AzureChatOCREnhancementConfiguration - A representation of the available options for the Azure OpenAI optical character recognition (OCR) enhancement.
func (AzureChatOCREnhancementConfiguration) MarshalJSON ¶ added in v0.4.0
func (a AzureChatOCREnhancementConfiguration) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureChatOCREnhancementConfiguration.
func (*AzureChatOCREnhancementConfiguration) UnmarshalJSON ¶ added in v0.4.0
func (a *AzureChatOCREnhancementConfiguration) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureChatOCREnhancementConfiguration.
type AzureCosmosDBChatExtensionConfiguration ¶ added in v0.4.0
type AzureCosmosDBChatExtensionConfiguration struct { // REQUIRED; The parameters to use when configuring Azure OpenAI CosmosDB chat extensions. Parameters *AzureCosmosDBChatExtensionParameters // contains filtered or unexported fields }
AzureCosmosDBChatExtensionConfiguration - A specific representation of configurable options for Azure Cosmos DB when using it as an Azure OpenAI chat extension.
func (*AzureCosmosDBChatExtensionConfiguration) GetAzureChatExtensionConfiguration ¶ added in v0.4.0
func (a *AzureCosmosDBChatExtensionConfiguration) GetAzureChatExtensionConfiguration() *AzureChatExtensionConfiguration
GetAzureChatExtensionConfiguration implements the AzureChatExtensionConfigurationClassification interface for type AzureCosmosDBChatExtensionConfiguration.
func (AzureCosmosDBChatExtensionConfiguration) MarshalJSON ¶ added in v0.4.0
func (a AzureCosmosDBChatExtensionConfiguration) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureCosmosDBChatExtensionConfiguration.
func (*AzureCosmosDBChatExtensionConfiguration) UnmarshalJSON ¶ added in v0.4.0
func (a *AzureCosmosDBChatExtensionConfiguration) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureCosmosDBChatExtensionConfiguration.
type AzureCosmosDBChatExtensionParameters ¶ added in v0.4.0
type AzureCosmosDBChatExtensionParameters struct { // REQUIRED; The name of the Azure Cosmos DB resource container. ContainerName *string // REQUIRED; The MongoDB vCore database name to use with Azure Cosmos DB. DatabaseName *string // REQUIRED; The embedding dependency for vector search. EmbeddingDependency OnYourDataVectorizationSourceClassification // REQUIRED; Customized field mapping behavior to use when interacting with the search index. FieldsMapping *AzureCosmosDBFieldMappingOptions // REQUIRED; The MongoDB vCore index name to use with Azure Cosmos DB. IndexName *string // If specified as true, the system will allow partial search results to be used and the request fails if all the queries // fail. If not specified, or specified as false, the request will fail if any // search query fails. AllowPartialResult *bool // The authentication method to use when accessing the defined data source. Each data source type supports a specific set // of available authentication methods; please see the documentation of the data // source for supported mechanisms. If not otherwise provided, On Your Data will attempt to use System Managed Identity (default // credential) authentication. Authentication OnYourDataAuthenticationOptionsClassification // Whether queries should be restricted to use of indexed data. InScope *bool // The included properties of the output context. If not specified, the default value is citations and intent. IncludeContexts []OnYourDataContextProperty // The max number of rewritten queries should be send to search provider for one user message. If not specified, the system // will decide the number of queries to send. MaxSearchQueries *int32 // The configured strictness of the search relevance filtering. The higher of strictness, the higher of the precision but // lower recall of the answer. Strictness *int32 // The configured top number of documents to feature for the configured query. TopNDocuments *int32 }
AzureCosmosDBChatExtensionParameters - Parameters to use when configuring Azure OpenAI On Your Data chat extensions when using Azure Cosmos DB for MongoDB vCore. The supported authentication type is ConnectionString.
func (AzureCosmosDBChatExtensionParameters) MarshalJSON ¶ added in v0.4.0
func (a AzureCosmosDBChatExtensionParameters) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureCosmosDBChatExtensionParameters.
func (*AzureCosmosDBChatExtensionParameters) UnmarshalJSON ¶ added in v0.4.0
func (a *AzureCosmosDBChatExtensionParameters) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureCosmosDBChatExtensionParameters.
type AzureCosmosDBFieldMappingOptions ¶ added in v0.4.0
type AzureCosmosDBFieldMappingOptions struct { // REQUIRED; The names of index fields that should be treated as content. ContentFields []string // REQUIRED; The names of fields that represent vector data. VectorFields []string // The separator pattern that content fields should use. ContentFieldsSeparator *string // The name of the index field to use as a filepath. FilePathField *string // The name of the index field to use as a title. TitleField *string // The name of the index field to use as a URL. URLField *string }
AzureCosmosDBFieldMappingOptions - Optional settings to control how fields are processed when using a configured Azure Cosmos DB resource.
func (AzureCosmosDBFieldMappingOptions) MarshalJSON ¶ added in v0.4.0
func (a AzureCosmosDBFieldMappingOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureCosmosDBFieldMappingOptions.
func (*AzureCosmosDBFieldMappingOptions) UnmarshalJSON ¶ added in v0.4.0
func (a *AzureCosmosDBFieldMappingOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureCosmosDBFieldMappingOptions.
type AzureGroundingEnhancement ¶ added in v0.4.0
type AzureGroundingEnhancement struct { // REQUIRED; The lines of text detected by the grounding enhancement. Lines []AzureGroundingEnhancementLine }
AzureGroundingEnhancement - The grounding enhancement that returns the bounding box of the objects detected in the image.
func (AzureGroundingEnhancement) MarshalJSON ¶ added in v0.4.0
func (a AzureGroundingEnhancement) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureGroundingEnhancement.
func (*AzureGroundingEnhancement) UnmarshalJSON ¶ added in v0.4.0
func (a *AzureGroundingEnhancement) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureGroundingEnhancement.
type AzureGroundingEnhancementCoordinatePoint ¶ added in v0.4.0
type AzureGroundingEnhancementCoordinatePoint struct { // REQUIRED; The x-coordinate (horizontal axis) of the point. X *float32 // REQUIRED; The y-coordinate (vertical axis) of the point. Y *float32 }
AzureGroundingEnhancementCoordinatePoint - A representation of a single polygon point as used by the Azure grounding enhancement.
func (AzureGroundingEnhancementCoordinatePoint) MarshalJSON ¶ added in v0.4.0
func (a AzureGroundingEnhancementCoordinatePoint) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureGroundingEnhancementCoordinatePoint.
func (*AzureGroundingEnhancementCoordinatePoint) UnmarshalJSON ¶ added in v0.4.0
func (a *AzureGroundingEnhancementCoordinatePoint) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureGroundingEnhancementCoordinatePoint.
type AzureGroundingEnhancementLine ¶ added in v0.4.0
type AzureGroundingEnhancementLine struct { // REQUIRED; An array of spans that represent detected objects and its bounding box information. Spans []AzureGroundingEnhancementLineSpan // REQUIRED; The text within the line. Text *string }
AzureGroundingEnhancementLine - A content line object consisting of an adjacent sequence of content elements, such as words and selection marks.
func (AzureGroundingEnhancementLine) MarshalJSON ¶ added in v0.4.0
func (a AzureGroundingEnhancementLine) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureGroundingEnhancementLine.
func (*AzureGroundingEnhancementLine) UnmarshalJSON ¶ added in v0.4.0
func (a *AzureGroundingEnhancementLine) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureGroundingEnhancementLine.
type AzureGroundingEnhancementLineSpan ¶ added in v0.4.0
type AzureGroundingEnhancementLineSpan struct { // REQUIRED; The length of the span in characters, measured in Unicode codepoints. Length *int32 // REQUIRED; The character offset within the text where the span begins. This offset is defined as the position of the first // character of the span, counting from the start of the text as Unicode codepoints. Offset *int32 // REQUIRED; An array of objects representing points in the polygon that encloses the detected object. Polygon []AzureGroundingEnhancementCoordinatePoint // REQUIRED; The text content of the span that represents the detected object. Text *string }
AzureGroundingEnhancementLineSpan - A span object that represents a detected object and its bounding box information.
func (AzureGroundingEnhancementLineSpan) MarshalJSON ¶ added in v0.4.0
func (a AzureGroundingEnhancementLineSpan) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureGroundingEnhancementLineSpan.
func (*AzureGroundingEnhancementLineSpan) UnmarshalJSON ¶ added in v0.4.0
func (a *AzureGroundingEnhancementLineSpan) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureGroundingEnhancementLineSpan.
type AzureSearchChatExtensionConfiguration ¶ added in v0.5.0
type AzureSearchChatExtensionConfiguration struct { // REQUIRED; The parameters to use when configuring Azure Search. Parameters *AzureSearchChatExtensionParameters // contains filtered or unexported fields }
AzureSearchChatExtensionConfiguration - A specific representation of configurable options for Azure Search when using it as an Azure OpenAI chat extension.
func (*AzureSearchChatExtensionConfiguration) GetAzureChatExtensionConfiguration ¶ added in v0.5.0
func (a *AzureSearchChatExtensionConfiguration) GetAzureChatExtensionConfiguration() *AzureChatExtensionConfiguration
GetAzureChatExtensionConfiguration implements the AzureChatExtensionConfigurationClassification interface for type AzureSearchChatExtensionConfiguration.
func (AzureSearchChatExtensionConfiguration) MarshalJSON ¶ added in v0.5.0
func (a AzureSearchChatExtensionConfiguration) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureSearchChatExtensionConfiguration.
func (*AzureSearchChatExtensionConfiguration) UnmarshalJSON ¶ added in v0.5.0
func (a *AzureSearchChatExtensionConfiguration) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureSearchChatExtensionConfiguration.
type AzureSearchChatExtensionParameters ¶ added in v0.5.0
type AzureSearchChatExtensionParameters struct { // REQUIRED; The absolute endpoint path for the Azure Cognitive Search resource to use. Endpoint *string // REQUIRED; The name of the index to use as available in the referenced Azure Cognitive Search resource. IndexName *string // If specified as true, the system will allow partial search results to be used and the request fails if all the queries // fail. If not specified, or specified as false, the request will fail if any // search query fails. AllowPartialResult *bool // The authentication method to use when accessing the defined data source. Each data source type supports a specific set // of available authentication methods; please see the documentation of the data // source for supported mechanisms. If not otherwise provided, On Your Data will attempt to use System Managed Identity (default // credential) authentication. Authentication OnYourDataAuthenticationOptionsClassification // The embedding dependency for vector search. EmbeddingDependency OnYourDataVectorizationSourceClassification // Customized field mapping behavior to use when interacting with the search index. FieldsMapping *AzureSearchIndexFieldMappingOptions // Search filter. Filter *string // Whether queries should be restricted to use of indexed data. InScope *bool // The included properties of the output context. If not specified, the default value is citations and intent. IncludeContexts []OnYourDataContextProperty // The max number of rewritten queries should be send to search provider for one user message. If not specified, the system // will decide the number of queries to send. MaxSearchQueries *int32 // The query type to use with Azure Cognitive Search. QueryType *AzureSearchQueryType // The additional semantic configuration for the query. SemanticConfiguration *string // The configured strictness of the search relevance filtering. The higher of strictness, the higher of the precision but // lower recall of the answer. Strictness *int32 // The configured top number of documents to feature for the configured query. TopNDocuments *int32 }
AzureSearchChatExtensionParameters - Parameters for Azure Cognitive Search when used as an Azure OpenAI chat extension. The supported authentication types are APIKey, SystemAssignedManagedIdentity and UserAssignedManagedIdentity.
func (AzureSearchChatExtensionParameters) MarshalJSON ¶ added in v0.5.0
func (a AzureSearchChatExtensionParameters) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureSearchChatExtensionParameters.
func (*AzureSearchChatExtensionParameters) UnmarshalJSON ¶ added in v0.5.0
func (a *AzureSearchChatExtensionParameters) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureSearchChatExtensionParameters.
type AzureSearchIndexFieldMappingOptions ¶ added in v0.5.0
type AzureSearchIndexFieldMappingOptions struct { // The names of index fields that should be treated as content. ContentFields []string // The separator pattern that content fields should use. ContentFieldsSeparator *string // The name of the index field to use as a filepath. FilePathField *string // The names of fields that represent image vector data. ImageVectorFields []string // The name of the index field to use as a title. TitleField *string // The name of the index field to use as a URL. URLField *string // The names of fields that represent vector data. VectorFields []string }
AzureSearchIndexFieldMappingOptions - Optional settings to control how fields are processed when using a configured Azure Search resource.
func (AzureSearchIndexFieldMappingOptions) MarshalJSON ¶ added in v0.5.0
func (a AzureSearchIndexFieldMappingOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AzureSearchIndexFieldMappingOptions.
func (*AzureSearchIndexFieldMappingOptions) UnmarshalJSON ¶ added in v0.5.0
func (a *AzureSearchIndexFieldMappingOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AzureSearchIndexFieldMappingOptions.
type AzureSearchQueryType ¶ added in v0.5.0
type AzureSearchQueryType string
AzureSearchQueryType - The type of Azure Search retrieval query that should be executed when using it as an Azure OpenAI chat extension.
const ( // AzureSearchQueryTypeSemantic - Represents the semantic query parser for advanced semantic modeling. AzureSearchQueryTypeSemantic AzureSearchQueryType = "semantic" // AzureSearchQueryTypeSimple - Represents the default, simple query parser. AzureSearchQueryTypeSimple AzureSearchQueryType = "simple" // AzureSearchQueryTypeVector - Represents vector search over computed data. AzureSearchQueryTypeVector AzureSearchQueryType = "vector" // AzureSearchQueryTypeVectorSemanticHybrid - Represents a combination of semantic search and vector data querying. AzureSearchQueryTypeVectorSemanticHybrid AzureSearchQueryType = "vector_semantic_hybrid" // AzureSearchQueryTypeVectorSimpleHybrid - Represents a combination of the simple query strategy with vector data. AzureSearchQueryTypeVectorSimpleHybrid AzureSearchQueryType = "vector_simple_hybrid" )
func PossibleAzureSearchQueryTypeValues ¶ added in v0.5.0
func PossibleAzureSearchQueryTypeValues() []AzureSearchQueryType
PossibleAzureSearchQueryTypeValues returns the possible values for the AzureSearchQueryType const type.
type Batch ¶ added in v0.6.2
type Batch struct { // REQUIRED; The id assigned to the Batch. ID *string // REQUIRED; The ID of the input file for the batch. InputFileID *string // REQUIRED; The object type, which is always batch. Object *string // The Unix timestamp (in seconds) for when the batch was cancelled. CancelledAt *time.Time // The Unix timestamp (in seconds) for when the batch started cancelling. CancellingAt *time.Time // The Unix timestamp (in seconds) for when the batch was completed. CompletedAt *time.Time // The time frame within which the batch should be processed. CompletionWindow *string // The Unix timestamp (in seconds) for when the batch was created. CreatedAt *time.Time // The OpenAI API endpoint used by the batch. Endpoint *string // The ID of the file containing the outputs of requests with errors. ErrorFileID *string // The list of Batch errors. Errors *BatchErrorList // The Unix timestamp (in seconds) for when the batch expired. ExpiredAt *time.Time // The Unix timestamp (in seconds) for when the batch will expire. ExpiresAt *time.Time // The Unix timestamp (in seconds) for when the batch failed. FailedAt *time.Time // The Unix timestamp (in seconds) for when the batch started finalizing. FinalizingAt *time.Time // The Unix timestamp (in seconds) for when the batch started processing. InProgressAt *time.Time // A set of key-value pairs that can be attached to the batch. This can be useful for storing additional information about // the batch in a structured format. Metadata map[string]*string // The ID of the file containing the outputs of successfully executed requests. OutputFileID *string // The request counts for different statuses within the batch. RequestCounts *BatchRequestCounts // The current status of the batch. Status *BatchStatus }
Batch - The Batch object.
func (Batch) MarshalJSON ¶ added in v0.6.2
MarshalJSON implements the json.Marshaller interface for type Batch.
func (*Batch) UnmarshalJSON ¶ added in v0.6.2
UnmarshalJSON implements the json.Unmarshaller interface for type Batch.
type BatchCreateRequest ¶ added in v0.6.2
type BatchCreateRequest struct { // REQUIRED; The time frame within which the batch should be processed. CompletionWindow *string // REQUIRED; The API endpoint used by the batch. Endpoint *string // REQUIRED; The ID of the input file for the batch. InputFileID *string // A set of key-value pairs that can be attached to the batch. This can be useful for storing additional information about // the batch in a structured format. Metadata map[string]*string }
BatchCreateRequest - Defines the request to create a batch.
func (BatchCreateRequest) MarshalJSON ¶ added in v0.6.2
func (b BatchCreateRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BatchCreateRequest.
func (*BatchCreateRequest) UnmarshalJSON ¶ added in v0.6.2
func (b *BatchCreateRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BatchCreateRequest.
type BatchCreateResponseRequestCounts ¶ added in v0.6.2
type BatchCreateResponseRequestCounts struct { // Number of requests that have been completed successfully. Completed *int32 // Number of requests that have failed. Failed *int32 // Total number of requests in the batch. Total *int32 }
BatchCreateResponseRequestCounts - The request counts for different statuses within the batch.
func (BatchCreateResponseRequestCounts) MarshalJSON ¶ added in v0.6.2
func (b BatchCreateResponseRequestCounts) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BatchCreateResponseRequestCounts.
func (*BatchCreateResponseRequestCounts) UnmarshalJSON ¶ added in v0.6.2
func (b *BatchCreateResponseRequestCounts) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BatchCreateResponseRequestCounts.
type BatchErrorDatum ¶ added in v0.6.2
type BatchErrorDatum struct { // An error code identifying the error type. Code *string // The line number of the input file where the error occurred, if applicable. Line *int32 // A human-readable message providing more details about the error. Message *string // The name of the parameter that caused the error, if applicable. Param *string }
BatchErrorDatum - A Datum containing information about a Batch Error.
func (BatchErrorDatum) MarshalJSON ¶ added in v0.6.2
func (b BatchErrorDatum) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BatchErrorDatum.
func (*BatchErrorDatum) UnmarshalJSON ¶ added in v0.6.2
func (b *BatchErrorDatum) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BatchErrorDatum.
type BatchErrorList ¶ added in v0.6.2
type BatchErrorList struct { // REQUIRED; The object type, which is always list. Object *string // The list of Batch error data. Data []BatchErrorDatum }
BatchErrorList - A list of Batch errors.
func (BatchErrorList) MarshalJSON ¶ added in v0.6.2
func (b BatchErrorList) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BatchErrorList.
func (*BatchErrorList) UnmarshalJSON ¶ added in v0.6.2
func (b *BatchErrorList) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BatchErrorList.
type BatchRequestCounts ¶ added in v0.6.2
type BatchRequestCounts struct { // Number of requests that have been completed successfully. Completed *int32 // Number of requests that have failed. Failed *int32 // Total number of requests in the batch. Total *int32 }
BatchRequestCounts - The request counts for different statuses within the batch.
func (BatchRequestCounts) MarshalJSON ¶ added in v0.6.2
func (b BatchRequestCounts) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BatchRequestCounts.
func (*BatchRequestCounts) UnmarshalJSON ¶ added in v0.6.2
func (b *BatchRequestCounts) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BatchRequestCounts.
type BatchRequestInput ¶ added in v0.6.2
type BatchRequestInput struct { // A developer-provided per-request id that will be used to match outputs to inputs. Must be unique for each request in a // batch. CustomID *string // The HTTP method to be used for the request. Currently only POST is supported. Method *string // The OpenAI API relative URL to be used for the request. Currently /v1/chat/completions, /v1/embeddings, and /v1/completions // are supported. URL *string }
BatchRequestInput - The per-line object of the batch input file
func (BatchRequestInput) MarshalJSON ¶ added in v0.6.2
func (b BatchRequestInput) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BatchRequestInput.
func (*BatchRequestInput) UnmarshalJSON ¶ added in v0.6.2
func (b *BatchRequestInput) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BatchRequestInput.
type BatchRequestOutput ¶ added in v0.6.2
type BatchRequestOutput struct { // A developer-provided per-request id that will be used to match outputs to inputs. CustomID *string // For requests that failed with a non-HTTP error, this will contain more information on the cause of the failure. Error *BatchRequestOutputError // The Id of the request. ID *string // The http response Response *BatchRequestOutputResponse }
BatchRequestOutput - The per-line object of the batch output and error files
func (BatchRequestOutput) MarshalJSON ¶ added in v0.6.2
func (b BatchRequestOutput) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BatchRequestOutput.
func (*BatchRequestOutput) UnmarshalJSON ¶ added in v0.6.2
func (b *BatchRequestOutput) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BatchRequestOutput.
type BatchRequestOutputError ¶ added in v0.6.2
type BatchRequestOutputError struct { // A machine-readable error code. Code *string // A human-readable error message. Message *string }
BatchRequestOutputError - For requests that failed with a non-HTTP error, this will contain more information on the cause of the failure.
func (BatchRequestOutputError) MarshalJSON ¶ added in v0.6.2
func (b BatchRequestOutputError) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BatchRequestOutputError.
func (*BatchRequestOutputError) UnmarshalJSON ¶ added in v0.6.2
func (b *BatchRequestOutputError) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BatchRequestOutputError.
type BatchRequestOutputResponse ¶ added in v0.6.2
type BatchRequestOutputResponse struct { // The JSON body of the response Body map[string]*string // An unique identifier for the OpenAI API request. Please include this request ID when contacting support. RequestID *string // The HTTP status code of the response StatusCode *int32 }
BatchRequestOutputResponse - The http response
func (BatchRequestOutputResponse) MarshalJSON ¶ added in v0.6.2
func (b BatchRequestOutputResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BatchRequestOutputResponse.
func (*BatchRequestOutputResponse) UnmarshalJSON ¶ added in v0.6.2
func (b *BatchRequestOutputResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BatchRequestOutputResponse.
type BatchStatus ¶ added in v0.6.2
type BatchStatus string
BatchStatus - The status of a batch.
const ( // BatchStatusCancelled - The batch was cancelled. BatchStatusCancelled BatchStatus = "cancelled" // BatchStatusCancelling - Cancellation of the batch has been initiated. BatchStatusCancelling BatchStatus = "cancelling" // BatchStatusCompleted - The batch has been completed and the results are ready. BatchStatusCompleted BatchStatus = "completed" // BatchStatusExpired - The batch was not able to complete within the 24-hour time window. BatchStatusExpired BatchStatus = "expired" // BatchStatusFailed - The input file has failed the validation process. BatchStatusFailed BatchStatus = "failed" // BatchStatusFinalizing - The batch has completed and the results are being prepared. BatchStatusFinalizing BatchStatus = "finalizing" // BatchStatusInProgress - The input file was successfully validated and the batch is currently being executed. BatchStatusInProgress BatchStatus = "in_progress" // BatchStatusValidating - The input file is being validated before the batch can begin. BatchStatusValidating BatchStatus = "validating" )
func PossibleBatchStatusValues ¶ added in v0.6.2
func PossibleBatchStatusValues() []BatchStatus
PossibleBatchStatusValues returns the possible values for the BatchStatus const type.
type CancelBatchOptions ¶ added in v0.6.2
type CancelBatchOptions struct { }
CancelBatchOptions contains the optional parameters for the Client.CancelBatch method.
type CancelBatchResponse ¶ added in v0.6.2
type CancelBatchResponse struct { // The Batch object. Batch }
CancelBatchResponse contains the response from method Client.CancelBatch.
type CancelUploadOptions ¶ added in v0.7.0
type CancelUploadOptions struct { }
CancelUploadOptions contains the optional parameters for the Client.CancelUpload method.
type CancelUploadResponse ¶ added in v0.7.0
type CancelUploadResponse struct { // The Upload object can accept byte chunks in the form of Parts. Upload }
CancelUploadResponse contains the response from method Client.CancelUpload.
type ChatChoice ¶
type ChatChoice struct { // REQUIRED; The reason that this chat completions choice completed its generated. FinishReason *CompletionsFinishReason // REQUIRED; The ordered index associated with this chat completions choice. Index *int32 // REQUIRED; The log probability information for this choice, as enabled via the 'logprobs' request option. LogProbs *ChatChoiceLogProbs // Information about the content filtering category (hate, sexual, violence, selfharm), if it has been detected, as well as // the severity level (verylow, low, medium, high-scale that determines the // intensity and risk level of harmful content) and if it has been filtered or not. ContentFilterResults *ContentFilterResultsForChoice // The delta message content for a streaming response. Delta *ChatResponseMessage // Represents the output results of Azure OpenAI enhancements to chat completions, as configured via the matching input provided // in the request. This supplementary information is only available when // using Azure OpenAI and only when the request is configured to use enhancements. Enhancements *AzureChatEnhancements // The chat message for a given chat completions prompt. Message *ChatResponseMessage }
ChatChoice - The representation of a single prompt completion as part of an overall chat completions request. Generally, n choices are generated per provided prompt with a default value of 1. Token limits and other settings may limit the number of choices generated.
func (ChatChoice) MarshalJSON ¶
func (c ChatChoice) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatChoice.
func (*ChatChoice) UnmarshalJSON ¶
func (c *ChatChoice) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatChoice.
type ChatChoiceLogProbabilityInfo ¶ added in v0.5.0
type ChatChoiceLogProbabilityInfo struct { // REQUIRED; The list of log probability information entries for the choice's message content tokens, as requested via the // 'logprobs' option. Content []ChatTokenLogProbabilityResult // REQUIRED; The list of log probability information entries for the choice's message refusal message tokens, as requested // via the 'logprobs' option. Refusal []ChatTokenLogProbabilityResult }
ChatChoiceLogProbabilityInfo - Log probability information for a choice, as requested via 'logprobs' and 'top_logprobs'.
func (ChatChoiceLogProbabilityInfo) MarshalJSON ¶ added in v0.5.0
func (c ChatChoiceLogProbabilityInfo) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatChoiceLogProbabilityInfo.
func (*ChatChoiceLogProbabilityInfo) UnmarshalJSON ¶ added in v0.5.0
func (c *ChatChoiceLogProbabilityInfo) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatChoiceLogProbabilityInfo.
type ChatChoiceLogProbs ¶ added in v0.5.0
type ChatChoiceLogProbs struct { // REQUIRED; The list of log probability information entries for the choice's message content tokens, as requested via the // 'logprobs' option. Content []ChatTokenLogProbabilityResult // REQUIRED; The list of log probability information entries for the choice's message refusal message tokens, as requested // via the 'logprobs' option. Refusal []ChatTokenLogProbabilityResult }
ChatChoiceLogProbs - The log probability information for this choice, as enabled via the 'logprobs' request option.
func (ChatChoiceLogProbs) MarshalJSON ¶ added in v0.5.0
func (c ChatChoiceLogProbs) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatChoiceLogProbs.
func (*ChatChoiceLogProbs) UnmarshalJSON ¶ added in v0.5.0
func (c *ChatChoiceLogProbs) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatChoiceLogProbs.
type ChatCompletionRequestMessageContentPart ¶ added in v0.4.0
type ChatCompletionRequestMessageContentPart struct {
// contains filtered or unexported fields
}
ChatCompletionRequestMessageContentPart - represents either an image URL or text content for a prompt
func (*ChatCompletionRequestMessageContentPart) GetChatCompletionRequestMessageContentPart ¶ added in v0.4.0
func (c *ChatCompletionRequestMessageContentPart) GetChatCompletionRequestMessageContentPart() *ChatCompletionRequestMessageContentPart
GetChatCompletionRequestMessageContentPart implements the ChatCompletionRequestMessageContentPartClassification interface for type ChatCompletionRequestMessageContentPart.
func (ChatCompletionRequestMessageContentPart) MarshalJSON ¶ added in v0.4.0
func (c ChatCompletionRequestMessageContentPart) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionRequestMessageContentPart.
func (*ChatCompletionRequestMessageContentPart) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatCompletionRequestMessageContentPart) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionRequestMessageContentPart.
type ChatCompletionRequestMessageContentPartClassification ¶ added in v0.4.0
type ChatCompletionRequestMessageContentPartClassification interface { // GetChatCompletionRequestMessageContentPart returns the ChatCompletionRequestMessageContentPart content of the underlying type. GetChatCompletionRequestMessageContentPart() *ChatCompletionRequestMessageContentPart }
ChatCompletionRequestMessageContentPartClassification provides polymorphic access to related types. Call the interface's GetChatCompletionRequestMessageContentPart() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *ChatCompletionRequestMessageContentPart, *ChatCompletionRequestMessageContentPartImage, *ChatCompletionRequestMessageContentPartText
type ChatCompletionRequestMessageContentPartImage ¶ added in v0.4.0
type ChatCompletionRequestMessageContentPartImage struct { // REQUIRED; contains the URL and level of detail for an image prompt ImageURL *ChatCompletionRequestMessageContentPartImageURL // contains filtered or unexported fields }
ChatCompletionRequestMessageContentPartImage - represents an image URL, to be used as part of a prompt
func (*ChatCompletionRequestMessageContentPartImage) GetChatCompletionRequestMessageContentPart ¶ added in v0.4.0
func (c *ChatCompletionRequestMessageContentPartImage) GetChatCompletionRequestMessageContentPart() *ChatCompletionRequestMessageContentPart
GetChatCompletionRequestMessageContentPart implements the ChatCompletionRequestMessageContentPartClassification interface for type ChatCompletionRequestMessageContentPartImage.
func (ChatCompletionRequestMessageContentPartImage) MarshalJSON ¶ added in v0.4.0
func (c ChatCompletionRequestMessageContentPartImage) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionRequestMessageContentPartImage.
func (*ChatCompletionRequestMessageContentPartImage) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatCompletionRequestMessageContentPartImage) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionRequestMessageContentPartImage.
type ChatCompletionRequestMessageContentPartImageURL ¶ added in v0.4.0
type ChatCompletionRequestMessageContentPartImageURL struct { // REQUIRED; Either a URL of the image or the base64 encoded image data. URL *string // Specifies the detail level of the image. Learn more in the Vision guide [/docs/guides/vision/low-or-high-fidelity-image-understanding]. Detail *ChatCompletionRequestMessageContentPartImageURLDetail }
ChatCompletionRequestMessageContentPartImageURL - contains the URL and level of detail for an image prompt
func (ChatCompletionRequestMessageContentPartImageURL) MarshalJSON ¶ added in v0.4.0
func (c ChatCompletionRequestMessageContentPartImageURL) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionRequestMessageContentPartImageURL.
func (*ChatCompletionRequestMessageContentPartImageURL) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatCompletionRequestMessageContentPartImageURL) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionRequestMessageContentPartImageURL.
type ChatCompletionRequestMessageContentPartImageURLDetail ¶ added in v0.4.0
type ChatCompletionRequestMessageContentPartImageURLDetail string
ChatCompletionRequestMessageContentPartImageURLDetail - Specifies the detail level of the image. Learn more in the Vision guide [/docs/guides/vision/low-or-high-fidelity-image-understanding].
const ( ChatCompletionRequestMessageContentPartImageURLDetailAuto ChatCompletionRequestMessageContentPartImageURLDetail = "auto" ChatCompletionRequestMessageContentPartImageURLDetailHigh ChatCompletionRequestMessageContentPartImageURLDetail = "high" ChatCompletionRequestMessageContentPartImageURLDetailLow ChatCompletionRequestMessageContentPartImageURLDetail = "low" )
func PossibleChatCompletionRequestMessageContentPartImageURLDetailValues ¶ added in v0.4.0
func PossibleChatCompletionRequestMessageContentPartImageURLDetailValues() []ChatCompletionRequestMessageContentPartImageURLDetail
PossibleChatCompletionRequestMessageContentPartImageURLDetailValues returns the possible values for the ChatCompletionRequestMessageContentPartImageURLDetail const type.
type ChatCompletionRequestMessageContentPartText ¶ added in v0.4.0
type ChatCompletionRequestMessageContentPartText struct { // REQUIRED; The text content. Text *string // contains filtered or unexported fields }
ChatCompletionRequestMessageContentPartText - represents text content, to be used as part of a prompt
func (*ChatCompletionRequestMessageContentPartText) GetChatCompletionRequestMessageContentPart ¶ added in v0.4.0
func (c *ChatCompletionRequestMessageContentPartText) GetChatCompletionRequestMessageContentPart() *ChatCompletionRequestMessageContentPart
GetChatCompletionRequestMessageContentPart implements the ChatCompletionRequestMessageContentPartClassification interface for type ChatCompletionRequestMessageContentPartText.
func (ChatCompletionRequestMessageContentPartText) MarshalJSON ¶ added in v0.4.0
func (c ChatCompletionRequestMessageContentPartText) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionRequestMessageContentPartText.
func (*ChatCompletionRequestMessageContentPartText) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatCompletionRequestMessageContentPartText) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionRequestMessageContentPartText.
type ChatCompletionRequestMessageContentPartType ¶ added in v0.4.0
type ChatCompletionRequestMessageContentPartType string
ChatCompletionRequestMessageContentPartType - The type of the content part.
const ( // ChatCompletionRequestMessageContentPartTypeImageURL - Chat content contains an image URL ChatCompletionRequestMessageContentPartTypeImageURL ChatCompletionRequestMessageContentPartType = "image_url" // ChatCompletionRequestMessageContentPartTypeText - Chat content contains text ChatCompletionRequestMessageContentPartTypeText ChatCompletionRequestMessageContentPartType = "text" )
func PossibleChatCompletionRequestMessageContentPartTypeValues ¶ added in v0.4.0
func PossibleChatCompletionRequestMessageContentPartTypeValues() []ChatCompletionRequestMessageContentPartType
PossibleChatCompletionRequestMessageContentPartTypeValues returns the possible values for the ChatCompletionRequestMessageContentPartType const type.
type ChatCompletionStreamOptions ¶ added in v0.7.1
type ChatCompletionStreamOptions struct { // If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token // usage statistics for the entire request, and the choices field will always // be an empty array. All other chunks will also include a usage field, but with a null value. IncludeUsage *bool }
ChatCompletionStreamOptions - Options for streaming response. Only set this when you set stream: true.
func (ChatCompletionStreamOptions) MarshalJSON ¶ added in v0.7.1
func (c ChatCompletionStreamOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionStreamOptions.
func (*ChatCompletionStreamOptions) UnmarshalJSON ¶ added in v0.7.1
func (c *ChatCompletionStreamOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionStreamOptions.
type ChatCompletions ¶
type ChatCompletions struct { // REQUIRED; The collection of completions choices associated with this completions response. Generally, n choices are generated // per provided prompt with a default value of 1. Token limits and other settings may // limit the number of choices generated. Choices []ChatChoice // REQUIRED; The first timestamp associated with generation activity for this completions response, represented as seconds // since the beginning of the Unix epoch of 00:00 on 1 Jan 1970. Created *time.Time // REQUIRED; A unique identifier associated with this chat completions response. ID *string // REQUIRED; Usage information for tokens processed and generated as part of this completions operation. // NOTE: This field is not available when using [Client.GetChatCompletionsStream]. Usage *CompletionsUsage // The model name used for this completions request. Model *string // Content filtering results for zero or more prompts in the request. In a streaming request, results for different prompts // may arrive at different times or in different orders. PromptFilterResults []ContentFilterResultsForPrompt // Can be used in conjunction with the seed request parameter to understand when backend changes have been made that might // impact determinism. SystemFingerprint *string }
ChatCompletions - Representation of the response data from a chat completions request. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.
func (ChatCompletions) MarshalJSON ¶
func (c ChatCompletions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletions.
func (*ChatCompletions) UnmarshalJSON ¶
func (c *ChatCompletions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletions.
type ChatCompletionsFunctionToolCall ¶ added in v0.4.0
type ChatCompletionsFunctionToolCall struct { // REQUIRED; The details of the function invocation requested by the tool call. Function *FunctionCall // REQUIRED; The ID of the tool call. ID *string // REQUIRED; The object type. Type *string }
ChatCompletionsFunctionToolCall - A tool call to a function tool, issued by the model in evaluation of a configured function tool, that represents a function invocation needed for a subsequent chat completions request to resolve.
func (*ChatCompletionsFunctionToolCall) GetChatCompletionsToolCall ¶ added in v0.4.0
func (c *ChatCompletionsFunctionToolCall) GetChatCompletionsToolCall() *ChatCompletionsToolCall
GetChatCompletionsToolCall implements the ChatCompletionsToolCallClassification interface for type ChatCompletionsFunctionToolCall.
func (ChatCompletionsFunctionToolCall) MarshalJSON ¶ added in v0.4.0
func (c ChatCompletionsFunctionToolCall) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionsFunctionToolCall.
func (*ChatCompletionsFunctionToolCall) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatCompletionsFunctionToolCall) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionsFunctionToolCall.
type ChatCompletionsFunctionToolDefinition ¶ added in v0.4.0
type ChatCompletionsFunctionToolDefinition struct { // REQUIRED; The function definition details for the function tool. Function *ChatCompletionsFunctionToolDefinitionFunction // REQUIRED; The object type. Type *string }
ChatCompletionsFunctionToolDefinition - The definition information for a chat completions function tool that can call a function in response to a tool call.
func (*ChatCompletionsFunctionToolDefinition) GetChatCompletionsToolDefinition ¶ added in v0.4.0
func (c *ChatCompletionsFunctionToolDefinition) GetChatCompletionsToolDefinition() *ChatCompletionsToolDefinition
GetChatCompletionsToolDefinition implements the ChatCompletionsToolDefinitionClassification interface for type ChatCompletionsFunctionToolDefinition.
func (ChatCompletionsFunctionToolDefinition) MarshalJSON ¶ added in v0.4.0
func (c ChatCompletionsFunctionToolDefinition) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionsFunctionToolDefinition.
func (*ChatCompletionsFunctionToolDefinition) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatCompletionsFunctionToolDefinition) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionsFunctionToolDefinition.
type ChatCompletionsFunctionToolDefinitionFunction ¶ added in v0.7.0
type ChatCompletionsFunctionToolDefinitionFunction struct { // REQUIRED; The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum // length of 64. Name *string // A description of what the function does, used by the model to choose when and how to call the function. Description *string // Anything // REQUIRED; The function definition details for the function tool. // NOTE: this field is JSON text that describes a JSON schema. You can marshal a data // structure using code similar to this: // // jsonBytes, err := json.Marshal(map[string]any{ // "required": []string{"location"}, // "type": "object", // "properties": map[string]any{ // "location": map[string]any{ // "type": "string", // "description": "The city and state, e.g. San Francisco, CA", // }, // }, // }) // // if err != nil { // panic(err) // } // // funcDef := &azopenai.FunctionDefinition{ // Name: to.Ptr("get_current_weather"), // Description: to.Ptr("Get the current weather in a given location"), // Parameters: jsonBytes, // } Parameters []byte // Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the // exact schema defined in the parameters field. Only a subset of JSON Schema is // supported when strict is true. Learn more about Structured Outputs in the function calling guide [docs/guides/function-calling]. Strict *bool }
ChatCompletionsFunctionToolDefinitionFunction - The function definition details for the function tool.
func (ChatCompletionsFunctionToolDefinitionFunction) MarshalJSON ¶ added in v0.7.0
func (c ChatCompletionsFunctionToolDefinitionFunction) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionsFunctionToolDefinitionFunction.
func (*ChatCompletionsFunctionToolDefinitionFunction) UnmarshalJSON ¶ added in v0.7.0
func (c *ChatCompletionsFunctionToolDefinitionFunction) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionsFunctionToolDefinitionFunction.
type ChatCompletionsFunctionToolSelection ¶ added in v0.5.0
type ChatCompletionsFunctionToolSelection struct { // REQUIRED; The name of the function that should be called. Name *string }
ChatCompletionsFunctionToolSelection - A tool selection of a specific, named function tool that will limit chat completions to using the named function.
func (ChatCompletionsFunctionToolSelection) MarshalJSON ¶ added in v0.5.0
func (c ChatCompletionsFunctionToolSelection) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionsFunctionToolSelection.
func (*ChatCompletionsFunctionToolSelection) UnmarshalJSON ¶ added in v0.5.0
func (c *ChatCompletionsFunctionToolSelection) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionsFunctionToolSelection.
type ChatCompletionsJSONResponseFormat ¶ added in v0.4.0
type ChatCompletionsJSONResponseFormat struct {
// contains filtered or unexported fields
}
ChatCompletionsJSONResponseFormat - A response format for Chat Completions that restricts responses to emitting valid JSON objects.
func (*ChatCompletionsJSONResponseFormat) GetChatCompletionsResponseFormat ¶ added in v0.4.0
func (c *ChatCompletionsJSONResponseFormat) GetChatCompletionsResponseFormat() *ChatCompletionsResponseFormat
GetChatCompletionsResponseFormat implements the ChatCompletionsResponseFormatClassification interface for type ChatCompletionsJSONResponseFormat.
func (ChatCompletionsJSONResponseFormat) MarshalJSON ¶ added in v0.4.0
func (c ChatCompletionsJSONResponseFormat) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionsJSONResponseFormat.
func (*ChatCompletionsJSONResponseFormat) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatCompletionsJSONResponseFormat) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionsJSONResponseFormat.
type ChatCompletionsJSONSchemaResponseFormat ¶ added in v0.7.0
type ChatCompletionsJSONSchemaResponseFormat struct { // REQUIRED; A description of what the response format is for, used by the model to determine how to respond in the format. JSONSchema *ChatCompletionsJSONSchemaResponseFormatJSONSchema // contains filtered or unexported fields }
ChatCompletionsJSONSchemaResponseFormat - A response format for Chat Completions that restricts responses to emitting JSON that conforms to a provided JSON Schema for Structured Outputs.
func (*ChatCompletionsJSONSchemaResponseFormat) GetChatCompletionsResponseFormat ¶ added in v0.7.0
func (c *ChatCompletionsJSONSchemaResponseFormat) GetChatCompletionsResponseFormat() *ChatCompletionsResponseFormat
GetChatCompletionsResponseFormat implements the ChatCompletionsResponseFormatClassification interface for type ChatCompletionsJSONSchemaResponseFormat.
func (ChatCompletionsJSONSchemaResponseFormat) MarshalJSON ¶ added in v0.7.0
func (c ChatCompletionsJSONSchemaResponseFormat) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionsJSONSchemaResponseFormat.
func (*ChatCompletionsJSONSchemaResponseFormat) UnmarshalJSON ¶ added in v0.7.0
func (c *ChatCompletionsJSONSchemaResponseFormat) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionsJSONSchemaResponseFormat.
type ChatCompletionsJSONSchemaResponseFormatJSONSchema ¶ added in v0.7.0
type ChatCompletionsJSONSchemaResponseFormatJSONSchema struct { // REQUIRED; The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length // of 64. Name *string // A description of what the response format is for, used by the model to determine how to respond in the format. Description *string // Anything Schema []byte // Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the // exact schema defined in the schema field. Only a subset of JSON Schema is // supported when strict is true. To learn more, read the Structured Outputs guide [/docs/guides/structured-outputs]. Strict *bool }
ChatCompletionsJSONSchemaResponseFormatJSONSchema - A description of what the response format is for, used by the model to determine how to respond in the format.
func (ChatCompletionsJSONSchemaResponseFormatJSONSchema) MarshalJSON ¶ added in v0.7.0
func (c ChatCompletionsJSONSchemaResponseFormatJSONSchema) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionsJSONSchemaResponseFormatJSONSchema.
func (*ChatCompletionsJSONSchemaResponseFormatJSONSchema) UnmarshalJSON ¶ added in v0.7.0
func (c *ChatCompletionsJSONSchemaResponseFormatJSONSchema) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionsJSONSchemaResponseFormatJSONSchema.
type ChatCompletionsNamedFunctionToolSelection ¶ added in v0.5.0
type ChatCompletionsNamedFunctionToolSelection struct { // REQUIRED; The function that should be called. Function *ChatCompletionsFunctionToolSelection // REQUIRED; The object type. Type *string }
ChatCompletionsNamedFunctionToolSelection - A tool selection of a specific, named function tool that will limit chat completions to using the named function.
func (*ChatCompletionsNamedFunctionToolSelection) GetChatCompletionsNamedToolSelection ¶ added in v0.5.0
func (c *ChatCompletionsNamedFunctionToolSelection) GetChatCompletionsNamedToolSelection() *ChatCompletionsNamedToolSelection
GetChatCompletionsNamedToolSelection implements the ChatCompletionsNamedToolSelectionClassification interface for type ChatCompletionsNamedFunctionToolSelection.
func (ChatCompletionsNamedFunctionToolSelection) MarshalJSON ¶ added in v0.5.0
func (c ChatCompletionsNamedFunctionToolSelection) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionsNamedFunctionToolSelection.
func (*ChatCompletionsNamedFunctionToolSelection) UnmarshalJSON ¶ added in v0.5.0
func (c *ChatCompletionsNamedFunctionToolSelection) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionsNamedFunctionToolSelection.
type ChatCompletionsNamedToolSelection ¶ added in v0.5.0
type ChatCompletionsNamedToolSelection struct { // REQUIRED; The object type. Type *string }
ChatCompletionsNamedToolSelection - An abstract representation of an explicit, named tool selection to use for a chat completions request.
func (*ChatCompletionsNamedToolSelection) GetChatCompletionsNamedToolSelection ¶ added in v0.5.0
func (c *ChatCompletionsNamedToolSelection) GetChatCompletionsNamedToolSelection() *ChatCompletionsNamedToolSelection
GetChatCompletionsNamedToolSelection implements the ChatCompletionsNamedToolSelectionClassification interface for type ChatCompletionsNamedToolSelection.
func (ChatCompletionsNamedToolSelection) MarshalJSON ¶ added in v0.5.0
func (c ChatCompletionsNamedToolSelection) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionsNamedToolSelection.
func (*ChatCompletionsNamedToolSelection) UnmarshalJSON ¶ added in v0.5.0
func (c *ChatCompletionsNamedToolSelection) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionsNamedToolSelection.
type ChatCompletionsNamedToolSelectionClassification ¶ added in v0.5.0
type ChatCompletionsNamedToolSelectionClassification interface { // GetChatCompletionsNamedToolSelection returns the ChatCompletionsNamedToolSelection content of the underlying type. GetChatCompletionsNamedToolSelection() *ChatCompletionsNamedToolSelection }
ChatCompletionsNamedToolSelectionClassification provides polymorphic access to related types. Call the interface's GetChatCompletionsNamedToolSelection() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *ChatCompletionsNamedFunctionToolSelection, *ChatCompletionsNamedToolSelection
type ChatCompletionsOptions ¶
type ChatCompletionsOptions struct { // REQUIRED; The collection of context messages associated with this chat completions request. Typical usage begins with a // chat message for the System role that provides instructions for the behavior of the // assistant, followed by alternating messages between the User and Assistant roles. Messages []ChatRequestMessageClassification // The configuration entries for Azure OpenAI chat extensions that use them. This additional specification is only compatible // with Azure OpenAI. AzureExtensionsOptions []AzureChatExtensionConfigurationClassification // If provided, the configuration options for available Azure OpenAI chat enhancements. Enhancements *AzureChatEnhancementConfiguration // A value that influences the probability of generated tokens appearing based on their cumulative frequency in generated // text. Positive values will make tokens less likely to appear as their frequency // increases and decrease the likelihood of the model repeating the same statements verbatim. FrequencyPenalty *float32 // Controls how the model responds to function calls. "none" means the model does not call a function, and responds to the // end-user. "auto" means the model can pick between an end-user or calling a // function. Specifying a particular function via {"name": "my_function"} forces the model to call that function. "none" is // the default when no functions are present. "auto" is the default if functions // are present. FunctionCall *ChatCompletionsOptionsFunctionCall // A list of functions the model may generate JSON inputs for. Functions []FunctionDefinition // A map between GPT token IDs and bias scores that influences the probability of specific tokens appearing in a completions // response. Token IDs are computed via external tokenizer tools, while bias // scores reside in the range of -100 to 100 with minimum and maximum values corresponding to a full ban or exclusive selection // of a token, respectively. The exact behavior of a given bias score varies // by model. LogitBias map[string]*int32 // Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output // token returned in the content of message. This option is currently not available // on the gpt-4-vision-preview model. LogProbs *bool // An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning // tokens. MaxCompletionTokens *int32 // The maximum number of tokens allowed for the generated answer. By default, the number of tokens the model can return will // be (4096 - prompt tokens). // This value is now deprecated in favor of max_completion_tokens, and is not compatible with o1 series models. MaxTokens *int32 // The model name to provide as part of this completions request. Not applicable to Azure OpenAI, where deployment information // should be included in the Azure resource URI that's connected to. DeploymentName *string // The number of chat completions choices that should be generated for a chat completions response. Because this setting can // generate many completions, it may quickly consume your token quota. Use // carefully and ensure reasonable settings for max_tokens and stop. N *int32 // Whether to enable parallel function calling during tool use. ParallelToolCalls *bool // A value that influences the probability of generated tokens appearing based on their existing presence in generated text. // Positive values will make tokens less likely to appear when they already exist // and increase the model's likelihood to output new topics. PresencePenalty *float32 // An object specifying the format that the model must output. Used to enable JSON mode. ResponseFormat ChatCompletionsResponseFormatClassification // If specified, the system will make a best effort to sample deterministically such that repeated requests with the same // seed and parameters should return the same result. Determinism is not guaranteed, // and you should refer to the system_fingerprint response parameter to monitor changes in the backend." Seed *int64 // A collection of textual sequences that will end completions generation. Stop []string // The sampling temperature to use that controls the apparent creativity of generated completions. Higher values will make // output more random while lower values will make results more focused and // deterministic. It is not recommended to modify temperature and top_p for the same completions request as the interaction // of these two settings is difficult to predict. Temperature *float32 // If specified, the model will configure which of the provided tools it can use for the chat completions response. ToolChoice *ChatCompletionsToolChoice // The available tool definitions that the chat completions request can use, including caller-defined functions. Tools []ChatCompletionsToolDefinitionClassification // An integer between 0 and 5 specifying the number of most likely tokens to return at each token position, each with an associated // log probability. logprobs must be set to true if this parameter is // used. TopLogProbs *int32 // An alternative to sampling with temperature called nucleus sampling. This value causes the model to consider the results // of tokens with the provided probability mass. As an example, a value of 0.15 // will cause only the tokens comprising the top 15% of probability mass to be considered. It is not recommended to modify // temperature and top_p for the same completions request as the interaction of // these two settings is difficult to predict. TopP *float32 // An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes. User *string }
ChatCompletionsOptions - The configuration information for a chat completions request. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.
type ChatCompletionsOptionsFunctionCall ¶
type ChatCompletionsOptionsFunctionCall struct { // IsFunction is true if Value refers to a function name. IsFunction bool // Value is one of: // - "auto", meaning the model can pick between an end-user or calling a function // - "none", meaning the model does not call a function, // - name of a function, in which case [IsFunction] should be set to true. Value *string }
ChatCompletionsOptionsFunctionCall - Controls how the model responds to function calls. "none" means the model does not call a function, and responds to the end-user. "auto" means the model can pick between an end-user or calling a function. Specifying a particular function via {"name": "my_function"} forces the model to call that function. "none" is the default when no functions are present. "auto" is the default if functions are present.
func (ChatCompletionsOptionsFunctionCall) MarshalJSON ¶
func (c ChatCompletionsOptionsFunctionCall) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionsOptionsFunctionCall.
type ChatCompletionsResponseFormat ¶ added in v0.4.0
type ChatCompletionsResponseFormat struct {
// contains filtered or unexported fields
}
ChatCompletionsResponseFormat - An abstract representation of a response format configuration usable by Chat Completions. Can be used to enable JSON mode.
func (*ChatCompletionsResponseFormat) GetChatCompletionsResponseFormat ¶ added in v0.4.0
func (c *ChatCompletionsResponseFormat) GetChatCompletionsResponseFormat() *ChatCompletionsResponseFormat
GetChatCompletionsResponseFormat implements the ChatCompletionsResponseFormatClassification interface for type ChatCompletionsResponseFormat.
func (ChatCompletionsResponseFormat) MarshalJSON ¶ added in v0.4.0
func (c ChatCompletionsResponseFormat) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionsResponseFormat.
func (*ChatCompletionsResponseFormat) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatCompletionsResponseFormat) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionsResponseFormat.
type ChatCompletionsResponseFormatClassification ¶ added in v0.4.0
type ChatCompletionsResponseFormatClassification interface { // GetChatCompletionsResponseFormat returns the ChatCompletionsResponseFormat content of the underlying type. GetChatCompletionsResponseFormat() *ChatCompletionsResponseFormat }
ChatCompletionsResponseFormatClassification provides polymorphic access to related types. Call the interface's GetChatCompletionsResponseFormat() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *ChatCompletionsJSONResponseFormat, *ChatCompletionsJSONSchemaResponseFormat, *ChatCompletionsResponseFormat, *ChatCompletionsTextResponseFormat
type ChatCompletionsStreamOptions ¶ added in v0.7.1
type ChatCompletionsStreamOptions struct { // REQUIRED; The collection of context messages associated with this chat completions request. Typical usage begins with a // chat message for the System role that provides instructions for the behavior of the // assistant, followed by alternating messages between the User and Assistant roles. Messages []ChatRequestMessageClassification // The configuration entries for Azure OpenAI chat extensions that use them. This additional specification is only compatible // with Azure OpenAI. AzureExtensionsOptions []AzureChatExtensionConfigurationClassification // If provided, the configuration options for available Azure OpenAI chat enhancements. Enhancements *AzureChatEnhancementConfiguration // A value that influences the probability of generated tokens appearing based on their cumulative frequency in generated // text. Positive values will make tokens less likely to appear as their frequency // increases and decrease the likelihood of the model repeating the same statements verbatim. FrequencyPenalty *float32 // Controls how the model responds to function calls. "none" means the model does not call a function, and responds to the // end-user. "auto" means the model can pick between an end-user or calling a // function. Specifying a particular function via {"name": "my_function"} forces the model to call that function. "none" is // the default when no functions are present. "auto" is the default if functions // are present. FunctionCall *ChatCompletionsOptionsFunctionCall // A list of functions the model may generate JSON inputs for. Functions []FunctionDefinition // A map between GPT token IDs and bias scores that influences the probability of specific tokens appearing in a completions // response. Token IDs are computed via external tokenizer tools, while bias // scores reside in the range of -100 to 100 with minimum and maximum values corresponding to a full ban or exclusive selection // of a token, respectively. The exact behavior of a given bias score varies // by model. LogitBias map[string]*int32 // Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output // token returned in the content of message. This option is currently not available // on the gpt-4-vision-preview model. LogProbs *bool // An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning // tokens. MaxCompletionTokens *int32 // The maximum number of tokens allowed for the generated answer. By default, the number of tokens the model can return will // be (4096 - prompt tokens). // This value is now deprecated in favor of max_completion_tokens, and is not compatible with o1 series models. MaxTokens *int32 // The model name to provide as part of this completions request. Not applicable to Azure OpenAI, where deployment information // should be included in the Azure resource URI that's connected to. DeploymentName *string // The number of chat completions choices that should be generated for a chat completions response. Because this setting can // generate many completions, it may quickly consume your token quota. Use // carefully and ensure reasonable settings for max_tokens and stop. N *int32 // Whether to enable parallel function calling during tool use. ParallelToolCalls *bool // A value that influences the probability of generated tokens appearing based on their existing presence in generated text. // Positive values will make tokens less likely to appear when they already exist // and increase the model's likelihood to output new topics. PresencePenalty *float32 // An object specifying the format that the model must output. Used to enable JSON mode. ResponseFormat ChatCompletionsResponseFormatClassification // If specified, the system will make a best effort to sample deterministically such that repeated requests with the same // seed and parameters should return the same result. Determinism is not guaranteed, // and you should refer to the system_fingerprint response parameter to monitor changes in the backend." Seed *int64 // A collection of textual sequences that will end completions generation. Stop []string // Options for streaming response. Only set this when you set stream: true. StreamOptions *ChatCompletionStreamOptions // The sampling temperature to use that controls the apparent creativity of generated completions. Higher values will make // output more random while lower values will make results more focused and // deterministic. It is not recommended to modify temperature and top_p for the same completions request as the interaction // of these two settings is difficult to predict. Temperature *float32 // If specified, the model will configure which of the provided tools it can use for the chat completions response. ToolChoice *ChatCompletionsToolChoice // The available tool definitions that the chat completions request can use, including caller-defined functions. Tools []ChatCompletionsToolDefinitionClassification // An integer between 0 and 5 specifying the number of most likely tokens to return at each token position, each with an associated // log probability. logprobs must be set to true if this parameter is // used. TopLogProbs *int32 // An alternative to sampling with temperature called nucleus sampling. This value causes the model to consider the results // of tokens with the provided probability mass. As an example, a value of 0.15 // will cause only the tokens comprising the top 15% of probability mass to be considered. It is not recommended to modify // temperature and top_p for the same completions request as the interaction of // these two settings is difficult to predict. TopP *float32 // An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes. User *string }
ChatCompletionsStreamOptions - The configuration information for a chat completions request. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.
type ChatCompletionsTextResponseFormat ¶ added in v0.4.0
type ChatCompletionsTextResponseFormat struct {
// contains filtered or unexported fields
}
ChatCompletionsTextResponseFormat - The standard Chat Completions response format that can freely generate text and is not guaranteed to produce response content that adheres to a specific schema.
func (*ChatCompletionsTextResponseFormat) GetChatCompletionsResponseFormat ¶ added in v0.4.0
func (c *ChatCompletionsTextResponseFormat) GetChatCompletionsResponseFormat() *ChatCompletionsResponseFormat
GetChatCompletionsResponseFormat implements the ChatCompletionsResponseFormatClassification interface for type ChatCompletionsTextResponseFormat.
func (ChatCompletionsTextResponseFormat) MarshalJSON ¶ added in v0.4.0
func (c ChatCompletionsTextResponseFormat) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionsTextResponseFormat.
func (*ChatCompletionsTextResponseFormat) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatCompletionsTextResponseFormat) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionsTextResponseFormat.
type ChatCompletionsToolCall ¶ added in v0.4.0
type ChatCompletionsToolCall struct { // REQUIRED; The ID of the tool call. ID *string // REQUIRED; The object type. Type *string }
ChatCompletionsToolCall - An abstract representation of a tool call that must be resolved in a subsequent request to perform the requested chat completion.
func (*ChatCompletionsToolCall) GetChatCompletionsToolCall ¶ added in v0.4.0
func (c *ChatCompletionsToolCall) GetChatCompletionsToolCall() *ChatCompletionsToolCall
GetChatCompletionsToolCall implements the ChatCompletionsToolCallClassification interface for type ChatCompletionsToolCall.
func (ChatCompletionsToolCall) MarshalJSON ¶ added in v0.4.0
func (c ChatCompletionsToolCall) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionsToolCall.
func (*ChatCompletionsToolCall) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatCompletionsToolCall) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionsToolCall.
type ChatCompletionsToolCallClassification ¶ added in v0.4.0
type ChatCompletionsToolCallClassification interface { // GetChatCompletionsToolCall returns the ChatCompletionsToolCall content of the underlying type. GetChatCompletionsToolCall() *ChatCompletionsToolCall }
ChatCompletionsToolCallClassification provides polymorphic access to related types. Call the interface's GetChatCompletionsToolCall() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *ChatCompletionsFunctionToolCall, *ChatCompletionsToolCall
type ChatCompletionsToolChoice ¶ added in v0.4.0
type ChatCompletionsToolChoice struct {
// contains filtered or unexported fields
}
ChatCompletionsToolChoice controls which tool is used for this ChatCompletions call. You can choose between: - ChatCompletionsToolChoiceAuto means the model can pick between generating a message or calling a function. - ChatCompletionsToolChoiceNone means the model will not call a function and instead generates a message - Use the NewChatCompletionsToolChoice function to specify a specific tool.
var ( // ChatCompletionsToolChoiceAuto means the model can pick between generating a message or calling a function. ChatCompletionsToolChoiceAuto *ChatCompletionsToolChoice = &ChatCompletionsToolChoice{value: "auto"} // ChatCompletionsToolChoiceNone means the model will not call a function and instead generates a message. ChatCompletionsToolChoiceNone *ChatCompletionsToolChoice = &ChatCompletionsToolChoice{value: "none"} )
func NewChatCompletionsToolChoice ¶ added in v0.4.0
func NewChatCompletionsToolChoice[T ChatCompletionsToolChoiceFunction](v T) *ChatCompletionsToolChoice
NewChatCompletionsToolChoice creates a ChatCompletionsToolChoice for a specific tool.
func (ChatCompletionsToolChoice) MarshalJSON ¶ added in v0.4.0
func (tc ChatCompletionsToolChoice) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionsToolChoice.
func (*ChatCompletionsToolChoice) UnmarshalJSON ¶ added in v0.5.0
func (tc *ChatCompletionsToolChoice) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionsToolChoice.
type ChatCompletionsToolChoiceFunction ¶ added in v0.4.0
type ChatCompletionsToolChoiceFunction struct { // Name is the name of the function to call. Name string }
ChatCompletionsToolChoiceFunction can be used to force the model to call a particular function.
func (ChatCompletionsToolChoiceFunction) MarshalJSON ¶ added in v0.4.0
func (tf ChatCompletionsToolChoiceFunction) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionsToolChoiceFunction.
type ChatCompletionsToolDefinition ¶ added in v0.4.0
type ChatCompletionsToolDefinition struct { // REQUIRED; The object type. Type *string }
ChatCompletionsToolDefinition - An abstract representation of a tool that can be used by the model to improve a chat completions response.
func (*ChatCompletionsToolDefinition) GetChatCompletionsToolDefinition ¶ added in v0.4.0
func (c *ChatCompletionsToolDefinition) GetChatCompletionsToolDefinition() *ChatCompletionsToolDefinition
GetChatCompletionsToolDefinition implements the ChatCompletionsToolDefinitionClassification interface for type ChatCompletionsToolDefinition.
func (ChatCompletionsToolDefinition) MarshalJSON ¶ added in v0.4.0
func (c ChatCompletionsToolDefinition) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatCompletionsToolDefinition.
func (*ChatCompletionsToolDefinition) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatCompletionsToolDefinition) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionsToolDefinition.
type ChatCompletionsToolDefinitionClassification ¶ added in v0.4.0
type ChatCompletionsToolDefinitionClassification interface { // GetChatCompletionsToolDefinition returns the ChatCompletionsToolDefinition content of the underlying type. GetChatCompletionsToolDefinition() *ChatCompletionsToolDefinition }
ChatCompletionsToolDefinitionClassification provides polymorphic access to related types. Call the interface's GetChatCompletionsToolDefinition() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *ChatCompletionsFunctionToolDefinition, *ChatCompletionsToolDefinition
type ChatCompletionsToolSelectionPreset ¶ added in v0.5.0
type ChatCompletionsToolSelectionPreset string
ChatCompletionsToolSelectionPreset - Represents a generic policy for how a chat completions tool may be selected.
const ( // ChatCompletionsToolSelectionPresetAuto - Specifies that the model may either use any of the tools provided in this chat // completions request or // instead return a standard chat completions response as if no tools were provided. ChatCompletionsToolSelectionPresetAuto ChatCompletionsToolSelectionPreset = "auto" // ChatCompletionsToolSelectionPresetNone - Specifies that the model should not respond with a tool call and should instead // provide a standard chat // completions response. Response content may still be influenced by the provided tool definitions. ChatCompletionsToolSelectionPresetNone ChatCompletionsToolSelectionPreset = "none" // ChatCompletionsToolSelectionPresetRequired - Specifies that the model must call one or more tools. ChatCompletionsToolSelectionPresetRequired ChatCompletionsToolSelectionPreset = "required" )
func PossibleChatCompletionsToolSelectionPresetValues ¶ added in v0.5.0
func PossibleChatCompletionsToolSelectionPresetValues() []ChatCompletionsToolSelectionPreset
PossibleChatCompletionsToolSelectionPresetValues returns the possible values for the ChatCompletionsToolSelectionPreset const type.
type ChatFinishDetails ¶ added in v0.4.0
type ChatFinishDetails struct { // REQUIRED; The object type. Type *string }
ChatFinishDetails - An abstract representation of structured information about why a chat completions response terminated.
func (*ChatFinishDetails) GetChatFinishDetails ¶ added in v0.4.0
func (c *ChatFinishDetails) GetChatFinishDetails() *ChatFinishDetails
GetChatFinishDetails implements the ChatFinishDetailsClassification interface for type ChatFinishDetails.
func (ChatFinishDetails) MarshalJSON ¶ added in v0.4.0
func (c ChatFinishDetails) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatFinishDetails.
func (*ChatFinishDetails) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatFinishDetails) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatFinishDetails.
type ChatFinishDetailsClassification ¶ added in v0.4.0
type ChatFinishDetailsClassification interface { // GetChatFinishDetails returns the ChatFinishDetails content of the underlying type. GetChatFinishDetails() *ChatFinishDetails }
ChatFinishDetailsClassification provides polymorphic access to related types. Call the interface's GetChatFinishDetails() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *ChatFinishDetails, *MaxTokensFinishDetails, *StopFinishDetails
type ChatMessageContentItem ¶ added in v0.5.0
type ChatMessageContentItem struct { // REQUIRED; The discriminated object type. Type *string }
ChatMessageContentItem - An abstract representation of a structured content item within a chat message.
func (*ChatMessageContentItem) GetChatMessageContentItem ¶ added in v0.5.0
func (c *ChatMessageContentItem) GetChatMessageContentItem() *ChatMessageContentItem
GetChatMessageContentItem implements the ChatMessageContentItemClassification interface for type ChatMessageContentItem.
func (ChatMessageContentItem) MarshalJSON ¶ added in v0.5.0
func (c ChatMessageContentItem) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatMessageContentItem.
func (*ChatMessageContentItem) UnmarshalJSON ¶ added in v0.5.0
func (c *ChatMessageContentItem) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatMessageContentItem.
type ChatMessageContentItemClassification ¶ added in v0.5.0
type ChatMessageContentItemClassification interface { // GetChatMessageContentItem returns the ChatMessageContentItem content of the underlying type. GetChatMessageContentItem() *ChatMessageContentItem }
ChatMessageContentItemClassification provides polymorphic access to related types. Call the interface's GetChatMessageContentItem() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *ChatMessageContentItem, *ChatMessageImageContentItem, *ChatMessageRefusalContentItem, *ChatMessageTextContentItem
type ChatMessageImageContentItem ¶ added in v0.5.0
type ChatMessageImageContentItem struct { // REQUIRED; An internet location, which must be accessible to the model,from which the image may be retrieved. ImageURL *ChatMessageImageURL // REQUIRED; The discriminated object type. Type *string }
ChatMessageImageContentItem - A structured chat content item containing an image reference.
func (*ChatMessageImageContentItem) GetChatMessageContentItem ¶ added in v0.5.0
func (c *ChatMessageImageContentItem) GetChatMessageContentItem() *ChatMessageContentItem
GetChatMessageContentItem implements the ChatMessageContentItemClassification interface for type ChatMessageImageContentItem.
func (ChatMessageImageContentItem) MarshalJSON ¶ added in v0.5.0
func (c ChatMessageImageContentItem) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatMessageImageContentItem.
func (*ChatMessageImageContentItem) UnmarshalJSON ¶ added in v0.5.0
func (c *ChatMessageImageContentItem) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatMessageImageContentItem.
type ChatMessageImageDetailLevel ¶ added in v0.5.0
type ChatMessageImageDetailLevel string
ChatMessageImageDetailLevel - A representation of the possible image detail levels for image-based chat completions message content.
const ( // ChatMessageImageDetailLevelAuto - Specifies that the model should determine which detail level to apply using heuristics // like image size. ChatMessageImageDetailLevelAuto ChatMessageImageDetailLevel = "auto" // ChatMessageImageDetailLevelHigh - Specifies that image evaluation should enable the 'high-res' model that may be more accurate // for highly detailed // images but may also be slower and consume more tokens. ChatMessageImageDetailLevelHigh ChatMessageImageDetailLevel = "high" // ChatMessageImageDetailLevelLow - Specifies that image evaluation should be constrained to the 'low-res' model that may // be faster and consume fewer // tokens but may also be less accurate for highly detailed images. ChatMessageImageDetailLevelLow ChatMessageImageDetailLevel = "low" )
func PossibleChatMessageImageDetailLevelValues ¶ added in v0.5.0
func PossibleChatMessageImageDetailLevelValues() []ChatMessageImageDetailLevel
PossibleChatMessageImageDetailLevelValues returns the possible values for the ChatMessageImageDetailLevel const type.
type ChatMessageImageURL ¶ added in v0.5.0
type ChatMessageImageURL struct { // REQUIRED; The URL of the image. URL *string // The evaluation quality setting to use, which controls relative prioritization of speed, token consumption, and accuracy. Detail *ChatMessageImageDetailLevel }
ChatMessageImageURL - An internet location from which the model may retrieve an image.
func (ChatMessageImageURL) MarshalJSON ¶ added in v0.5.0
func (c ChatMessageImageURL) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatMessageImageURL.
func (*ChatMessageImageURL) UnmarshalJSON ¶ added in v0.5.0
func (c *ChatMessageImageURL) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatMessageImageURL.
type ChatMessageRefusalContentItem ¶ added in v0.7.0
type ChatMessageRefusalContentItem struct { // REQUIRED; The refusal message. Refusal *string // REQUIRED; The discriminated object type. Type *string }
ChatMessageRefusalContentItem - A structured chat content item containing model refusal information for a structured outputs request.
func (*ChatMessageRefusalContentItem) GetChatMessageContentItem ¶ added in v0.7.0
func (c *ChatMessageRefusalContentItem) GetChatMessageContentItem() *ChatMessageContentItem
GetChatMessageContentItem implements the ChatMessageContentItemClassification interface for type ChatMessageRefusalContentItem.
func (ChatMessageRefusalContentItem) MarshalJSON ¶ added in v0.7.0
func (c ChatMessageRefusalContentItem) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatMessageRefusalContentItem.
func (*ChatMessageRefusalContentItem) UnmarshalJSON ¶ added in v0.7.0
func (c *ChatMessageRefusalContentItem) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatMessageRefusalContentItem.
type ChatMessageTextContentItem ¶ added in v0.5.0
type ChatMessageTextContentItem struct { // REQUIRED; The content of the message. Text *string // REQUIRED; The discriminated object type. Type *string }
ChatMessageTextContentItem - A structured chat content item containing plain text.
func (*ChatMessageTextContentItem) GetChatMessageContentItem ¶ added in v0.5.0
func (c *ChatMessageTextContentItem) GetChatMessageContentItem() *ChatMessageContentItem
GetChatMessageContentItem implements the ChatMessageContentItemClassification interface for type ChatMessageTextContentItem.
func (ChatMessageTextContentItem) MarshalJSON ¶ added in v0.5.0
func (c ChatMessageTextContentItem) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatMessageTextContentItem.
func (*ChatMessageTextContentItem) UnmarshalJSON ¶ added in v0.5.0
func (c *ChatMessageTextContentItem) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatMessageTextContentItem.
type ChatRequestAssistantMessage ¶ added in v0.4.0
type ChatRequestAssistantMessage struct { // REQUIRED; The content of the message. Content *ChatRequestAssistantMessageContent // The function call that must be resolved and have its output appended to subsequent input messages for the chat completions // request to resolve as configured. FunctionCall *FunctionCall // An optional name for the participant. Name *string // The refusal message by the assistant. Refusal *string // The tool calls that must be resolved and have their outputs appended to subsequent input messages for the chat completions // request to resolve as configured. ToolCalls []ChatCompletionsToolCallClassification // contains filtered or unexported fields }
ChatRequestAssistantMessage - A request chat message representing response or action from the assistant.
func (*ChatRequestAssistantMessage) GetChatRequestMessage ¶ added in v0.4.0
func (c *ChatRequestAssistantMessage) GetChatRequestMessage() *ChatRequestMessage
GetChatRequestMessage implements the ChatRequestMessageClassification interface for type ChatRequestAssistantMessage.
func (ChatRequestAssistantMessage) MarshalJSON ¶ added in v0.4.0
func (c ChatRequestAssistantMessage) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatRequestAssistantMessage.
func (*ChatRequestAssistantMessage) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatRequestAssistantMessage) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatRequestAssistantMessage.
type ChatRequestAssistantMessageContent ¶ added in v0.7.0
type ChatRequestAssistantMessageContent struct {
// contains filtered or unexported fields
}
ChatRequestAssistantMessageContent represents the content for a azopenai.ChatRequestAssistantMessage. NOTE: This should be created using azopenai.NewChatRequestAssistantMessageContent
func NewChatRequestAssistantMessageContent ¶ added in v0.7.0
func NewChatRequestAssistantMessageContent[T []ChatMessageRefusalContentItem | []ChatMessageTextContentItem | string](value T) *ChatRequestAssistantMessageContent
NewChatRequestAssistantMessageContent creates a azopenai.ChatRequestAssistantMessageContent.
func (ChatRequestAssistantMessageContent) MarshalJSON ¶ added in v0.7.0
func (c ChatRequestAssistantMessageContent) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatRequestAssistantMessageContent.
type ChatRequestFunctionMessage ¶ added in v0.5.0
type ChatRequestFunctionMessage struct { // REQUIRED; The output of the function as requested by the function call. Content *string // REQUIRED; The name of the function that was called to produce output. Name *string // contains filtered or unexported fields }
ChatRequestFunctionMessage - A request chat message representing requested output from a configured function.
func (*ChatRequestFunctionMessage) GetChatRequestMessage ¶ added in v0.5.0
func (c *ChatRequestFunctionMessage) GetChatRequestMessage() *ChatRequestMessage
GetChatRequestMessage implements the ChatRequestMessageClassification interface for type ChatRequestFunctionMessage.
func (ChatRequestFunctionMessage) MarshalJSON ¶ added in v0.5.0
func (c ChatRequestFunctionMessage) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatRequestFunctionMessage.
func (*ChatRequestFunctionMessage) UnmarshalJSON ¶ added in v0.5.0
func (c *ChatRequestFunctionMessage) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatRequestFunctionMessage.
type ChatRequestMessage ¶ added in v0.4.0
type ChatRequestMessage struct {
// contains filtered or unexported fields
}
ChatRequestMessage - An abstract representation of a chat message as provided in a request.
func (*ChatRequestMessage) GetChatRequestMessage ¶ added in v0.4.0
func (c *ChatRequestMessage) GetChatRequestMessage() *ChatRequestMessage
GetChatRequestMessage implements the ChatRequestMessageClassification interface for type ChatRequestMessage.
func (ChatRequestMessage) MarshalJSON ¶ added in v0.4.0
func (c ChatRequestMessage) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatRequestMessage.
func (*ChatRequestMessage) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatRequestMessage) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatRequestMessage.
type ChatRequestMessageClassification ¶ added in v0.4.0
type ChatRequestMessageClassification interface { // GetChatRequestMessage returns the ChatRequestMessage content of the underlying type. GetChatRequestMessage() *ChatRequestMessage }
ChatRequestMessageClassification provides polymorphic access to related types. Call the interface's GetChatRequestMessage() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *ChatRequestAssistantMessage, *ChatRequestFunctionMessage, *ChatRequestMessage, *ChatRequestSystemMessage, *ChatRequestToolMessage, - *ChatRequestUserMessage
type ChatRequestSystemMessage ¶ added in v0.4.0
type ChatRequestSystemMessage struct { // REQUIRED; The contents of the system message. Content *ChatRequestSystemMessageContent // An optional name for the participant. Name *string // contains filtered or unexported fields }
ChatRequestSystemMessage - A request chat message containing system instructions that influence how the model will generate a chat completions response.
func (*ChatRequestSystemMessage) GetChatRequestMessage ¶ added in v0.4.0
func (c *ChatRequestSystemMessage) GetChatRequestMessage() *ChatRequestMessage
GetChatRequestMessage implements the ChatRequestMessageClassification interface for type ChatRequestSystemMessage.
func (ChatRequestSystemMessage) MarshalJSON ¶ added in v0.4.0
func (c ChatRequestSystemMessage) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatRequestSystemMessage.
func (*ChatRequestSystemMessage) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatRequestSystemMessage) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatRequestSystemMessage.
type ChatRequestSystemMessageContent ¶ added in v0.7.0
type ChatRequestSystemMessageContent struct {
// contains filtered or unexported fields
}
ChatRequestSystemMessageContent contains the content for a ChatRequestSystemMessage. NOTE: This should be created using azopenai.NewChatRequestSystemMessageContent
func NewChatRequestSystemMessageContent ¶ added in v0.7.0
func NewChatRequestSystemMessageContent[T []ChatMessageTextContentItem | string](value T) *ChatRequestSystemMessageContent
NewChatRequestSystemMessageContent creates a azopenai.ChatRequestSystemMessageContent.
func (ChatRequestSystemMessageContent) MarshalJSON ¶ added in v0.7.0
func (c ChatRequestSystemMessageContent) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatRequestSystemMessageContent.
type ChatRequestToolMessage ¶ added in v0.4.0
type ChatRequestToolMessage struct { // REQUIRED; The content of the message. Content *ChatRequestToolMessageContent // REQUIRED; The ID of the tool call resolved by the provided content. ToolCallID *string // contains filtered or unexported fields }
ChatRequestToolMessage - A request chat message representing requested output from a configured tool.
func (*ChatRequestToolMessage) GetChatRequestMessage ¶ added in v0.4.0
func (c *ChatRequestToolMessage) GetChatRequestMessage() *ChatRequestMessage
GetChatRequestMessage implements the ChatRequestMessageClassification interface for type ChatRequestToolMessage.
func (ChatRequestToolMessage) MarshalJSON ¶ added in v0.4.0
func (c ChatRequestToolMessage) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatRequestToolMessage.
func (*ChatRequestToolMessage) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatRequestToolMessage) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatRequestToolMessage.
type ChatRequestToolMessageContent ¶ added in v0.7.0
type ChatRequestToolMessageContent struct {
// contains filtered or unexported fields
}
ChatRequestToolMessageContent contains the content for a ChatRequestToolMessage. NOTE: This should be created using azopenai.NewChatRequestToolMessageContent
func NewChatRequestToolMessageContent ¶ added in v0.7.0
func NewChatRequestToolMessageContent[T []ChatMessageTextContentItem | string](value T) *ChatRequestToolMessageContent
NewChatRequestToolMessageContent creates a azopenai.ChatRequestToolMessageContent.
func (ChatRequestToolMessageContent) MarshalJSON ¶ added in v0.7.0
func (c ChatRequestToolMessageContent) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatRequestToolMessageContent.
type ChatRequestUserMessage ¶ added in v0.4.0
type ChatRequestUserMessage struct { // REQUIRED; The contents of the user message, with available input types varying by selected model. Content *ChatRequestUserMessageContent // An optional name for the participant. Name *string // contains filtered or unexported fields }
ChatRequestUserMessage - A request chat message representing user input to the assistant.
func (*ChatRequestUserMessage) GetChatRequestMessage ¶ added in v0.4.0
func (c *ChatRequestUserMessage) GetChatRequestMessage() *ChatRequestMessage
GetChatRequestMessage implements the ChatRequestMessageClassification interface for type ChatRequestUserMessage.
func (ChatRequestUserMessage) MarshalJSON ¶ added in v0.4.0
func (c ChatRequestUserMessage) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatRequestUserMessage.
func (*ChatRequestUserMessage) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatRequestUserMessage) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatRequestUserMessage.
type ChatRequestUserMessageContent ¶ added in v0.4.0
type ChatRequestUserMessageContent struct {
// contains filtered or unexported fields
}
ChatRequestUserMessageContent contains the user prompt - either as a single string or as a []ChatCompletionRequestMessageContentPart, enabling images and text as input.
NOTE: This should be created using azopenai.NewChatRequestUserMessageContent
func NewChatRequestUserMessageContent ¶ added in v0.4.0
func NewChatRequestUserMessageContent[T string | []ChatCompletionRequestMessageContentPartClassification](v T) *ChatRequestUserMessageContent
NewChatRequestUserMessageContent creates a azopenai.ChatRequestUserMessageContent.
func (ChatRequestUserMessageContent) MarshalJSON ¶ added in v0.4.0
func (c ChatRequestUserMessageContent) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type Error.
func (*ChatRequestUserMessageContent) UnmarshalJSON ¶ added in v0.5.0
func (c *ChatRequestUserMessageContent) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatRequestUserMessageContent.
type ChatResponseMessage ¶ added in v0.4.0
type ChatResponseMessage struct { // REQUIRED; The content of the message. Content *string // REQUIRED; The refusal message generated by the model. Refusal *string // REQUIRED; The chat role associated with the message. Role *ChatRole // If Azure OpenAI chat extensions are configured, this array represents the incremental steps performed by those extensions // while processing the chat completions request. Context *AzureChatExtensionsMessageContext // The function call that must be resolved and have its output appended to subsequent input messages for the chat completions // request to resolve as configured. FunctionCall *FunctionCall // The tool calls that must be resolved and have their outputs appended to subsequent input messages for the chat completions // request to resolve as configured. ToolCalls []ChatCompletionsToolCallClassification }
ChatResponseMessage - A representation of a chat message as received in a response.
func (ChatResponseMessage) MarshalJSON ¶ added in v0.4.0
func (c ChatResponseMessage) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatResponseMessage.
func (*ChatResponseMessage) UnmarshalJSON ¶ added in v0.4.0
func (c *ChatResponseMessage) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatResponseMessage.
type ChatRole ¶
type ChatRole string
ChatRole - A description of the intended purpose of a message within a chat completions interaction.
const ( // ChatRoleAssistant - The role that provides responses to system-instructed, user-prompted input. ChatRoleAssistant ChatRole = "assistant" // ChatRoleFunction - The role that provides function results for chat completions. ChatRoleFunction ChatRole = "function" // ChatRoleSystem - The role that instructs or sets the behavior of the assistant. ChatRoleSystem ChatRole = "system" // ChatRoleTool - The role that represents extension tool activity within a chat completions operation. ChatRoleTool ChatRole = "tool" // ChatRoleUser - The role that provides input for chat completions. ChatRoleUser ChatRole = "user" )
func PossibleChatRoleValues ¶
func PossibleChatRoleValues() []ChatRole
PossibleChatRoleValues returns the possible values for the ChatRole const type.
type ChatTokenLogProbabilityInfo ¶ added in v0.5.0
type ChatTokenLogProbabilityInfo struct { // REQUIRED; A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters // are represented by multiple tokens and their byte representations must be combined to // generate the correct text representation. Can be null if there is no bytes representation for the token. Bytes []int32 // REQUIRED; The log probability of the message content token. Logprob *float32 // REQUIRED; The message content token. Token *string }
ChatTokenLogProbabilityInfo - A representation of the log probability information for a single message content token.
func (ChatTokenLogProbabilityInfo) MarshalJSON ¶ added in v0.5.0
func (c ChatTokenLogProbabilityInfo) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatTokenLogProbabilityInfo.
func (*ChatTokenLogProbabilityInfo) UnmarshalJSON ¶ added in v0.5.0
func (c *ChatTokenLogProbabilityInfo) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatTokenLogProbabilityInfo.
type ChatTokenLogProbabilityResult ¶ added in v0.5.0
type ChatTokenLogProbabilityResult struct { // REQUIRED; A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters // are represented by multiple tokens and their byte representations must be combined to // generate the correct text representation. Can be null if there is no bytes representation for the token. Bytes []int32 // REQUIRED; The log probability of the message content token. Logprob *float32 // REQUIRED; The message content token. Token *string // REQUIRED; The list of most likely tokens and their log probability information, as requested via 'top_logprobs'. TopLogProbs []ChatTokenLogProbabilityInfo }
ChatTokenLogProbabilityResult - A representation of the log probability information for a single content token, including a list of most likely tokens if 'top_logprobs' were requested.
func (ChatTokenLogProbabilityResult) MarshalJSON ¶ added in v0.5.0
func (c ChatTokenLogProbabilityResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChatTokenLogProbabilityResult.
func (*ChatTokenLogProbabilityResult) UnmarshalJSON ¶ added in v0.5.0
func (c *ChatTokenLogProbabilityResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChatTokenLogProbabilityResult.
type Choice ¶
type Choice struct { // REQUIRED; Reason for finishing FinishReason *CompletionsFinishReason // REQUIRED; The ordered index associated with this completions choice. Index *int32 // REQUIRED; The log probabilities model for tokens associated with this completions choice. LogProbs *ChoiceLogProbs // REQUIRED; The generated text for a given completions prompt. Text *string // Information about the content filtering category (hate, sexual, violence, selfharm), if it has been detected, as well as // the severity level (verylow, low, medium, high-scale that determines the // intensity and risk level of harmful content) and if it has been filtered or not. ContentFilterResults *ContentFilterResultsForChoice }
Choice - The representation of a single prompt completion as part of an overall completions request. Generally, n choices are generated per provided prompt with a default value of 1. Token limits and other settings may limit the number of choices generated.
func (Choice) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Choice.
func (*Choice) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface for type Choice.
type ChoiceLogProbs ¶
type ChoiceLogProbs struct { // REQUIRED; The text offsets associated with tokens in this completions data. TextOffset []int32 // REQUIRED; A collection of log probability values for the tokens in this completions data. TokenLogProbs []float32 // REQUIRED; The textual forms of tokens evaluated in this probability model. Tokens []string // REQUIRED; A mapping of tokens to maximum log probability values in this completions data. TopLogProbs []map[string]*float32 }
ChoiceLogProbs - The log probabilities model for tokens associated with this completions choice.
func (ChoiceLogProbs) MarshalJSON ¶
func (c ChoiceLogProbs) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChoiceLogProbs.
func (*ChoiceLogProbs) UnmarshalJSON ¶
func (c *ChoiceLogProbs) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChoiceLogProbs.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client contains the methods for the OpenAI group. Don't use this type directly, use a constructor function instead.
func NewClient ¶
func NewClient(endpoint string, credential azcore.TokenCredential, options *ClientOptions) (*Client, error)
NewClient creates a new instance of Client that connects to an Azure OpenAI endpoint.
- endpoint - Azure OpenAI service endpoint, for example: https://{your-resource-name}.openai.azure.com
- credential - used to authorize requests. Usually a credential from github.com/Azure/azure-sdk-for-go/sdk/azidentity.
- options - client options, pass nil to accept the default values.
Example ¶
package main import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" ) func main() { dac, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } // NOTE: this constructor creates a client that connects to an Azure OpenAI endpoint. // To connect to the public OpenAI endpoint, use azopenai.NewClientForOpenAI client, err := azopenai.NewClient("https://<your-azure-openai-host>.openai.azure.com", dac, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } _ = client }
Output:
func NewClientForOpenAI ¶
func NewClientForOpenAI(endpoint string, credential *azcore.KeyCredential, options *ClientOptions) (*Client, error)
NewClientForOpenAI creates a new instance of Client which connects to the public OpenAI endpoint.
- endpoint - OpenAI service endpoint, for example: https://api.openai.com/v1
- credential - used to authorize requests with an API Key credential
- options - client options, pass nil to accept the default values.
Example ¶
package main import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) func main() { keyCredential := azcore.NewKeyCredential("<OpenAI-APIKey>") // NOTE: this constructor creates a client that connects to the public OpenAI endpoint. // To connect to an Azure OpenAI endpoint, use azopenai.NewClient() or azopenai.NewClientWithyKeyCredential. client, err := azopenai.NewClientForOpenAI("https://api.openai.com/v1", keyCredential, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } _ = client }
Output:
func NewClientWithKeyCredential ¶
func NewClientWithKeyCredential(endpoint string, credential *azcore.KeyCredential, options *ClientOptions) (*Client, error)
NewClientWithKeyCredential creates a new instance of Client that connects to an Azure OpenAI endpoint.
- endpoint - Azure OpenAI service endpoint, for example: https://{your-resource-name}.openai.azure.com
- credential - used to authorize requests with an API Key credential
- options - client options, pass nil to accept the default values.
Example ¶
package main import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) func main() { keyCredential := azcore.NewKeyCredential("<Azure-OpenAI-APIKey>") // NOTE: this constructor creates a client that connects to an Azure OpenAI endpoint. // To connect to the public OpenAI endpoint, use azopenai.NewClientForOpenAI client, err := azopenai.NewClientWithKeyCredential("https://<your-azure-openai-host>.openai.azure.com", keyCredential, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } _ = client }
Output:
func (*Client) AddUploadPart ¶ added in v0.7.0
func (client *Client) AddUploadPart(ctx context.Context, uploadID string, data io.ReadSeekCloser, options *AddUploadPartOptions) (AddUploadPartResponse, error)
AddUploadPart - Adds a Part to an Upload object. A Part represents a chunk of bytes from the file you are trying to upload. Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB. It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you complete the Upload. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2024-10-01-preview
- uploadID - The ID of the upload associated with this operation.
- data - The chunk of bytes for this Part.
- options - AddUploadPartOptions contains the optional parameters for the Client.AddUploadPart method.
func (*Client) CancelBatch ¶ added in v0.6.2
func (client *Client) CancelBatch(ctx context.Context, batchID string, options *CancelBatchOptions) (CancelBatchResponse, error)
CancelBatch - Gets details for a single batch specified by the given batchID. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2024-10-01-preview
- batchID - The identifier of the batch.
- options - CancelBatchOptions contains the optional parameters for the Client.CancelBatch method.
func (*Client) CancelUpload ¶ added in v0.7.0
func (client *Client) CancelUpload(ctx context.Context, uploadID string, options *CancelUploadOptions) (CancelUploadResponse, error)
CancelUpload - Cancels the Upload. No Parts may be added after an Upload is cancelled. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2024-10-01-preview
- uploadID - The ID of the upload associated with this operation.
- options - CancelUploadOptions contains the optional parameters for the Client.CancelUpload method.
func (*Client) CompleteUpload ¶ added in v0.7.0
func (client *Client) CompleteUpload(ctx context.Context, uploadID string, requestBody CompleteUploadRequest, options *CompleteUploadOptions) (CompleteUploadResponse, error)
CompleteUpload - Completes the Upload. Within the returned Upload object, there is a nested File object that is ready to use in the rest of the platform. You can specify the order of the Parts by passing in an ordered list of the Part IDs. The number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2024-10-01-preview
- uploadID - The ID of the upload associated with this operation.
- requestBody - The request body for the completion operation.
- options - CompleteUploadOptions contains the optional parameters for the Client.CompleteUpload method.
func (*Client) CreateBatch ¶ added in v0.6.2
func (client *Client) CreateBatch(ctx context.Context, createBatchRequest BatchCreateRequest, options *CreateBatchOptions) (CreateBatchResponse, error)
CreateBatch - Creates and executes a batch from an uploaded file of requests. Response includes details of the enqueued job including job status. The ID of the result file is added to the response once complete. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2024-10-01-preview
- createBatchRequest - The specification of the batch to create and execute.
- options - CreateBatchOptions contains the optional parameters for the Client.CreateBatch method.
func (*Client) CreateUpload ¶ added in v0.7.0
func (client *Client) CreateUpload(ctx context.Context, requestBody CreateUploadRequest, options *CreateUploadOptions) (CreateUploadResponse, error)
CreateUpload - Creates an intermediate Upload object that you can add Parts to. Currently, an Upload can accept at most 8 GB in total and expires after an hour after you create it. Once you complete the Upload, we will create a File object that contains all the parts you uploaded. This File is usable in the rest of our platform as a regular File object. For certain purposes, the correct mime_type must be specified. Please refer to documentation for the supported MIME types for your use case. For guidance on the proper filename extensions for each purpose, please follow the documentation on creating a File. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2024-10-01-preview
- requestBody - The request body for the operation options.
- options - CreateUploadOptions contains the optional parameters for the Client.CreateUpload method.
func (*Client) DeleteFile ¶ added in v0.6.2
func (client *Client) DeleteFile(ctx context.Context, fileID string, options *DeleteFileOptions) (DeleteFileResponse, error)
DeleteFile - Delete a previously uploaded file. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2024-10-01-preview
- fileID - The ID of the file to delete.
- options - DeleteFileOptions contains the optional parameters for the Client.DeleteFile method.
func (*Client) GenerateSpeechFromText ¶ added in v0.5.0
func (client *Client) GenerateSpeechFromText(ctx context.Context, body SpeechGenerationOptions, options *GenerateSpeechFromTextOptions) (GenerateSpeechFromTextResponse, error)
GenerateSpeechFromText - Generates text-to-speech audio from the input text. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2024-10-01-preview
- body - A representation of the request options that control the behavior of a text-to-speech operation.
- options - GenerateSpeechFromTextOptions contains the optional parameters for the Client.GenerateSpeechFromText method.
Example ¶
package main import ( "context" "fmt" "io" "log" "os" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" ) func main() { openAIKey := os.Getenv("OPENAI_API_KEY") // Ex: "https://api.openai.com/v1" openAIEndpoint := os.Getenv("OPENAI_ENDPOINT") modelDeploymentID := "tts-1" if openAIKey == "" || openAIEndpoint == "" || modelDeploymentID == "" { fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n") return } keyCredential := azcore.NewKeyCredential(openAIKey) client, err := azopenai.NewClientForOpenAI(openAIEndpoint, keyCredential, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } audioResp, err := client.GenerateSpeechFromText(context.Background(), azopenai.SpeechGenerationOptions{ Input: to.Ptr("i am a computer"), Voice: to.Ptr(azopenai.SpeechVoiceAlloy), ResponseFormat: to.Ptr(azopenai.SpeechGenerationResponseFormatFlac), DeploymentName: to.Ptr("tts-1"), }, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } defer audioResp.Body.Close() audioBytes, err := io.ReadAll(audioResp.Body) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } fmt.Fprintf(os.Stderr, "Got %d bytes of FLAC audio\n", len(audioBytes)) }
Output:
func (*Client) GetAudioTranscription ¶ added in v0.3.0
func (client *Client) GetAudioTranscription(ctx context.Context, body AudioTranscriptionOptions, options *GetAudioTranscriptionOptions) (GetAudioTranscriptionResponse, error)
GetAudioTranscription gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the written language corresponding to the language it was spoken in. Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the written language corresponding to the language it was spoken in. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2023-09-01-preview
- body - contains parameters to specify audio data to transcribe and control the transcription.
- options - optional parameters for this method.
Example ¶
package main import ( "context" "fmt" "log" "os" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" ) func main() { azureOpenAIKey := os.Getenv("AOAI_WHISPER_API_KEY") // Ex: "https://<your-azure-openai-host>.openai.azure.com" azureOpenAIEndpoint := os.Getenv("AOAI_WHISPER_ENDPOINT") modelDeploymentID := os.Getenv("AOAI_WHISPER_MODEL") if azureOpenAIKey == "" || azureOpenAIEndpoint == "" || modelDeploymentID == "" { fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n") return } keyCredential := azcore.NewKeyCredential(azureOpenAIKey) client, err := azopenai.NewClientWithKeyCredential(azureOpenAIEndpoint, keyCredential, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } mp3Bytes, err := os.ReadFile("testdata/sampledata_audiofiles_myVoiceIsMyPassportVerifyMe01.mp3") if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } resp, err := client.GetAudioTranscription(context.TODO(), azopenai.AudioTranscriptionOptions{ File: mp3Bytes, // this will return _just_ the translated text. Other formats are available, which return // different or additional metadata. See [azopenai.AudioTranscriptionFormat] for more examples. ResponseFormat: to.Ptr(azopenai.AudioTranscriptionFormatText), DeploymentName: &modelDeploymentID, }, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } fmt.Fprintf(os.Stderr, "Transcribed text: %s\n", *resp.Text) }
Output:
func (*Client) GetAudioTranslation ¶ added in v0.3.0
func (client *Client) GetAudioTranslation(ctx context.Context, body AudioTranslationOptions, options *GetAudioTranslationOptions) (GetAudioTranslationResponse, error)
GetAudioTranslation gets English language transcribed text and associated metadata from provided spoken audio data. Gets English language transcribed text and associated metadata from provided spoken audio data. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2023-09-01-preview
- body - contains parameters to specify audio data to translate and control the translation.
- options - optional parameters for this method.
func (*Client) GetBatch ¶ added in v0.6.2
func (client *Client) GetBatch(ctx context.Context, batchID string, options *GetBatchOptions) (GetBatchResponse, error)
GetBatch - Gets details for a single batch specified by the given batchID. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2024-10-01-preview
- batchID - The identifier of the batch.
- options - GetBatchOptions contains the optional parameters for the Client.GetBatch method.
func (*Client) GetChatCompletions ¶
func (client *Client) GetChatCompletions(ctx context.Context, body ChatCompletionsOptions, options *GetChatCompletionsOptions) (GetChatCompletionsResponse, error)
GetChatCompletions - Gets chat completions for the provided chat messages. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data. If the operation fails it returns an *azcore.ResponseError type.
- body - The configuration information for a chat completions request. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.
- options - GetChatCompletionsOptions contains the optional parameters for the Client.getChatCompletions method.
Example ¶
package main import ( "context" "fmt" "log" "os" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) func main() { azureOpenAIKey := os.Getenv("AOAI_CHAT_COMPLETIONS_API_KEY") modelDeploymentID := os.Getenv("AOAI_CHAT_COMPLETIONS_MODEL") // Ex: "https://<your-azure-openai-host>.openai.azure.com" azureOpenAIEndpoint := os.Getenv("AOAI_CHAT_COMPLETIONS_ENDPOINT") if azureOpenAIKey == "" || modelDeploymentID == "" || azureOpenAIEndpoint == "" { fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n") return } keyCredential := azcore.NewKeyCredential(azureOpenAIKey) // In Azure OpenAI you must deploy a model before you can use it in your client. For more information // see here: https://learn.microsoft.com/azure/cognitive-services/openai/how-to/create-resource client, err := azopenai.NewClientWithKeyCredential(azureOpenAIEndpoint, keyCredential, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } // This is a conversation in progress. // NOTE: all messages, regardless of role, count against token usage for this API. messages := []azopenai.ChatRequestMessageClassification{ // You set the tone and rules of the conversation with a prompt as the system role. &azopenai.ChatRequestSystemMessage{Content: azopenai.NewChatRequestSystemMessageContent("You are a helpful assistant. You will talk like a pirate.")}, // The user asks a question &azopenai.ChatRequestUserMessage{Content: azopenai.NewChatRequestUserMessageContent("Can you help me?")}, // The reply would come back from the ChatGPT. You'd add it to the conversation so we can maintain context. &azopenai.ChatRequestAssistantMessage{Content: azopenai.NewChatRequestAssistantMessageContent("Arrrr! Of course, me hearty! What can I do for ye?")}, // The user answers the question based on the latest reply. &azopenai.ChatRequestUserMessage{Content: azopenai.NewChatRequestUserMessageContent("What's the best way to train a parrot?")}, // from here you'd keep iterating, sending responses back from ChatGPT } gotReply := false resp, err := client.GetChatCompletions(context.TODO(), azopenai.ChatCompletionsOptions{ // This is a conversation in progress. // NOTE: all messages count against token usage for this API. Messages: messages, DeploymentName: &modelDeploymentID, }, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } for _, choice := range resp.Choices { gotReply = true if choice.ContentFilterResults != nil { fmt.Fprintf(os.Stderr, "Content filter results\n") if choice.ContentFilterResults.Error != nil { fmt.Fprintf(os.Stderr, " Error:%v\n", choice.ContentFilterResults.Error) } fmt.Fprintf(os.Stderr, " Hate: sev: %v, filtered: %v\n", *choice.ContentFilterResults.Hate.Severity, *choice.ContentFilterResults.Hate.Filtered) fmt.Fprintf(os.Stderr, " SelfHarm: sev: %v, filtered: %v\n", *choice.ContentFilterResults.SelfHarm.Severity, *choice.ContentFilterResults.SelfHarm.Filtered) fmt.Fprintf(os.Stderr, " Sexual: sev: %v, filtered: %v\n", *choice.ContentFilterResults.Sexual.Severity, *choice.ContentFilterResults.Sexual.Filtered) fmt.Fprintf(os.Stderr, " Violence: sev: %v, filtered: %v\n", *choice.ContentFilterResults.Violence.Severity, *choice.ContentFilterResults.Violence.Filtered) } if choice.Message != nil && choice.Message.Content != nil { fmt.Fprintf(os.Stderr, "Content[%d]: %s\n", *choice.Index, *choice.Message.Content) } if choice.FinishReason != nil { // this choice's conversation is complete. fmt.Fprintf(os.Stderr, "Finish reason[%d]: %s\n", *choice.Index, *choice.FinishReason) } } if gotReply { fmt.Fprintf(os.Stderr, "Got chat completions reply\n") } }
Output:
Example (BringYourOwnDataWithCognitiveSearch) ¶
With Azure OpenAI you can integrate data you've already uploaded to an Azure Cognitive Search index. For more information about this feature see the article "Azure OpenAI on your data".
package main import ( "context" "fmt" "log" "os" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" ) func main() { azureOpenAIKey := os.Getenv("AOAI_CHAT_COMPLETIONS_RAI_API_KEY") modelDeploymentID := os.Getenv("AOAI_CHAT_COMPLETIONS_RAI_MODEL") // Ex: "https://<your-azure-openai-host>.openai.azure.com" azureOpenAIEndpoint := os.Getenv("AOAI_CHAT_COMPLETIONS_RAI_ENDPOINT") // Azure Cognitive Search configuration searchIndex := os.Getenv("COGNITIVE_SEARCH_API_INDEX") searchEndpoint := os.Getenv("COGNITIVE_SEARCH_API_ENDPOINT") searchAPIKey := os.Getenv("COGNITIVE_SEARCH_API_KEY") if azureOpenAIKey == "" || modelDeploymentID == "" || azureOpenAIEndpoint == "" || searchIndex == "" || searchEndpoint == "" || searchAPIKey == "" { fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n") return } keyCredential := azcore.NewKeyCredential(azureOpenAIKey) // In Azure OpenAI you must deploy a model before you can use it in your client. For more information // see here: https://learn.microsoft.com/azure/cognitive-services/openai/how-to/create-resource client, err := azopenai.NewClientWithKeyCredential(azureOpenAIEndpoint, keyCredential, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } resp, err := client.GetChatCompletions(context.TODO(), azopenai.ChatCompletionsOptions{ Messages: []azopenai.ChatRequestMessageClassification{ &azopenai.ChatRequestUserMessage{Content: azopenai.NewChatRequestUserMessageContent("What are the differences between Azure Machine Learning and Azure AI services?")}, }, MaxTokens: to.Ptr[int32](512), AzureExtensionsOptions: []azopenai.AzureChatExtensionConfigurationClassification{ &azopenai.AzureSearchChatExtensionConfiguration{ // This allows Azure OpenAI to use an Azure Cognitive Search index. // // > Because the model has access to, and can reference specific sources to support its responses, answers are not only based on its pretrained knowledge // > but also on the latest information available in the designated data source. This grounding data also helps the model avoid generating responses // > based on outdated or incorrect information. // // Quote from here: https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/use-your-data Parameters: &azopenai.AzureSearchChatExtensionParameters{ Endpoint: &searchEndpoint, IndexName: &searchIndex, Authentication: &azopenai.OnYourDataAPIKeyAuthenticationOptions{ Key: &searchAPIKey, }, }, }, }, DeploymentName: &modelDeploymentID, }, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } // Contains contextual information from your Azure chat completion extensions, configured above in `AzureExtensionsOptions` msgContext := resp.Choices[0].Message.Context fmt.Fprintf(os.Stderr, "Extensions Context (length): %d\n", len(*msgContext.Citations[0].Content)) fmt.Fprintf(os.Stderr, "ChatRole: %s\nChat content: %s\n", *resp.Choices[0].Message.Role, *resp.Choices[0].Message.Content, ) }
Output:
Example (Functions) ¶
package main import ( "context" "encoding/json" "fmt" "log" "os" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" ) func main() { azureOpenAIKey := os.Getenv("AOAI_CHAT_COMPLETIONS_API_KEY") modelDeploymentID := os.Getenv("AOAI_CHAT_COMPLETIONS_MODEL") // Ex: "https://<your-azure-openai-host>.openai.azure.com" azureOpenAIEndpoint := os.Getenv("AOAI_CHAT_COMPLETIONS_ENDPOINT") if azureOpenAIKey == "" || modelDeploymentID == "" || azureOpenAIEndpoint == "" { fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n") return } keyCredential := azcore.NewKeyCredential(azureOpenAIKey) // In Azure OpenAI you must deploy a model before you can use it in your client. For more information // see here: https://learn.microsoft.com/azure/cognitive-services/openai/how-to/create-resource client, err := azopenai.NewClientWithKeyCredential(azureOpenAIEndpoint, keyCredential, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } jsonBytes, err := json.Marshal(map[string]any{ "required": []string{"location"}, "type": "object", "properties": map[string]any{ "location": map[string]any{ "type": "string", "description": "The city and state, e.g. San Francisco, CA", }, "unit": map[string]any{ "type": "string", "enum": []string{"celsius", "fahrenheit"}, }, }, }) if err != nil { panic(err) } funcDef := &azopenai.ChatCompletionsFunctionToolDefinitionFunction{ Name: to.Ptr("get_current_weather"), Description: to.Ptr("Get the current weather in a given location"), Parameters: jsonBytes, } resp, err := client.GetChatCompletions(context.TODO(), azopenai.ChatCompletionsOptions{ DeploymentName: &modelDeploymentID, Messages: []azopenai.ChatRequestMessageClassification{ &azopenai.ChatRequestUserMessage{ Content: azopenai.NewChatRequestUserMessageContent("What's the weather like in Boston, MA, in celsius?"), }, }, Tools: []azopenai.ChatCompletionsToolDefinitionClassification{ &azopenai.ChatCompletionsFunctionToolDefinition{ Function: funcDef, }, }, Temperature: to.Ptr[float32](0.0), }, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } funcCall := resp.Choices[0].Message.ToolCalls[0].(*azopenai.ChatCompletionsFunctionToolCall).Function // This is the function name we gave in the call to GetCompletions // Prints: Function name: "get_current_weather" fmt.Fprintf(os.Stderr, "Function name: %q\n", *funcCall.Name) // The arguments for your function come back as a JSON string var funcParams *struct { Location string `json:"location"` Unit string `json:"unit"` } err = json.Unmarshal([]byte(*funcCall.Arguments), &funcParams) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } // Prints: // Parameters: azopenai_test.location{Location:"Boston, MA", Unit:"celsius"} fmt.Fprintf(os.Stderr, "Parameters: %#v\n", *funcParams) }
Output:
Example (LegacyFunctions) ¶
package main import ( "context" "encoding/json" "fmt" "log" "os" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" ) func main() { azureOpenAIKey := os.Getenv("AOAI_CHAT_COMPLETIONS_MODEL_LEGACY_FUNCTIONS_API_KEY") modelDeploymentID := os.Getenv("AOAI_CHAT_COMPLETIONS_MODEL_LEGACY_FUNCTIONS_MODEL") // Ex: "https://<your-azure-openai-host>.openai.azure.com" azureOpenAIEndpoint := os.Getenv("AOAI_CHAT_COMPLETIONS_MODEL_LEGACY_FUNCTIONS_ENDPOINT") if azureOpenAIKey == "" || modelDeploymentID == "" || azureOpenAIEndpoint == "" { fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n") return } keyCredential := azcore.NewKeyCredential(azureOpenAIKey) // In Azure OpenAI you must deploy a model before you can use it in your client. For more information // see here: https://learn.microsoft.com/azure/cognitive-services/openai/how-to/create-resource client, err := azopenai.NewClientWithKeyCredential(azureOpenAIEndpoint, keyCredential, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } parametersJSON, err := json.Marshal(map[string]any{ "required": []string{"location"}, "type": "object", "properties": map[string]any{ "location": map[string]any{ "type": "string", "description": "The city and state, e.g. San Francisco, CA", }, "unit": map[string]any{ "type": "string", "enum": []string{"celsius", "fahrenheit"}, }, }, }) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } resp, err := client.GetChatCompletions(context.TODO(), azopenai.ChatCompletionsOptions{ DeploymentName: &modelDeploymentID, Messages: []azopenai.ChatRequestMessageClassification{ &azopenai.ChatRequestUserMessage{ Content: azopenai.NewChatRequestUserMessageContent("What's the weather like in Boston, MA, in celsius?"), }, }, FunctionCall: &azopenai.ChatCompletionsOptionsFunctionCall{ Value: to.Ptr("auto"), }, Functions: []azopenai.FunctionDefinition{ { Name: to.Ptr("get_current_weather"), Description: to.Ptr("Get the current weather in a given location"), Parameters: parametersJSON, }, }, Temperature: to.Ptr[float32](0.0), }, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } funcCall := resp.Choices[0].Message.FunctionCall // This is the function name we gave in the call to GetCompletions // Prints: Function name: "get_current_weather" fmt.Fprintf(os.Stderr, "Function name: %q\n", *funcCall.Name) // The arguments for your function come back as a JSON string var funcParams *struct { Location string `json:"location"` Unit string `json:"unit"` } err = json.Unmarshal([]byte(*funcCall.Arguments), &funcParams) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } // Prints: // Parameters: azopenai_test.location{Location:"Boston, MA", Unit:"celsius"} fmt.Fprintf(os.Stderr, "Parameters: %#v\n", *funcParams) }
Output:
Example (StructuredOutputs) ¶
package main import ( "context" "encoding/json" "fmt" "log" "os" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" ) func main() { // This example is a Go implementation of the example from this article: // https://openai.com/index/introducing-structured-outputs-in-the-api/ modelDeploymentID := os.Getenv("AOAI_CHAT_COMPLETIONS_STRUCTURED_OUTPUTS_MODEL") // Ex: "https://<your-azure-openai-host>.openai.azure.com" azureOpenAIEndpoint := os.Getenv("AOAI_CHAT_COMPLETIONS_STRUCTURED_OUTPUTS_ENDPOINT") if modelDeploymentID == "" || azureOpenAIEndpoint == "" { fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n") return } tokenCredential, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } client, err := azopenai.NewClient(azureOpenAIEndpoint, tokenCredential, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } structuredJSONToolDefParams := []byte(`{ "type": "object", "properties": { "table_name": { "type": "string", "enum": [ "orders" ] }, "columns": { "type": "array", "items": { "type": "string", "enum": [ "id", "status", "expected_delivery_date", "delivered_at", "shipped_at", "ordered_at", "canceled_at" ] } }, "conditions": { "type": "array", "items": { "type": "object", "properties": { "column": { "type": "string" }, "operator": { "type": "string", "enum": [ "=", ">", "<", ">=", "<=", "!=" ] }, "value": { "anyOf": [ { "type": "string" }, { "type": "number" }, { "type": "object", "properties": { "column_name": { "type": "string" } }, "required": [ "column_name" ], "additionalProperties": false } ] } }, "required": [ "column", "operator", "value" ], "additionalProperties": false } }, "order_by": { "type": "string", "enum": [ "asc", "desc" ] } }, "required": [ "table_name", "columns", "conditions", "order_by" ], "additionalProperties": false }`) resp, err := client.GetChatCompletions(context.TODO(), azopenai.ChatCompletionsOptions{ DeploymentName: &modelDeploymentID, Messages: []azopenai.ChatRequestMessageClassification{ &azopenai.ChatRequestAssistantMessage{ Content: azopenai.NewChatRequestAssistantMessageContent("You are a helpful assistant. The current date is August 6, 2024. You help users query for the data they are looking for by calling the query function."), }, &azopenai.ChatRequestUserMessage{ Content: azopenai.NewChatRequestUserMessageContent("look up all my orders in may of last year that were fulfilled but not delivered on time"), }, }, Tools: []azopenai.ChatCompletionsToolDefinitionClassification{ &azopenai.ChatCompletionsFunctionToolDefinition{ Function: &azopenai.ChatCompletionsFunctionToolDefinitionFunction{ Strict: to.Ptr(true), Name: to.Ptr("query"), Parameters: structuredJSONToolDefParams, }, }, }, }, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } // and now the results should contain proper JSON for the arguments, every time. fn := resp.Choices[0].Message.ToolCalls[0].(*azopenai.ChatCompletionsFunctionToolCall).Function argumentsObj := map[string]any{} err = json.Unmarshal([]byte(*fn.Arguments), &argumentsObj) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } fmt.Printf("%#v\n", argumentsObj) }
Output:
Example (StructuredOutputs_responseFormat) ¶
package main import ( "context" "encoding/json" "fmt" "log" "os" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" ) func main() { // This example is a Go implementation of the example from this article: // https://openai.com/index/introducing-structured-outputs-in-the-api/ modelDeploymentID := os.Getenv("AOAI_CHAT_COMPLETIONS_STRUCTURED_OUTPUTS_MODEL") // Ex: "https://<your-azure-openai-host>.openai.azure.com" azureOpenAIEndpoint := os.Getenv("AOAI_CHAT_COMPLETIONS_STRUCTURED_OUTPUTS_ENDPOINT") if modelDeploymentID == "" || azureOpenAIEndpoint == "" { fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n") return } // In Azure OpenAI you must deploy a model before you can use it in your client. For more information // see here: https://learn.microsoft.com/azure/cognitive-services/openai/how-to/create-resource tokenCredential, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } client, err := azopenai.NewClient(azureOpenAIEndpoint, tokenCredential, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } structuredOutputJSONSchema := []byte(`{ "type": "object", "properties": { "steps": { "type": "array", "items": { "type": "object", "properties": { "explanation": { "type": "string" }, "output": { "type": "string" } }, "required": [ "explanation", "output" ], "additionalProperties": false } }, "final_answer": { "type": "string" } }, "required": [ "steps", "final_answer" ], "additionalProperties": false }`) resp, err := client.GetChatCompletions(context.TODO(), azopenai.ChatCompletionsOptions{ DeploymentName: &modelDeploymentID, Messages: []azopenai.ChatRequestMessageClassification{ &azopenai.ChatRequestAssistantMessage{ Content: azopenai.NewChatRequestAssistantMessageContent("You are a helpful math tutor."), }, &azopenai.ChatRequestUserMessage{ Content: azopenai.NewChatRequestUserMessageContent("solve 8x + 31 = 2"), }, }, ResponseFormat: &azopenai.ChatCompletionsJSONSchemaResponseFormat{ JSONSchema: &azopenai.ChatCompletionsJSONSchemaResponseFormatJSONSchema{ Name: to.Ptr("math_response"), Strict: to.Ptr(true), Schema: structuredOutputJSONSchema, }, }, }, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } responseObj := map[string]any{} err = json.Unmarshal([]byte(*resp.Choices[0].Message.Content), &responseObj) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } fmt.Printf("%#v", responseObj) }
Output:
Example (Vision) ¶
package main import ( "context" "fmt" "log" "os" "time" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" ) func main() { azureOpenAIKey := os.Getenv("AOAI_VISION_API_KEY") modelDeployment := os.Getenv("AOAI_VISION_MODEL") // ex: gpt-4-vision-preview" // Ex: "https://<your-azure-openai-host>.openai.azure.com" azureOpenAIEndpoint := os.Getenv("AOAI_VISION_ENDPOINT") if azureOpenAIKey == "" || modelDeployment == "" || azureOpenAIEndpoint == "" { fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n") return } keyCredential := azcore.NewKeyCredential(azureOpenAIKey) // In Azure OpenAI you must deploy a model before you can use it in your client. For more information // see here: https://learn.microsoft.com/azure/cognitive-services/openai/how-to/create-resource client, err := azopenai.NewClientWithKeyCredential(azureOpenAIEndpoint, keyCredential, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } imageURL := "https://www.bing.com/th?id=OHR.BradgateFallow_EN-US3932725763_1920x1080.jpg" content := azopenai.NewChatRequestUserMessageContent([]azopenai.ChatCompletionRequestMessageContentPartClassification{ &azopenai.ChatCompletionRequestMessageContentPartText{ Text: to.Ptr("Describe this image"), }, &azopenai.ChatCompletionRequestMessageContentPartImage{ ImageURL: &azopenai.ChatCompletionRequestMessageContentPartImageURL{ URL: &imageURL, }, }, }) ctx, cancel := context.WithTimeout(context.TODO(), time.Minute) defer cancel() resp, err := client.GetChatCompletions(ctx, azopenai.ChatCompletionsOptions{ Messages: []azopenai.ChatRequestMessageClassification{ &azopenai.ChatRequestUserMessage{ Content: content, }, }, MaxTokens: to.Ptr[int32](512), DeploymentName: to.Ptr(modelDeployment), }, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } for _, choice := range resp.Choices { if choice.Message != nil && choice.Message.Content != nil { // Prints "Result: The image shows two deer standing in a field of tall, autumn-colored ferns" fmt.Fprintf(os.Stderr, "Result: %s\n", *choice.Message.Content) } } }
Output:
func (*Client) GetChatCompletionsStream ¶
func (client *Client) GetChatCompletionsStream(ctx context.Context, body ChatCompletionsStreamOptions, options *GetChatCompletionsStreamOptions) (GetChatCompletionsStreamResponse, error)
GetChatCompletionsStream - Return the chat completions for a given prompt as a sequence of events. If the operation fails it returns an *azcore.ResponseError type.
- options - GetCompletionsOptions contains the optional parameters for the Client.GetCompletions method.
Example ¶
package main import ( "context" "errors" "fmt" "io" "log" "os" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" ) func main() { azureOpenAIKey := os.Getenv("AOAI_CHAT_COMPLETIONS_API_KEY") modelDeploymentID := os.Getenv("AOAI_CHAT_COMPLETIONS_MODEL") // Ex: "https://<your-azure-openai-host>.openai.azure.com" azureOpenAIEndpoint := os.Getenv("AOAI_CHAT_COMPLETIONS_ENDPOINT") if azureOpenAIKey == "" || modelDeploymentID == "" || azureOpenAIEndpoint == "" { fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n") return } keyCredential := azcore.NewKeyCredential(azureOpenAIKey) // In Azure OpenAI you must deploy a model before you can use it in your client. For more information // see here: https://learn.microsoft.com/azure/cognitive-services/openai/how-to/create-resource client, err := azopenai.NewClientWithKeyCredential(azureOpenAIEndpoint, keyCredential, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } // This is a conversation in progress. // NOTE: all messages, regardless of role, count against token usage for this API. messages := []azopenai.ChatRequestMessageClassification{ // You set the tone and rules of the conversation with a prompt as the system role. &azopenai.ChatRequestSystemMessage{Content: azopenai.NewChatRequestSystemMessageContent("You are a helpful assistant. You will talk like a pirate and limit your responses to 20 words or less.")}, // The user asks a question &azopenai.ChatRequestUserMessage{Content: azopenai.NewChatRequestUserMessageContent("Can you help me?")}, // The reply would come back from the ChatGPT. You'd add it to the conversation so we can maintain context. &azopenai.ChatRequestAssistantMessage{Content: azopenai.NewChatRequestAssistantMessageContent("Arrrr! Of course, me hearty! What can I do for ye?")}, // The user answers the question based on the latest reply. &azopenai.ChatRequestUserMessage{Content: azopenai.NewChatRequestUserMessageContent("What's the best way to train a parrot?")}, // from here you'd keep iterating, sending responses back from ChatGPT } resp, err := client.GetChatCompletionsStream(context.TODO(), azopenai.ChatCompletionsStreamOptions{ // This is a conversation in progress. // NOTE: all messages count against token usage for this API. Messages: messages, N: to.Ptr[int32](1), DeploymentName: &modelDeploymentID, }, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } defer resp.ChatCompletionsStream.Close() gotReply := false for { chatCompletions, err := resp.ChatCompletionsStream.Read() if errors.Is(err, io.EOF) { break } if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } for _, choice := range chatCompletions.Choices { gotReply = true text := "" if choice.Delta.Content != nil { text = *choice.Delta.Content } role := "" if choice.Delta.Role != nil { role = string(*choice.Delta.Role) } fmt.Fprintf(os.Stderr, "Content[%d], role %q: %q\n", *choice.Index, role, text) } } if gotReply { fmt.Fprintf(os.Stderr, "Got chat completions streaming reply\n") } }
Output:
func (*Client) GetCompletions ¶
func (client *Client) GetCompletions(ctx context.Context, body CompletionsOptions, options *GetCompletionsOptions) (GetCompletionsResponse, error)
GetCompletions - Gets completions for the provided input prompts. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data. If the operation fails it returns an *azcore.ResponseError type.
- body - The configuration information for a completions request. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.
- options - GetCompletionsOptions contains the optional parameters for the Client.getCompletions method.
Example ¶
package main import ( "context" "fmt" "log" "os" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" ) func main() { azureOpenAIKey := os.Getenv("AOAI_COMPLETIONS_API_KEY") modelDeployment := os.Getenv("AOAI_COMPLETIONS_MODEL") // Ex: "https://<your-azure-openai-host>.openai.azure.com" azureOpenAIEndpoint := os.Getenv("AOAI_COMPLETIONS_ENDPOINT") if azureOpenAIKey == "" || modelDeployment == "" || azureOpenAIEndpoint == "" { fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n") return } keyCredential := azcore.NewKeyCredential(azureOpenAIKey) // In Azure OpenAI you must deploy a model before you can use it in your client. For more information // see here: https://learn.microsoft.com/azure/cognitive-services/openai/how-to/create-resource client, err := azopenai.NewClientWithKeyCredential(azureOpenAIEndpoint, keyCredential, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } resp, err := client.GetCompletions(context.TODO(), azopenai.CompletionsOptions{ Prompt: []string{"What is Azure OpenAI, in 20 words or less"}, MaxTokens: to.Ptr(int32(2048)), Temperature: to.Ptr(float32(0.0)), DeploymentName: &modelDeployment, }, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } for _, choice := range resp.Choices { fmt.Fprintf(os.Stderr, "Result: %s\n", *choice.Text) } }
Output:
func (*Client) GetCompletionsStream ¶
func (client *Client) GetCompletionsStream(ctx context.Context, body CompletionsStreamOptions, options *GetCompletionsStreamOptions) (GetCompletionsStreamResponse, error)
GetCompletionsStream - Return the completions for a given prompt as a sequence of events. If the operation fails it returns an *azcore.ResponseError type.
- options - GetCompletionsOptions contains the optional parameters for the Client.GetCompletions method.
Example ¶
package main import ( "context" "errors" "fmt" "io" "log" "os" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" ) func main() { azureOpenAIKey := os.Getenv("AOAI_COMPLETIONS_API_KEY") modelDeploymentID := os.Getenv("AOAI_COMPLETIONS_MODEL") // Ex: "https://<your-azure-openai-host>.openai.azure.com" azureOpenAIEndpoint := os.Getenv("AOAI_COMPLETIONS_ENDPOINT") if azureOpenAIKey == "" || modelDeploymentID == "" || azureOpenAIEndpoint == "" { fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n") return } keyCredential := azcore.NewKeyCredential(azureOpenAIKey) // In Azure OpenAI you must deploy a model before you can use it in your client. For more information // see here: https://learn.microsoft.com/azure/cognitive-services/openai/how-to/create-resource client, err := azopenai.NewClientWithKeyCredential(azureOpenAIEndpoint, keyCredential, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } resp, err := client.GetCompletionsStream(context.TODO(), azopenai.CompletionsStreamOptions{ Prompt: []string{"What is Azure OpenAI, in 20 words or less?"}, MaxTokens: to.Ptr(int32(2048)), Temperature: to.Ptr(float32(0.0)), DeploymentName: &modelDeploymentID, }, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } defer resp.CompletionsStream.Close() for { entry, err := resp.CompletionsStream.Read() if errors.Is(err, io.EOF) { fmt.Fprintf(os.Stderr, "\n*** No more completions ***\n") break } if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } for _, choice := range entry.Choices { fmt.Fprintf(os.Stderr, "Result: %s\n", *choice.Text) } } }
Output:
func (*Client) GetEmbeddings ¶
func (client *Client) GetEmbeddings(ctx context.Context, body EmbeddingsOptions, options *GetEmbeddingsOptions) (GetEmbeddingsResponse, error)
GetEmbeddings - Return the embeddings for a given prompt. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2024-10-01-preview
- body - The configuration information for an embeddings request. Embeddings measure the relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar scenarios.
- options - GetEmbeddingsOptions contains the optional parameters for the Client.GetEmbeddings method.
Example ¶
package main import ( "context" "fmt" "log" "os" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) func main() { azureOpenAIKey := os.Getenv("AOAI_EMBEDDINGS_API_KEY") modelDeploymentID := os.Getenv("AOAI_EMBEDDINGS_MODEL") // Ex: "https://<your-azure-openai-host>.openai.azure.com" azureOpenAIEndpoint := os.Getenv("AOAI_EMBEDDINGS_ENDPOINT") if azureOpenAIKey == "" || modelDeploymentID == "" || azureOpenAIEndpoint == "" { fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n") return } keyCredential := azcore.NewKeyCredential(azureOpenAIKey) // In Azure OpenAI you must deploy a model before you can use it in your client. For more information // see here: https://learn.microsoft.com/azure/cognitive-services/openai/how-to/create-resource client, err := azopenai.NewClientWithKeyCredential(azureOpenAIEndpoint, keyCredential, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } resp, err := client.GetEmbeddings(context.TODO(), azopenai.EmbeddingsOptions{ Input: []string{"The food was delicious and the waiter..."}, DeploymentName: &modelDeploymentID, }, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } for _, embed := range resp.Data { // embed.Embedding contains the embeddings for this input index. fmt.Fprintf(os.Stderr, "Got embeddings for input %d\n", *embed.Index) } }
Output:
func (*Client) GetFile ¶ added in v0.6.2
func (client *Client) GetFile(ctx context.Context, fileID string, options *GetFileOptions) (GetFileResponse, error)
GetFile - Returns information about a specific file. Does not retrieve file content. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2024-10-01-preview
- fileID - The ID of the file to retrieve.
- options - GetFileOptions contains the optional parameters for the Client.GetFile method.
func (*Client) GetFileContent ¶ added in v0.6.2
func (client *Client) GetFileContent(ctx context.Context, fileID string, options *GetFileContentOptions) (GetFileContentResponse, error)
GetFileContent - Returns information about a specific file. Does not retrieve file content. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2024-10-01-preview
- fileID - The ID of the file to retrieve.
- options - GetFileContentOptions contains the optional parameters for the Client.GetFileContent method.
func (*Client) GetImageGenerations ¶ added in v0.4.0
func (client *Client) GetImageGenerations(ctx context.Context, body ImageGenerationOptions, options *GetImageGenerationsOptions) (GetImageGenerationsResponse, error)
GetImageGenerations - Creates an image given a prompt. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2024-10-01-preview
- body - Represents the request data used to generate images.
- options - GetImageGenerationsOptions contains the optional parameters for the Client.GetImageGenerations method.
Example ¶
package main import ( "context" "fmt" "log" "net/http" "os" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" ) func main() { azureOpenAIKey := os.Getenv("AOAI_DALLE_API_KEY") // Ex: "https://<your-azure-openai-host>.openai.azure.com" azureOpenAIEndpoint := os.Getenv("AOAI_DALLE_ENDPOINT") azureDeployment := os.Getenv("AOAI_DALLE_MODEL") if azureOpenAIKey == "" || azureOpenAIEndpoint == "" || azureDeployment == "" { fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n") return } keyCredential := azcore.NewKeyCredential(azureOpenAIKey) client, err := azopenai.NewClientWithKeyCredential(azureOpenAIEndpoint, keyCredential, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } resp, err := client.GetImageGenerations(context.TODO(), azopenai.ImageGenerationOptions{ Prompt: to.Ptr("a cat"), ResponseFormat: to.Ptr(azopenai.ImageGenerationResponseFormatURL), DeploymentName: &azureDeployment, }, nil) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } for _, generatedImage := range resp.Data { // the underlying type for the generatedImage is dictated by the value of // ImageGenerationOptions.ResponseFormat. In this example we used `azopenai.ImageGenerationResponseFormatURL`, // so the underlying type will be ImageLocation. resp, err := http.Head(*generatedImage.URL) if err != nil { // TODO: Update the following line with your application specific error handling logic log.Printf("ERROR: %s", err) return } _ = resp.Body.Close() fmt.Fprintf(os.Stderr, "Image generated, HEAD request on URL returned %d\n", resp.StatusCode) } }
Output:
func (*Client) ListFiles ¶ added in v0.6.2
func (client *Client) ListFiles(ctx context.Context, options *ListFilesOptions) (ListFilesResponse, error)
ListFiles - Gets a list of previously uploaded files. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2024-10-01-preview
- options - ListFilesOptions contains the optional parameters for the Client.ListFiles method.
func (*Client) NewListBatchesPager ¶ added in v0.6.2
func (c *Client) NewListBatchesPager(options *ListBatchesOptions) *runtime.Pager[ListBatchesResponse]
NewListBatchesPager returns a pager for listing batches.
func (*Client) UploadFile ¶ added in v0.6.2
func (client *Client) UploadFile(ctx context.Context, file io.ReadSeekCloser, purpose FilePurpose, options *UploadFileOptions) (UploadFileResponse, error)
UploadFile - Uploads a file for use by other operations. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2024-10-01-preview
- file - The file data (not filename) to upload.
- purpose - The intended purpose of the file.
- options - UploadFileOptions contains the optional parameters for the Client.UploadFile method.
type ClientOptions ¶
type ClientOptions struct {
azcore.ClientOptions
}
ClientOptions contains optional settings for Client.
type CompleteUploadOptions ¶ added in v0.7.0
type CompleteUploadOptions struct { }
CompleteUploadOptions contains the optional parameters for the Client.CompleteUpload method.
type CompleteUploadRequest ¶ added in v0.7.0
type CompleteUploadRequest struct { // REQUIRED; The ordered list of Part IDs. PartIDs []string // The optional md5 checksum for the file contents to verify if the bytes uploaded matches what you expect. MD5 *string }
CompleteUploadRequest - The request body of an upload completion request.
func (CompleteUploadRequest) MarshalJSON ¶ added in v0.7.0
func (c CompleteUploadRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type CompleteUploadRequest.
func (*CompleteUploadRequest) UnmarshalJSON ¶ added in v0.7.0
func (c *CompleteUploadRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type CompleteUploadRequest.
type CompleteUploadResponse ¶ added in v0.7.0
type CompleteUploadResponse struct { // The Upload object can accept byte chunks in the form of Parts. Upload }
CompleteUploadResponse contains the response from method Client.CompleteUpload.
type Completions ¶
type Completions struct { // REQUIRED; The collection of completions choices associated with this completions response. Generally, n choices are generated // per provided prompt with a default value of 1. Token limits and other settings may // limit the number of choices generated. Choices []Choice // REQUIRED; The first timestamp associated with generation activity for this completions response, represented as seconds // since the beginning of the Unix epoch of 00:00 on 1 Jan 1970. Created *time.Time // REQUIRED; A unique identifier associated with this completions response. ID *string // REQUIRED; Usage information for tokens processed and generated as part of this completions operation. Usage *CompletionsUsage // Content filtering results for zero or more prompts in the request. In a streaming request, results for different prompts // may arrive at different times or in different orders. PromptFilterResults []ContentFilterResultsForPrompt // This fingerprint represents the backend configuration that the model runs with. // Can be used in conjunction with the seed request parameter to understand when backend changes have been made that might // impact determinism. SystemFingerprint *string }
Completions - Representation of the response data from a completions request. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.
func (Completions) MarshalJSON ¶
func (c Completions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type Completions.
func (*Completions) UnmarshalJSON ¶
func (c *Completions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type Completions.
type CompletionsFinishReason ¶
type CompletionsFinishReason string
CompletionsFinishReason - Representation of the manner in which a completions response concluded.
const ( // CompletionsFinishReasonContentFiltered - Completions generated a response that was identified as potentially sensitive // per content // moderation policies. CompletionsFinishReasonContentFiltered CompletionsFinishReason = "content_filter" // CompletionsFinishReasonFunctionCall - Completion ended normally, with the model requesting a function to be called. CompletionsFinishReasonFunctionCall CompletionsFinishReason = "function_call" // CompletionsFinishReasonStopped - Completions ended normally and reached its end of token generation. CompletionsFinishReasonStopped CompletionsFinishReason = "stop" // CompletionsFinishReasonTokenLimitReached - Completions exhausted available token limits before generation could complete. CompletionsFinishReasonTokenLimitReached CompletionsFinishReason = "length" // CompletionsFinishReasonToolCalls - Completion ended with the model calling a provided tool for output. CompletionsFinishReasonToolCalls CompletionsFinishReason = "tool_calls" )
func PossibleCompletionsFinishReasonValues ¶
func PossibleCompletionsFinishReasonValues() []CompletionsFinishReason
PossibleCompletionsFinishReasonValues returns the possible values for the CompletionsFinishReason const type.
type CompletionsLogProbabilityModel ¶
type CompletionsLogProbabilityModel struct { // REQUIRED; The text offsets associated with tokens in this completions data. TextOffset []int32 // REQUIRED; A collection of log probability values for the tokens in this completions data. TokenLogProbs []float32 // REQUIRED; The textual forms of tokens evaluated in this probability model. Tokens []string // REQUIRED; A mapping of tokens to maximum log probability values in this completions data. TopLogProbs []map[string]*float32 }
CompletionsLogProbabilityModel - Representation of a log probabilities model for a completions generation.
func (CompletionsLogProbabilityModel) MarshalJSON ¶
func (c CompletionsLogProbabilityModel) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type CompletionsLogProbabilityModel.
func (*CompletionsLogProbabilityModel) UnmarshalJSON ¶
func (c *CompletionsLogProbabilityModel) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type CompletionsLogProbabilityModel.
type CompletionsOptions ¶
type CompletionsOptions struct { // REQUIRED; The prompts to generate completions from. Prompt []string // A value that controls how many completions will be internally generated prior to response formulation. When used together // with n, bestof controls the number of candidate completions and must be // greater than n. Because this setting can generate many completions, it may quickly consume your token quota. Use carefully // and ensure reasonable settings for maxtokens and stop. BestOf *int32 // A value specifying whether completions responses should include input prompts as prefixes to their generated output. Echo *bool // A value that influences the probability of generated tokens appearing based on their cumulative frequency in generated // text. Positive values will make tokens less likely to appear as their frequency // increases and decrease the likelihood of the model repeating the same statements verbatim. FrequencyPenalty *float32 // A map between GPT token IDs and bias scores that influences the probability of specific tokens appearing in a completions // response. Token IDs are computed via external tokenizer tools, while bias // scores reside in the range of -100 to 100 with minimum and maximum values corresponding to a full ban or exclusive selection // of a token, respectively. The exact behavior of a given bias score varies // by model. LogitBias map[string]*int32 // A value that controls the emission of log probabilities for the provided number of most likely tokens within a completions // response. LogProbs *int32 // The maximum number of tokens to generate. MaxTokens *int32 // The model name to provide as part of this completions request. Not applicable to Azure OpenAI, where deployment information // should be included in the Azure resource URI that's connected to. DeploymentName *string // The number of completions choices that should be generated per provided prompt as part of an overall completions response. // Because this setting can generate many completions, it may quickly consume // your token quota. Use carefully and ensure reasonable settings for max_tokens and stop. N *int32 // A value that influences the probability of generated tokens appearing based on their existing presence in generated text. // Positive values will make tokens less likely to appear when they already exist // and increase the model's likelihood to output new topics. PresencePenalty *float32 // If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same // seed and parameters should return the same result. // Determinism is not guaranteed, and you should refer to the system_fingerprint response parameter to monitor changes in // the backend. Seed *int32 // A collection of textual sequences that will end completions generation. Stop []string // The suffix that comes after a completion of inserted text Suffix *string // The sampling temperature to use that controls the apparent creativity of generated completions. Higher values will make // output more random while lower values will make results more focused and // deterministic. It is not recommended to modify temperature and top_p for the same completions request as the interaction // of these two settings is difficult to predict. Temperature *float32 // An alternative to sampling with temperature called nucleus sampling. This value causes the model to consider the results // of tokens with the provided probability mass. As an example, a value of 0.15 // will cause only the tokens comprising the top 15% of probability mass to be considered. It is not recommended to modify // temperature and top_p for the same completions request as the interaction of // these two settings is difficult to predict. TopP *float32 // An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes. User *string }
CompletionsOptions - The configuration information for a completions request. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.
type CompletionsStreamOptions ¶ added in v0.7.1
type CompletionsStreamOptions struct { // REQUIRED; The prompts to generate completions from. Prompt []string // A value that controls how many completions will be internally generated prior to response formulation. When used together // with n, bestof controls the number of candidate completions and must be // greater than n. Because this setting can generate many completions, it may quickly consume your token quota. Use carefully // and ensure reasonable settings for maxtokens and stop. BestOf *int32 // A value specifying whether completions responses should include input prompts as prefixes to their generated output. Echo *bool // A value that influences the probability of generated tokens appearing based on their cumulative frequency in generated // text. Positive values will make tokens less likely to appear as their frequency // increases and decrease the likelihood of the model repeating the same statements verbatim. FrequencyPenalty *float32 // A map between GPT token IDs and bias scores that influences the probability of specific tokens appearing in a completions // response. Token IDs are computed via external tokenizer tools, while bias // scores reside in the range of -100 to 100 with minimum and maximum values corresponding to a full ban or exclusive selection // of a token, respectively. The exact behavior of a given bias score varies // by model. LogitBias map[string]*int32 // A value that controls the emission of log probabilities for the provided number of most likely tokens within a completions // response. LogProbs *int32 // The maximum number of tokens to generate. MaxTokens *int32 // The model name to provide as part of this completions request. Not applicable to Azure OpenAI, where deployment information // should be included in the Azure resource URI that's connected to. DeploymentName *string // The number of completions choices that should be generated per provided prompt as part of an overall completions response. // Because this setting can generate many completions, it may quickly consume // your token quota. Use carefully and ensure reasonable settings for max_tokens and stop. N *int32 // A value that influences the probability of generated tokens appearing based on their existing presence in generated text. // Positive values will make tokens less likely to appear when they already exist // and increase the model's likelihood to output new topics. PresencePenalty *float32 // If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same // seed and parameters should return the same result. // Determinism is not guaranteed, and you should refer to the system_fingerprint response parameter to monitor changes in // the backend. Seed *int32 // A collection of textual sequences that will end completions generation. Stop []string // Options for streaming response. Only set this when you set stream: true. StreamOptions *ChatCompletionStreamOptions // The suffix that comes after a completion of inserted text Suffix *string // The sampling temperature to use that controls the apparent creativity of generated completions. Higher values will make // output more random while lower values will make results more focused and // deterministic. It is not recommended to modify temperature and top_p for the same completions request as the interaction // of these two settings is difficult to predict. Temperature *float32 // An alternative to sampling with temperature called nucleus sampling. This value causes the model to consider the results // of tokens with the provided probability mass. As an example, a value of 0.15 // will cause only the tokens comprising the top 15% of probability mass to be considered. It is not recommended to modify // temperature and top_p for the same completions request as the interaction of // these two settings is difficult to predict. TopP *float32 // An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes. User *string }
CompletionsStreamOptions - The configuration information for a completions request. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.
type CompletionsUsage ¶
type CompletionsUsage struct { // REQUIRED; The number of tokens generated across all completions emissions. CompletionTokens *int32 // REQUIRED; The number of tokens in the provided prompts for the completions request. PromptTokens *int32 // REQUIRED; The total number of tokens processed for the completions request and response. TotalTokens *int32 // Breakdown of tokens used in a completion. CompletionTokensDetails *CompletionsUsageCompletionTokensDetails // Details of the prompt tokens. PromptTokensDetails *CompletionsUsagePromptTokensDetails }
CompletionsUsage - Representation of the token counts processed for a completions request. Counts consider all tokens across prompts, choices, choice alternates, best_of generations, and other consumers.
func (CompletionsUsage) MarshalJSON ¶
func (c CompletionsUsage) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type CompletionsUsage.
func (*CompletionsUsage) UnmarshalJSON ¶
func (c *CompletionsUsage) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type CompletionsUsage.
type CompletionsUsageCompletionTokensDetails ¶ added in v0.7.1
type CompletionsUsageCompletionTokensDetails struct { // Tokens generated by the model for reasoning. ReasoningTokens *int32 }
CompletionsUsageCompletionTokensDetails - Breakdown of tokens used in a completion.
func (CompletionsUsageCompletionTokensDetails) MarshalJSON ¶ added in v0.7.1
func (c CompletionsUsageCompletionTokensDetails) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type CompletionsUsageCompletionTokensDetails.
func (*CompletionsUsageCompletionTokensDetails) UnmarshalJSON ¶ added in v0.7.1
func (c *CompletionsUsageCompletionTokensDetails) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type CompletionsUsageCompletionTokensDetails.
type CompletionsUsagePromptTokensDetails ¶ added in v0.7.1
type CompletionsUsagePromptTokensDetails struct { // The number of cached prompt tokens. CachedTokens *int32 }
CompletionsUsagePromptTokensDetails - Details of the prompt tokens.
func (CompletionsUsagePromptTokensDetails) MarshalJSON ¶ added in v0.7.1
func (c CompletionsUsagePromptTokensDetails) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type CompletionsUsagePromptTokensDetails.
func (*CompletionsUsagePromptTokensDetails) UnmarshalJSON ¶ added in v0.7.1
func (c *CompletionsUsagePromptTokensDetails) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type CompletionsUsagePromptTokensDetails.
type ContentFilterBlocklistIDResult ¶ added in v0.4.0
type ContentFilterBlocklistIDResult struct { // REQUIRED; A value indicating whether or not the content has been filtered. Filtered *bool // REQUIRED; The ID of the custom blocklist evaluated. ID *string }
ContentFilterBlocklistIDResult - Represents the outcome of an evaluation against a custom blocklist as performed by content filtering.
func (ContentFilterBlocklistIDResult) MarshalJSON ¶ added in v0.4.0
func (c ContentFilterBlocklistIDResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ContentFilterBlocklistIDResult.
func (*ContentFilterBlocklistIDResult) UnmarshalJSON ¶ added in v0.4.0
func (c *ContentFilterBlocklistIDResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ContentFilterBlocklistIDResult.
type ContentFilterCitedDetectionResult ¶ added in v0.4.0
type ContentFilterCitedDetectionResult struct { // REQUIRED; A value indicating whether detection occurred, irrespective of severity or whether the content was filtered. Detected *bool // REQUIRED; A value indicating whether or not the content has been filtered. Filtered *bool // The license description associated with the detection. License *string // The internet location associated with the detection. URL *string }
ContentFilterCitedDetectionResult - Represents the outcome of a detection operation against protected resources as performed by content filtering.
func (ContentFilterCitedDetectionResult) MarshalJSON ¶ added in v0.4.0
func (c ContentFilterCitedDetectionResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ContentFilterCitedDetectionResult.
func (*ContentFilterCitedDetectionResult) UnmarshalJSON ¶ added in v0.4.0
func (c *ContentFilterCitedDetectionResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ContentFilterCitedDetectionResult.
type ContentFilterCompletionTextSpan ¶ added in v0.7.1
type ContentFilterCompletionTextSpan struct { // REQUIRED; Offset of the first UTF32 code point which is excluded from the span. This field is always equal to completionstartoffset // for empty spans. This field is always larger than completionstartoffset for // non-empty spans. CompletionEndOffset *int32 // REQUIRED; Offset of the UTF32 code point which begins the span. CompletionStartOffset *int32 }
ContentFilterCompletionTextSpan - Describes a span within generated completion text. Offset 0 is the first UTF32 code point of the completion text.
func (ContentFilterCompletionTextSpan) MarshalJSON ¶ added in v0.7.1
func (c ContentFilterCompletionTextSpan) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ContentFilterCompletionTextSpan.
func (*ContentFilterCompletionTextSpan) UnmarshalJSON ¶ added in v0.7.1
func (c *ContentFilterCompletionTextSpan) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ContentFilterCompletionTextSpan.
type ContentFilterCompletionTextSpanResult ¶ added in v0.7.1
type ContentFilterCompletionTextSpanResult struct { // REQUIRED; The collection of completion text spans. Details []ContentFilterCompletionTextSpan // REQUIRED; A value indicating whether detection occurred, irrespective of severity or whether the content was filtered. Detected *bool // REQUIRED; A value indicating whether or not the content has been filtered. Filtered *bool }
ContentFilterCompletionTextSpanResult - Describes a span within generated completion text.
func (ContentFilterCompletionTextSpanResult) MarshalJSON ¶ added in v0.7.1
func (c ContentFilterCompletionTextSpanResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ContentFilterCompletionTextSpanResult.
func (*ContentFilterCompletionTextSpanResult) UnmarshalJSON ¶ added in v0.7.1
func (c *ContentFilterCompletionTextSpanResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ContentFilterCompletionTextSpanResult.
type ContentFilterDetailedResults ¶ added in v0.6.0
type ContentFilterDetailedResults struct { // REQUIRED; The collection of detailed blocklist result information. Details []ContentFilterBlocklistIDResult // REQUIRED; A value indicating whether or not the content has been filtered. Filtered *bool }
ContentFilterDetailedResults - Represents a structured collection of result details for content filtering.
func (ContentFilterDetailedResults) MarshalJSON ¶ added in v0.6.0
func (c ContentFilterDetailedResults) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ContentFilterDetailedResults.
func (*ContentFilterDetailedResults) UnmarshalJSON ¶ added in v0.6.0
func (c *ContentFilterDetailedResults) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ContentFilterDetailedResults.
type ContentFilterDetectionResult ¶ added in v0.4.0
type ContentFilterDetectionResult struct { // REQUIRED; A value indicating whether detection occurred, irrespective of severity or whether the content was filtered. Detected *bool // REQUIRED; A value indicating whether or not the content has been filtered. Filtered *bool }
ContentFilterDetectionResult - Represents the outcome of a detection operation performed by content filtering.
func (ContentFilterDetectionResult) MarshalJSON ¶ added in v0.4.0
func (c ContentFilterDetectionResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ContentFilterDetectionResult.
func (*ContentFilterDetectionResult) UnmarshalJSON ¶ added in v0.4.0
func (c *ContentFilterDetectionResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ContentFilterDetectionResult.
type ContentFilterResponseError ¶
type ContentFilterResponseError struct { azcore.ResponseError // ContentFilterResults contains Information about the content filtering category, if it has been detected. ContentFilterResults *ContentFilterResults }
ContentFilterResponseError is an error as a result of a request being filtered.
func (*ContentFilterResponseError) Unwrap ¶
func (e *ContentFilterResponseError) Unwrap() error
Unwrap returns the inner error for this error.
type ContentFilterResult ¶ added in v0.3.0
type ContentFilterResult struct { // REQUIRED; A value indicating whether or not the content has been filtered. Filtered *bool // REQUIRED; Ratings for the intensity and risk level of filtered content. Severity *ContentFilterSeverity }
ContentFilterResult - Information about filtered content severity level and if it has been filtered or not.
func (ContentFilterResult) MarshalJSON ¶ added in v0.3.0
func (c ContentFilterResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ContentFilterResult.
func (*ContentFilterResult) UnmarshalJSON ¶ added in v0.3.0
func (c *ContentFilterResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ContentFilterResult.
type ContentFilterResultDetailsForPrompt ¶ added in v0.4.0
type ContentFilterResultDetailsForPrompt struct { // Describes detection results against configured custom blocklists. CustomBlockLists *ContentFilterDetailedResults // Describes an error returned if the content filtering system is down or otherwise unable to complete the operation in time. Error *Error // Describes language attacks or uses that include pejorative or discriminatory language with reference to a person or identity // group on the basis of certain differentiating attributes of these groups // including but not limited to race, ethnicity, nationality, gender identity and expression, sexual orientation, religion, // immigration status, ability status, personal appearance, and body size. Hate *ContentFilterResult // Whether an indirect attack was detected in the prompt. IndirectAttack *ContentFilterDetectionResult // Whether a jailbreak attempt was detected in the prompt. Jailbreak *ContentFilterDetectionResult // Describes whether profanity was detected. Profanity *ContentFilterDetectionResult // Describes language related to physical actions intended to purposely hurt, injure, or damage one’s body, or kill oneself. SelfHarm *ContentFilterResult // Describes language related to anatomical organs and genitals, romantic relationships, acts portrayed in erotic or affectionate // terms, physical sexual acts, including those portrayed as an assault or a // forced sexual violent act against one’s will, prostitution, pornography, and abuse. Sexual *ContentFilterResult // Describes language related to physical actions intended to hurt, injure, damage, or kill someone or something; describes // weapons, etc. Violence *ContentFilterResult }
ContentFilterResultDetailsForPrompt - Information about content filtering evaluated against input data to Azure OpenAI.
func (ContentFilterResultDetailsForPrompt) MarshalJSON ¶ added in v0.4.0
func (c ContentFilterResultDetailsForPrompt) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ContentFilterResultDetailsForPrompt.
func (*ContentFilterResultDetailsForPrompt) UnmarshalJSON ¶ added in v0.4.0
func (c *ContentFilterResultDetailsForPrompt) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ContentFilterResultDetailsForPrompt.
type ContentFilterResults ¶
type ContentFilterResults struct { // Describes language attacks or uses that include pejorative or discriminatory language with reference to a person or identity // group on the basis of certain differentiating attributes of these groups // including but not limited to race, ethnicity, nationality, gender identity and expression, sexual orientation, religion, // immigration status, ability status, personal appearance, and body size. Hate *ContentFilterResult `json:"hate"` // Describes language related to physical actions intended to purposely hurt, injure, or damage one’s body, or kill oneself. SelfHarm *ContentFilterResult `json:"self_harm"` // Describes language related to anatomical organs and genitals, romantic relationships, acts portrayed in erotic or affectionate // terms, physical sexual acts, including those portrayed as an assault or a // forced sexual violent act against one’s will, prostitution, pornography, and abuse. Sexual *ContentFilterResult `json:"sexual"` // Describes language related to physical actions intended to hurt, injure, damage, or kill someone or something; describes // weapons, etc. Violence *ContentFilterResult `json:"violence"` }
ContentFilterResults are the content filtering results for a ContentFilterResponseError.
type ContentFilterResultsForChoice ¶ added in v0.4.0
type ContentFilterResultsForChoice struct { // REQUIRED; Information about detection of ungrounded material. UngroundedMaterial *ContentFilterCompletionTextSpanResult // Describes detection results against configured custom blocklists. CustomBlockLists *ContentFilterDetailedResults // Describes an error returned if the content filtering system is down or otherwise unable to complete the operation in time. Error *Error // Describes language attacks or uses that include pejorative or discriminatory language with reference to a person or identity // group on the basis of certain differentiating attributes of these groups // including but not limited to race, ethnicity, nationality, gender identity and expression, sexual orientation, religion, // immigration status, ability status, personal appearance, and body size. Hate *ContentFilterResult // Describes whether profanity was detected. Profanity *ContentFilterDetectionResult // Information about detection of protected code material. ProtectedMaterialCode *ContentFilterCitedDetectionResult // Information about detection of protected text material. ProtectedMaterialText *ContentFilterDetectionResult // Describes language related to physical actions intended to purposely hurt, injure, or damage one’s body, or kill oneself. SelfHarm *ContentFilterResult // Describes language related to anatomical organs and genitals, romantic relationships, acts portrayed in erotic or affectionate // terms, physical sexual acts, including those portrayed as an assault or a // forced sexual violent act against one’s will, prostitution, pornography, and abuse. Sexual *ContentFilterResult // Describes language related to physical actions intended to hurt, injure, damage, or kill someone or something; describes // weapons, etc. Violence *ContentFilterResult }
ContentFilterResultsForChoice - Information about content filtering evaluated against generated model output.
func (ContentFilterResultsForChoice) MarshalJSON ¶ added in v0.4.0
func (c ContentFilterResultsForChoice) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ContentFilterResultsForChoice.
func (*ContentFilterResultsForChoice) UnmarshalJSON ¶ added in v0.4.0
func (c *ContentFilterResultsForChoice) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ContentFilterResultsForChoice.
type ContentFilterResultsForPrompt ¶ added in v0.4.0
type ContentFilterResultsForPrompt struct { // REQUIRED; Content filtering results for this prompt ContentFilterResults *ContentFilterResultDetailsForPrompt // REQUIRED; The index of this prompt in the set of prompt results PromptIndex *int32 }
ContentFilterResultsForPrompt - Content filtering results for a single prompt in the request.
func (ContentFilterResultsForPrompt) MarshalJSON ¶ added in v0.4.0
func (c ContentFilterResultsForPrompt) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ContentFilterResultsForPrompt.
func (*ContentFilterResultsForPrompt) UnmarshalJSON ¶ added in v0.4.0
func (c *ContentFilterResultsForPrompt) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ContentFilterResultsForPrompt.
type ContentFilterSeverity ¶
type ContentFilterSeverity string
ContentFilterSeverity - Ratings for the intensity and risk level of harmful content.
const ( // ContentFilterSeverityHigh - Content that displays explicit and severe harmful instructions, actions, // damage, or abuse; includes endorsement, glorification, or promotion of severe // harmful acts, extreme or illegal forms of harm, radicalization, or non-consensual // power exchange or abuse. ContentFilterSeverityHigh ContentFilterSeverity = "high" // ContentFilterSeverityLow - Content that expresses prejudiced, judgmental, or opinionated views, includes offensive // use of language, stereotyping, use cases exploring a fictional world (for example, gaming, // literature) and depictions at low intensity. ContentFilterSeverityLow ContentFilterSeverity = "low" // ContentFilterSeverityMedium - Content that uses offensive, insulting, mocking, intimidating, or demeaning language // towards specific identity groups, includes depictions of seeking and executing harmful // instructions, fantasies, glorification, promotion of harm at medium intensity. ContentFilterSeverityMedium ContentFilterSeverity = "medium" // ContentFilterSeveritySafe - Content may be related to violence, self-harm, sexual, or hate categories but the terms // are used in general, journalistic, scientific, medical, and similar professional contexts, // which are appropriate for most audiences. ContentFilterSeveritySafe ContentFilterSeverity = "safe" )
func PossibleContentFilterSeverityValues ¶
func PossibleContentFilterSeverityValues() []ContentFilterSeverity
PossibleContentFilterSeverityValues returns the possible values for the ContentFilterSeverity const type.
type CreateBatchOptions ¶ added in v0.6.2
type CreateBatchOptions struct { }
CreateBatchOptions contains the optional parameters for the Client.CreateBatch method.
type CreateBatchResponse ¶ added in v0.6.2
type CreateBatchResponse struct { // The Batch object. Batch }
CreateBatchResponse contains the response from method Client.CreateBatch.
type CreateUploadOptions ¶ added in v0.7.0
type CreateUploadOptions struct { }
CreateUploadOptions contains the optional parameters for the Client.CreateUpload method.
type CreateUploadRequest ¶ added in v0.7.0
type CreateUploadRequest struct { // REQUIRED; The number of bytes in the file you are uploading. Bytes *int32 // REQUIRED; The name of the file to upload. Filename *string // REQUIRED; The MIME type of the file. // This must fall within the supported MIME types for your file purpose. See the supported MIME types for assistants and vision. MimeType *string // REQUIRED; The intended purpose of the uploaded file. // Use 'assistants' for Assistants and Message files, 'vision' for Assistants image file inputs, 'batch' for Batch API, and // 'fine-tune' for Fine-tuning. Purpose *CreateUploadRequestPurpose }
CreateUploadRequest - The request body of an upload creation operation.
func (CreateUploadRequest) MarshalJSON ¶ added in v0.7.0
func (c CreateUploadRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type CreateUploadRequest.
func (*CreateUploadRequest) UnmarshalJSON ¶ added in v0.7.0
func (c *CreateUploadRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type CreateUploadRequest.
type CreateUploadRequestPurpose ¶ added in v0.7.0
type CreateUploadRequestPurpose string
CreateUploadRequestPurpose - The intended purpose of the uploaded file. Use 'assistants' for Assistants and Message files, 'vision' for Assistants image file inputs, 'batch' for Batch API, and 'fine-tune' for Fine-tuning.
const ( CreateUploadRequestPurposeAssistants CreateUploadRequestPurpose = "assistants" CreateUploadRequestPurposeBatch CreateUploadRequestPurpose = "batch" CreateUploadRequestPurposeFineTune CreateUploadRequestPurpose = "fine-tune" CreateUploadRequestPurposeVision CreateUploadRequestPurpose = "vision" )
func PossibleCreateUploadRequestPurposeValues ¶ added in v0.7.0
func PossibleCreateUploadRequestPurposeValues() []CreateUploadRequestPurpose
PossibleCreateUploadRequestPurposeValues returns the possible values for the CreateUploadRequestPurpose const type.
type CreateUploadResponse ¶ added in v0.7.0
type CreateUploadResponse struct { // The Upload object can accept byte chunks in the form of Parts. Upload }
CreateUploadResponse contains the response from method Client.CreateUpload.
type DeleteFileOptions ¶ added in v0.6.2
type DeleteFileOptions struct { }
DeleteFileOptions contains the optional parameters for the Client.DeleteFile method.
type DeleteFileResponse ¶ added in v0.6.2
type DeleteFileResponse struct { // A status response from a file deletion operation. FileDeletionStatus }
DeleteFileResponse contains the response from method Client.DeleteFile.
type ElasticsearchChatExtensionConfiguration ¶ added in v0.4.0
type ElasticsearchChatExtensionConfiguration struct { // REQUIRED; The parameters to use when configuring Elasticsearch®. Parameters *ElasticsearchChatExtensionParameters // contains filtered or unexported fields }
ElasticsearchChatExtensionConfiguration - A specific representation of configurable options for Elasticsearch when using it as an Azure OpenAI chat extension.
func (*ElasticsearchChatExtensionConfiguration) GetAzureChatExtensionConfiguration ¶ added in v0.4.0
func (e *ElasticsearchChatExtensionConfiguration) GetAzureChatExtensionConfiguration() *AzureChatExtensionConfiguration
GetAzureChatExtensionConfiguration implements the AzureChatExtensionConfigurationClassification interface for type ElasticsearchChatExtensionConfiguration.
func (ElasticsearchChatExtensionConfiguration) MarshalJSON ¶ added in v0.4.0
func (e ElasticsearchChatExtensionConfiguration) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ElasticsearchChatExtensionConfiguration.
func (*ElasticsearchChatExtensionConfiguration) UnmarshalJSON ¶ added in v0.4.0
func (e *ElasticsearchChatExtensionConfiguration) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ElasticsearchChatExtensionConfiguration.
type ElasticsearchChatExtensionParameters ¶ added in v0.4.0
type ElasticsearchChatExtensionParameters struct { // REQUIRED; The endpoint of Elasticsearch®. Endpoint *string // REQUIRED; The index name of Elasticsearch®. IndexName *string // If specified as true, the system will allow partial search results to be used and the request fails if all the queries // fail. If not specified, or specified as false, the request will fail if any // search query fails. AllowPartialResult *bool // The authentication method to use when accessing the defined data source. Each data source type supports a specific set // of available authentication methods; please see the documentation of the data // source for supported mechanisms. If not otherwise provided, On Your Data will attempt to use System Managed Identity (default // credential) authentication. Authentication OnYourDataAuthenticationOptionsClassification // The embedding dependency for vector search. EmbeddingDependency OnYourDataVectorizationSourceClassification // The index field mapping options of Elasticsearch®. FieldsMapping *ElasticsearchIndexFieldMappingOptions // Whether queries should be restricted to use of indexed data. InScope *bool // The included properties of the output context. If not specified, the default value is citations and intent. IncludeContexts []OnYourDataContextProperty // The max number of rewritten queries should be send to search provider for one user message. If not specified, the system // will decide the number of queries to send. MaxSearchQueries *int32 // The query type of Elasticsearch®. QueryType *ElasticsearchQueryType // The configured strictness of the search relevance filtering. The higher of strictness, the higher of the precision but // lower recall of the answer. Strictness *int32 // The configured top number of documents to feature for the configured query. TopNDocuments *int32 }
ElasticsearchChatExtensionParameters - Parameters to use when configuring Elasticsearch® as an Azure OpenAI chat extension. The supported authentication types are KeyAndKeyId and EncodedAPIKey.
func (ElasticsearchChatExtensionParameters) MarshalJSON ¶ added in v0.4.0
func (e ElasticsearchChatExtensionParameters) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ElasticsearchChatExtensionParameters.
func (*ElasticsearchChatExtensionParameters) UnmarshalJSON ¶ added in v0.4.0
func (e *ElasticsearchChatExtensionParameters) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ElasticsearchChatExtensionParameters.
type ElasticsearchIndexFieldMappingOptions ¶ added in v0.4.0
type ElasticsearchIndexFieldMappingOptions struct { // The names of index fields that should be treated as content. ContentFields []string // The separator pattern that content fields should use. ContentFieldsSeparator *string // The name of the index field to use as a filepath. FilePathField *string // The name of the index field to use as a title. TitleField *string // The name of the index field to use as a URL. URLField *string // The names of fields that represent vector data. VectorFields []string }
ElasticsearchIndexFieldMappingOptions - Optional settings to control how fields are processed when using a configured Elasticsearch® resource.
func (ElasticsearchIndexFieldMappingOptions) MarshalJSON ¶ added in v0.4.0
func (e ElasticsearchIndexFieldMappingOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ElasticsearchIndexFieldMappingOptions.
func (*ElasticsearchIndexFieldMappingOptions) UnmarshalJSON ¶ added in v0.4.0
func (e *ElasticsearchIndexFieldMappingOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ElasticsearchIndexFieldMappingOptions.
type ElasticsearchQueryType ¶ added in v0.4.0
type ElasticsearchQueryType string
ElasticsearchQueryType - The type of Elasticsearch® retrieval query that should be executed when using it as an Azure OpenAI chat extension.
const ( // ElasticsearchQueryTypeSimple - Represents the default, simple query parser. ElasticsearchQueryTypeSimple ElasticsearchQueryType = "simple" // ElasticsearchQueryTypeVector - Represents vector search over computed data. ElasticsearchQueryTypeVector ElasticsearchQueryType = "vector" )
func PossibleElasticsearchQueryTypeValues ¶ added in v0.4.0
func PossibleElasticsearchQueryTypeValues() []ElasticsearchQueryType
PossibleElasticsearchQueryTypeValues returns the possible values for the ElasticsearchQueryType const type.
type EmbeddingEncodingFormat ¶ added in v0.5.1
type EmbeddingEncodingFormat string
EmbeddingEncodingFormat - Represents the available formats for embeddings data on responses.
const ( // EmbeddingEncodingFormatBase64 - Specifies that responses should provide a base64-encoded string for each embedding. EmbeddingEncodingFormatBase64 EmbeddingEncodingFormat = "base64" // EmbeddingEncodingFormatFloat - Specifies that responses should provide arrays of floats for each embedding. EmbeddingEncodingFormatFloat EmbeddingEncodingFormat = "float" )
func PossibleEmbeddingEncodingFormatValues ¶ added in v0.5.1
func PossibleEmbeddingEncodingFormatValues() []EmbeddingEncodingFormat
PossibleEmbeddingEncodingFormatValues returns the possible values for the EmbeddingEncodingFormat const type.
type EmbeddingItem ¶
type EmbeddingItem struct { // List of embeddings value for the input prompt. These represent a measurement of the vector-based relatedness // of the provided input when when [EmbeddingEncodingFormatFloat] is specified. Embedding []float32 // EmbeddingBase64 represents the Embeddings when [EmbeddingEncodingFormatBase64] is specified. EmbeddingBase64 string // REQUIRED; Index of the prompt to which the EmbeddingItem corresponds. Index *int32 // The object type which is always 'embedding'. Object string }
EmbeddingItem - Representation of a single embeddings relatedness comparison.
func (EmbeddingItem) MarshalJSON ¶
func (e EmbeddingItem) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type EmbeddingItem.
func (*EmbeddingItem) UnmarshalJSON ¶
func (e *EmbeddingItem) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type EmbeddingItem.
type Embeddings ¶
type Embeddings struct { // REQUIRED; Embedding values for the prompts submitted in the request. Data []EmbeddingItem // REQUIRED; Usage counts for tokens input using the embeddings API. Usage *EmbeddingsUsage }
Embeddings - Representation of the response data from an embeddings request. Embeddings measure the relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar scenarios.
func (Embeddings) MarshalJSON ¶
func (e Embeddings) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type Embeddings.
func (*Embeddings) UnmarshalJSON ¶
func (e *Embeddings) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type Embeddings.
type EmbeddingsOptions ¶
type EmbeddingsOptions struct { // REQUIRED; Input texts to get embeddings for, encoded as a an array of strings. Each input must not exceed 2048 tokens in // length. // Unless you are embedding code, we suggest replacing newlines (\n) in your input with a single space, as we have observed // inferior results when newlines are present. Input []string // The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models. Dimensions *int32 // The response encoding format to use for embedding data. // - If using EmbeddingEncodingFormatFloat (the default), the value will be a []float32, in [EmbeddingItem.Embedding] // - If using EmbeddingEncodingFormatBase64, the value will be a base-64 string in [EmbeddingItem.EmbeddingBase64] EncodingFormat *EmbeddingEncodingFormat // When using Azure OpenAI, specifies the input type to use for embedding search. InputType *string // The model name to provide as part of this embeddings request. Not applicable to Azure OpenAI, where deployment information // should be included in the Azure resource URI that's connected to. DeploymentName *string // An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes. User *string }
EmbeddingsOptions - The configuration information for an embeddings request. Embeddings measure the relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar scenarios.
func (EmbeddingsOptions) MarshalJSON ¶
func (e EmbeddingsOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type EmbeddingsOptions.
func (*EmbeddingsOptions) UnmarshalJSON ¶
func (e *EmbeddingsOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type EmbeddingsOptions.
type EmbeddingsUsage ¶
type EmbeddingsUsage struct { // REQUIRED; Number of tokens sent in the original request. PromptTokens *int32 // REQUIRED; Total number of tokens transacted in this request/response. TotalTokens *int32 }
EmbeddingsUsage - Measurement of the amount of tokens used in this request and response.
func (EmbeddingsUsage) MarshalJSON ¶
func (e EmbeddingsUsage) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type EmbeddingsUsage.
func (*EmbeddingsUsage) UnmarshalJSON ¶
func (e *EmbeddingsUsage) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type EmbeddingsUsage.
type Error ¶ added in v0.3.0
type Error struct { // REQUIRED; One of a server-defined set of error codes. Code *string // contains filtered or unexported fields }
Error - The error object.
func (*Error) Error ¶ added in v0.4.0
Error implements the error interface for type Error. Note that the message contents are not contractual and can change over time.
func (Error) MarshalJSON ¶ added in v0.3.0
MarshalJSON implements the json.Marshaller interface for type Error.
func (*Error) UnmarshalJSON ¶ added in v0.3.0
UnmarshalJSON implements the json.Unmarshaller interface for type Error.
type EventReader ¶
type EventReader[T any] struct { // contains filtered or unexported fields }
EventReader streams events dynamically from an OpenAI endpoint.
func (*EventReader[T]) Close ¶
func (er *EventReader[T]) Close() error
Close closes the EventReader and any applicable inner stream state.
func (*EventReader[T]) Read ¶
func (er *EventReader[T]) Read() (T, error)
Read reads the next event from the stream. Returns io.EOF when there are no further events.
type File ¶ added in v0.6.2
type File struct { // REQUIRED; The size of the file, in bytes. Bytes *int32 // REQUIRED; The Unix timestamp, in seconds, representing when this object was created. CreatedAt *time.Time // REQUIRED; The name of the file. Filename *string // REQUIRED; The identifier, which can be referenced in API endpoints. ID *string // REQUIRED; The object type, which is always 'file'. Object *string // REQUIRED; The intended purpose of a file. Purpose *FilePurpose // The state of the file. This field is available in Azure OpenAI only. Status *FileState // The error message with details in case processing of this file failed. This field is available in Azure OpenAI only. StatusDetails *string }
File - Represents an assistant that can call the model and use tools.
func (File) MarshalJSON ¶ added in v0.6.2
MarshalJSON implements the json.Marshaller interface for type File.
func (*File) UnmarshalJSON ¶ added in v0.6.2
UnmarshalJSON implements the json.Unmarshaller interface for type File.
type FileDeletionStatus ¶ added in v0.6.2
type FileDeletionStatus struct { // REQUIRED; A value indicating whether deletion was successful. Deleted *bool // REQUIRED; The ID of the resource specified for deletion. ID *string // REQUIRED; The object type, which is always 'file'. Object *string }
FileDeletionStatus - A status response from a file deletion operation.
func (FileDeletionStatus) MarshalJSON ¶ added in v0.6.2
func (f FileDeletionStatus) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type FileDeletionStatus.
func (*FileDeletionStatus) UnmarshalJSON ¶ added in v0.6.2
func (f *FileDeletionStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type FileDeletionStatus.
type FileListResponse ¶ added in v0.6.2
type FileListResponse struct { // REQUIRED; The files returned for the request. Data []File // REQUIRED; The object type, which is always 'list'. Object *string }
FileListResponse - The response data from a file list operation.
func (FileListResponse) MarshalJSON ¶ added in v0.6.2
func (f FileListResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type FileListResponse.
func (*FileListResponse) UnmarshalJSON ¶ added in v0.6.2
func (f *FileListResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type FileListResponse.
type FilePurpose ¶ added in v0.6.2
type FilePurpose string
FilePurpose - The possible values denoting the intended usage of a file.
const ( // FilePurposeAssistants - Indicates a file is used as input to assistants. FilePurposeAssistants FilePurpose = "assistants" // FilePurposeAssistantsOutput - Indicates a file is used as output by assistants. FilePurposeAssistantsOutput FilePurpose = "assistants_output" // FilePurposeBatch - Indicates a file is used as input to . FilePurposeBatch FilePurpose = "batch" // FilePurposeBatchOutput - Indicates a file is used as output by a vector store batch operation. FilePurposeBatchOutput FilePurpose = "batch_output" // FilePurposeFineTune - Indicates a file is used for fine tuning input. FilePurposeFineTune FilePurpose = "fine-tune" // FilePurposeFineTuneResults - Indicates a file is used for fine tuning results. FilePurposeFineTuneResults FilePurpose = "fine-tune-results" // FilePurposeVision - Indicates a file is used as input to a vision operation. FilePurposeVision FilePurpose = "vision" )
func PossibleFilePurposeValues ¶ added in v0.6.2
func PossibleFilePurposeValues() []FilePurpose
PossibleFilePurposeValues returns the possible values for the FilePurpose const type.
type FileState ¶ added in v0.6.2
type FileState string
FileState - The state of the file.
const ( // FileStateDeleted - The entity has been deleted but may still be referenced by other entities predating the deletion. It // can be categorized as a // terminal state. FileStateDeleted FileState = "deleted" // FileStateDeleting - The entity is in the process to be deleted. This state is not returned by Azure OpenAI and exposed // only for compatibility. // It can be categorized as an active state. FileStateDeleting FileState = "deleting" // FileStateError - The operation has completed processing with a failure and cannot be further consumed. It can be categorized // as a terminal state. FileStateError FileState = "error" // FileStatePending - The operation was created and is not queued to be processed in the future. It can be categorized as // an inactive state. FileStatePending FileState = "pending" // FileStateProcessed - The operation has successfully processed and is ready for consumption. It can be categorized as a // terminal state. FileStateProcessed FileState = "processed" // FileStateRunning - The operation has started to be processed. It can be categorized as an active state. FileStateRunning FileState = "running" // FileStateUploaded - The file has been uploaded but it's not yet processed. This state is not returned by Azure OpenAI and // exposed only for // compatibility. It can be categorized as an inactive state. FileStateUploaded FileState = "uploaded" )
func PossibleFileStateValues ¶ added in v0.6.2
func PossibleFileStateValues() []FileState
PossibleFileStateValues returns the possible values for the FileState const type.
type FunctionCall ¶
type FunctionCall struct { // REQUIRED; The arguments to call the function with, as generated by the model in JSON format. Note that the model does not // always generate valid JSON, and may hallucinate parameters not defined by your function // schema. Validate the arguments in your code before calling your function. Arguments *string // REQUIRED; The name of the function to call. Name *string }
FunctionCall - The name and arguments of a function that should be called, as generated by the model.
func (FunctionCall) MarshalJSON ¶
func (f FunctionCall) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type FunctionCall.
func (*FunctionCall) UnmarshalJSON ¶
func (f *FunctionCall) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type FunctionCall.
type FunctionCallPreset ¶
type FunctionCallPreset string
FunctionCallPreset - The collection of predefined behaviors for handling request-provided function information in a chat completions operation.
const ( // FunctionCallPresetAuto - Specifies that the model may either use any of the functions provided in this chat completions // request or // instead return a standard chat completions response as if no functions were provided. FunctionCallPresetAuto FunctionCallPreset = "auto" // FunctionCallPresetNone - Specifies that the model should not respond with a function call and should instead provide a // standard chat // completions response. Response content may still be influenced by the provided function information. FunctionCallPresetNone FunctionCallPreset = "none" )
func PossibleFunctionCallPresetValues ¶
func PossibleFunctionCallPresetValues() []FunctionCallPreset
PossibleFunctionCallPresetValues returns the possible values for the FunctionCallPreset const type.
type FunctionDefinition ¶
type FunctionDefinition struct { // REQUIRED; The name of the function to be called. Name *string // A description of what the function does. The model will use this description when selecting the function and interpreting // its parameters. Description *string // The parameters the function accepts, described as a JSON Schema object. Parameters []byte }
FunctionDefinition - The definition of a caller-specified function that chat completions may invoke in response to matching user input.
func (FunctionDefinition) MarshalJSON ¶
func (f FunctionDefinition) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type FunctionDefinition.
func (*FunctionDefinition) UnmarshalJSON ¶
func (f *FunctionDefinition) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type FunctionDefinition.
type FunctionName ¶
type FunctionName struct { // REQUIRED; The name of the function to call. Name *string }
FunctionName - A structure that specifies the exact name of a specific, request-provided function to use when processing a chat completions operation.
func (FunctionName) MarshalJSON ¶
func (f FunctionName) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type FunctionName.
func (*FunctionName) UnmarshalJSON ¶
func (f *FunctionName) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type FunctionName.
type GenerateSpeechFromTextOptions ¶ added in v0.5.0
type GenerateSpeechFromTextOptions struct { }
GenerateSpeechFromTextOptions contains the optional parameters for the Client.GenerateSpeechFromText method.
type GenerateSpeechFromTextResponse ¶ added in v0.5.0
type GenerateSpeechFromTextResponse struct { // Body contains the streaming response. Body io.ReadCloser }
GenerateSpeechFromTextResponse contains the response from method Client.GenerateSpeechFromText.
type GetAudioTranscriptionBody ¶ added in v0.6.2
type GetAudioTranscriptionBody struct { // REQUIRED; The configuration information for an audio transcription request. Body *AudioTranscriptionOptions }
GetAudioTranscriptionBody - Get audio transcription body.
func (GetAudioTranscriptionBody) MarshalJSON ¶ added in v0.6.2
func (g GetAudioTranscriptionBody) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type GetAudioTranscriptionBody.
func (*GetAudioTranscriptionBody) UnmarshalJSON ¶ added in v0.6.2
func (g *GetAudioTranscriptionBody) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type GetAudioTranscriptionBody.
type GetAudioTranscriptionOptions ¶ added in v0.3.0
type GetAudioTranscriptionOptions struct { }
GetAudioTranscriptionOptions contains the optional parameters for the Client.GetAudioTranscription method.
type GetAudioTranscriptionResponse ¶ added in v0.3.0
type GetAudioTranscriptionResponse struct {
AudioTranscription
}
GetAudioTranscriptionResponse contains the response from method Client.GetAudioTranscription.
type GetAudioTranslationBody ¶ added in v0.6.2
type GetAudioTranslationBody struct { // REQUIRED; The configuration information for an audio translation request. Body *AudioTranslationOptions }
GetAudioTranslationBody - Get audio translation body.
func (GetAudioTranslationBody) MarshalJSON ¶ added in v0.6.2
func (g GetAudioTranslationBody) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type GetAudioTranslationBody.
func (*GetAudioTranslationBody) UnmarshalJSON ¶ added in v0.6.2
func (g *GetAudioTranslationBody) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type GetAudioTranslationBody.
type GetAudioTranslationOptions ¶ added in v0.3.0
type GetAudioTranslationOptions struct { }
GetAudioTranslationOptions contains the optional parameters for the Client.GetAudioTranslation method.
type GetAudioTranslationResponse ¶ added in v0.3.0
type GetAudioTranslationResponse struct {
AudioTranslation
}
GetAudioTranslationResponse contains the response from method Client.GetAudioTranslation.
type GetBatchOptions ¶ added in v0.6.2
type GetBatchOptions struct { }
GetBatchOptions contains the optional parameters for the Client.GetBatch method.
type GetBatchResponse ¶ added in v0.6.2
type GetBatchResponse struct { // The Batch object. Batch }
GetBatchResponse contains the response from method Client.GetBatch.
type GetChatCompletionsOptions ¶
type GetChatCompletionsOptions struct { }
GetChatCompletionsOptions contains the optional parameters for the Client.GetChatCompletions method.
type GetChatCompletionsResponse ¶
type GetChatCompletionsResponse struct { // Representation of the response data from a chat completions request. // Completions support a wide variety of tasks and generate text that continues from or "completes" // provided prompt data. ChatCompletions }
GetChatCompletionsResponse contains the response from method Client.GetChatCompletions.
type GetChatCompletionsStreamOptions ¶
type GetChatCompletionsStreamOptions struct { }
GetChatCompletionsStreamOptions contains the optional parameters for the Client.GetChatCompletionsStream method.
type GetChatCompletionsStreamResponse ¶
type GetChatCompletionsStreamResponse struct { // ChatCompletionsStream returns the stream of completions. Token limits and other settings may limit the number of chat completions returned by the service. ChatCompletionsStream *EventReader[ChatCompletions] }
GetChatCompletionsStreamResponse is the response from Client.GetChatCompletionsStream.
type GetCompletionsOptions ¶
type GetCompletionsOptions struct { }
GetCompletionsOptions contains the optional parameters for the Client.GetCompletions method.
type GetCompletionsResponse ¶
type GetCompletionsResponse struct { // Representation of the response data from a completions request. // Completions support a wide variety of tasks and generate text that continues from or "completes" // provided prompt data. Completions }
GetCompletionsResponse contains the response from method Client.GetCompletions.
type GetCompletionsStreamOptions ¶
type GetCompletionsStreamOptions struct { }
GetCompletionsStreamOptions contains the optional parameters for the Client.GetCompletionsStream method.
type GetCompletionsStreamResponse ¶
type GetCompletionsStreamResponse struct { // CompletionsStream returns the stream of completions. Token limits and other settings may limit the number of completions returned by the service. CompletionsStream *EventReader[Completions] }
GetCompletionsStreamResponse is the response from Client.GetCompletionsStream.
type GetEmbeddingsOptions ¶
type GetEmbeddingsOptions struct { }
GetEmbeddingsOptions contains the optional parameters for the Client.GetEmbeddings method.
type GetEmbeddingsResponse ¶
type GetEmbeddingsResponse struct { // Representation of the response data from an embeddings request. // Embeddings measure the relatedness of text strings and are commonly used for search, clustering, // recommendations, and other similar scenarios. Embeddings }
GetEmbeddingsResponse contains the response from method Client.GetEmbeddings.
type GetFileContentOptions ¶ added in v0.6.2
type GetFileContentOptions struct { }
GetFileContentOptions contains the optional parameters for the Client.GetFileContent method.
type GetFileContentResponse ¶ added in v0.6.2
type GetFileContentResponse struct {
Value []byte
}
GetFileContentResponse contains the response from method Client.GetFileContent.
type GetFileOptions ¶ added in v0.6.2
type GetFileOptions struct { }
GetFileOptions contains the optional parameters for the Client.GetFile method.
type GetFileResponse ¶ added in v0.6.2
type GetFileResponse struct { // Represents an assistant that can call the model and use tools. File }
GetFileResponse contains the response from method Client.GetFile.
type GetImageGenerationsOptions ¶ added in v0.4.0
type GetImageGenerationsOptions struct { }
GetImageGenerationsOptions contains the optional parameters for the Client.GetImageGenerations method.
type GetImageGenerationsResponse ¶ added in v0.4.0
type GetImageGenerationsResponse struct { // The result of a successful image generation operation. ImageGenerations }
GetImageGenerationsResponse contains the response from method Client.GetImageGenerations.
type ImageGenerationContentFilterResults ¶ added in v0.5.0
type ImageGenerationContentFilterResults struct { // Describes language attacks or uses that include pejorative or discriminatory language with reference to a person or identity // group on the basis of certain differentiating attributes of these groups // including but not limited to race, ethnicity, nationality, gender identity and expression, sexual orientation, religion, // immigration status, ability status, personal appearance, and body size. Hate *ContentFilterResult // Describes language related to physical actions intended to purposely hurt, injure, or damage one’s body, or kill oneself. SelfHarm *ContentFilterResult // Describes language related to anatomical organs and genitals, romantic relationships, acts portrayed in erotic or affectionate // terms, physical sexual acts, including those portrayed as an assault or a // forced sexual violent act against one’s will, prostitution, pornography, and abuse. Sexual *ContentFilterResult // Describes language related to physical actions intended to hurt, injure, damage, or kill someone or something; describes // weapons, etc. Violence *ContentFilterResult }
ImageGenerationContentFilterResults - Describes the content filtering result for the image generation request.
func (ImageGenerationContentFilterResults) MarshalJSON ¶ added in v0.5.0
func (i ImageGenerationContentFilterResults) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ImageGenerationContentFilterResults.
func (*ImageGenerationContentFilterResults) UnmarshalJSON ¶ added in v0.5.0
func (i *ImageGenerationContentFilterResults) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ImageGenerationContentFilterResults.
type ImageGenerationData ¶ added in v0.4.0
type ImageGenerationData struct { // The complete data for an image, represented as a base64-encoded string. Base64Data *string // Information about the content filtering results. ContentFilterResults *ImageGenerationContentFilterResults // Information about the content filtering category (hate, sexual, violence, selfharm), if it has been detected, as well as // the severity level (verylow, low, medium, high-scale that determines the // intensity and risk level of harmful content) and if it has been filtered or not. Information about jailbreak content and // profanity, if it has been detected, and if it has been filtered or not. And // information about customer block list, if it has been filtered and its id. PromptFilterResults *ImageGenerationPromptFilterResults // The final prompt used by the model to generate the image. Only provided with dall-3-models and only when revisions were // made to the prompt. RevisedPrompt *string // The URL that provides temporary access to download the generated image. URL *string }
ImageGenerationData - A representation of a single generated image, provided as either base64-encoded data or as a URL from which the image may be retrieved.
func (ImageGenerationData) MarshalJSON ¶ added in v0.4.0
func (i ImageGenerationData) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ImageGenerationData.
func (*ImageGenerationData) UnmarshalJSON ¶ added in v0.4.0
func (i *ImageGenerationData) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ImageGenerationData.
type ImageGenerationOptions ¶
type ImageGenerationOptions struct { // REQUIRED; A description of the desired images. Prompt *string // The model name or Azure OpenAI model deployment name to use for image generation. If not specified, dall-e-2 will be inferred // as a default. DeploymentName *string // The number of images to generate. Dall-e-2 models support values between 1 and 10. Dall-e-3 models only support a value // of 1. N *int32 // The desired image generation quality level to use. Only configurable with dall-e-3 models. Quality *ImageGenerationQuality // The format in which image generation response items should be presented. ResponseFormat *ImageGenerationResponseFormat // The desired dimensions for generated images. Dall-e-2 models support 256x256, 512x512, or 1024x1024. Dall-e-3 models support // 1024x1024, 1792x1024, or 1024x1792. Size *ImageSize // The desired image generation style to use. Only configurable with dall-e-3 models. Style *ImageGenerationStyle // A unique identifier representing your end-user, which can help to monitor and detect abuse. User *string }
ImageGenerationOptions - Represents the request data used to generate images.
func (ImageGenerationOptions) MarshalJSON ¶
func (i ImageGenerationOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ImageGenerationOptions.
func (*ImageGenerationOptions) UnmarshalJSON ¶
func (i *ImageGenerationOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ImageGenerationOptions.
type ImageGenerationPromptFilterResults ¶ added in v0.5.0
type ImageGenerationPromptFilterResults struct { // Information about customer block lists and if something was detected the associated list ID. CustomBlockLists *ContentFilterDetailedResults // Describes language attacks or uses that include pejorative or discriminatory language with reference to a person or identity // group on the basis of certain differentiating attributes of these groups // including but not limited to race, ethnicity, nationality, gender identity and expression, sexual orientation, religion, // immigration status, ability status, personal appearance, and body size. Hate *ContentFilterResult // Whether a jailbreak attempt was detected in the prompt. Jailbreak *ContentFilterDetectionResult // Describes whether profanity was detected. Profanity *ContentFilterDetectionResult // Describes language related to physical actions intended to purposely hurt, injure, or damage one’s body, or kill oneself. SelfHarm *ContentFilterResult // Describes language related to anatomical organs and genitals, romantic relationships, acts portrayed in erotic or affectionate // terms, physical sexual acts, including those portrayed as an assault or a // forced sexual violent act against one’s will, prostitution, pornography, and abuse. Sexual *ContentFilterResult // Describes language related to physical actions intended to hurt, injure, damage, or kill someone or something; describes // weapons, etc. Violence *ContentFilterResult }
ImageGenerationPromptFilterResults - Describes the content filtering results for the prompt of a image generation request.
func (ImageGenerationPromptFilterResults) MarshalJSON ¶ added in v0.5.0
func (i ImageGenerationPromptFilterResults) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ImageGenerationPromptFilterResults.
func (*ImageGenerationPromptFilterResults) UnmarshalJSON ¶ added in v0.5.0
func (i *ImageGenerationPromptFilterResults) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ImageGenerationPromptFilterResults.
type ImageGenerationQuality ¶ added in v0.4.0
type ImageGenerationQuality string
ImageGenerationQuality - The desired image generation quality level to use. Only configurable with dall-e-3 models.
const ( // ImageGenerationQualityHd - Requests image generation with higher quality, higher cost and lower speed relative to standard. ImageGenerationQualityHd ImageGenerationQuality = "hd" // ImageGenerationQualityStandard - Requests image generation with standard, balanced characteristics of quality, cost, and // speed. ImageGenerationQualityStandard ImageGenerationQuality = "standard" )
func PossibleImageGenerationQualityValues ¶ added in v0.4.0
func PossibleImageGenerationQualityValues() []ImageGenerationQuality
PossibleImageGenerationQualityValues returns the possible values for the ImageGenerationQuality const type.
type ImageGenerationResponseFormat ¶
type ImageGenerationResponseFormat string
ImageGenerationResponseFormat - The format in which image generation response items should be presented.
const ( // ImageGenerationResponseFormatBase64 - Image generation response items should provide image data as a base64-encoded string. ImageGenerationResponseFormatBase64 ImageGenerationResponseFormat = "b64_json" // ImageGenerationResponseFormatURL - Image generation response items should provide a URL from which the image may be retrieved. ImageGenerationResponseFormatURL ImageGenerationResponseFormat = "url" )
func PossibleImageGenerationResponseFormatValues ¶
func PossibleImageGenerationResponseFormatValues() []ImageGenerationResponseFormat
PossibleImageGenerationResponseFormatValues returns the possible values for the ImageGenerationResponseFormat const type.
type ImageGenerationStyle ¶ added in v0.4.0
type ImageGenerationStyle string
ImageGenerationStyle - The desired image generation style to use. Only configurable with dall-e-3 models.
const ( // ImageGenerationStyleNatural - Requests image generation in a natural style with less preference for dramatic and hyper-realistic // characteristics. ImageGenerationStyleNatural ImageGenerationStyle = "natural" // ImageGenerationStyleVivid - Requests image generation in a vivid style with a higher preference for dramatic and hyper-realistic // characteristics. ImageGenerationStyleVivid ImageGenerationStyle = "vivid" )
func PossibleImageGenerationStyleValues ¶ added in v0.4.0
func PossibleImageGenerationStyleValues() []ImageGenerationStyle
PossibleImageGenerationStyleValues returns the possible values for the ImageGenerationStyle const type.
type ImageGenerations ¶
type ImageGenerations struct { // REQUIRED; A timestamp representing when this operation was started. Expressed in seconds since the Unix epoch of 1970-01-01T00:00:00+0000. Created *time.Time // REQUIRED; The images generated by the operation. Data []ImageGenerationData }
ImageGenerations - The result of a successful image generation operation.
func (ImageGenerations) MarshalJSON ¶
func (i ImageGenerations) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ImageGenerations.
func (*ImageGenerations) UnmarshalJSON ¶
func (i *ImageGenerations) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ImageGenerations.
type ImageGenerationsDataItem ¶
type ImageGenerationsDataItem struct { // Base64Data is set to image data, encoded as a base64 string, if [ImageGenerationOptions.ResponseFormat] // was set to [ImageGenerationResponseFormatB64JSON]. Base64Data *string `json:"b64_json"` // URL is the address of a generated image if [ImageGenerationOptions.ResponseFormat] was set // to [ImageGenerationResponseFormatURL]. URL *string `json:"url"` }
ImageGenerationsDataItem contains the results of image generation.
The field that's set will be based on [ImageGenerationOptions.ResponseFormat] and are mutually exclusive.
type ImageSize ¶
type ImageSize string
ImageSize - The desired dimensions for generated images. Dall-e-2 models support 256x256, 512x512, or 1024x1024. Dall-e-3 models support 1024x1024, 1792x1024, or 1024x1792.
const ( // ImageSizeSize1024X1024 - A standard, square image size of 1024x1024 pixels. // Supported by both dall-e-2 and dall-e-3 models. ImageSizeSize1024X1024 ImageSize = "1024x1024" // ImageSizeSize1024X1792 - A taller image size of 1792x1024 pixels. // Only supported with dall-e-3 models. ImageSizeSize1024X1792 ImageSize = "1024x1792" // ImageSizeSize1792X1024 - A wider image size of 1024x1792 pixels. // Only supported with dall-e-3 models. ImageSizeSize1792X1024 ImageSize = "1792x1024" // ImageSizeSize256X256 - Very small image size of 256x256 pixels. // Only supported with dall-e-2 models. ImageSizeSize256X256 ImageSize = "256x256" // ImageSizeSize512X512 - A smaller image size of 512x512 pixels. // Only supported with dall-e-2 models. ImageSizeSize512X512 ImageSize = "512x512" )
func PossibleImageSizeValues ¶
func PossibleImageSizeValues() []ImageSize
PossibleImageSizeValues returns the possible values for the ImageSize const type.
type ListBatchesOptions ¶ added in v0.6.2
type ListBatchesOptions struct { // Identifier for the last event from the previous pagination request. After *string // Number of batches to retrieve. Defaults to 20. Limit *int32 }
ListBatchesOptions contains the optional parameters for the Client.ListBatches method.
type ListBatchesPage ¶ added in v0.6.2
type ListBatchesPage struct { // REQUIRED; The object type, which is always list. Object *string // The requested list of items. Data []Batch // The first ID represented in this list. FirstID *string // A value indicating whether there are additional values available not captured in this list. HasMore *bool // The last ID represented in this list. LastID *string }
ListBatchesPage - The response data for a requested list of items.
func (ListBatchesPage) MarshalJSON ¶ added in v0.6.2
func (l ListBatchesPage) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ListBatchesPage.
func (*ListBatchesPage) UnmarshalJSON ¶ added in v0.6.2
func (l *ListBatchesPage) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ListBatchesPage.
type ListBatchesResponse ¶ added in v0.6.2
type ListBatchesResponse struct { // The response data for a requested list of items. ListBatchesPage }
ListBatchesResponse contains the response from method Client.ListBatches.
type ListFilesOptions ¶ added in v0.6.2
type ListFilesOptions struct { // A value that, when provided, limits list results to files matching the corresponding purpose. Purpose *FilePurpose }
ListFilesOptions contains the optional parameters for the Client.ListFiles method.
type ListFilesResponse ¶ added in v0.6.2
type ListFilesResponse struct { // The response data from a file list operation. FileListResponse }
ListFilesResponse contains the response from method Client.ListFiles.
type MaxTokensFinishDetails ¶ added in v0.4.0
type MaxTokensFinishDetails struct { // REQUIRED; The object type. Type *string }
MaxTokensFinishDetails - A structured representation of a stop reason that signifies a token limit was reached before the model could naturally complete.
func (*MaxTokensFinishDetails) GetChatFinishDetails ¶ added in v0.4.0
func (m *MaxTokensFinishDetails) GetChatFinishDetails() *ChatFinishDetails
GetChatFinishDetails implements the ChatFinishDetailsClassification interface for type MaxTokensFinishDetails.
func (MaxTokensFinishDetails) MarshalJSON ¶ added in v0.4.0
func (m MaxTokensFinishDetails) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MaxTokensFinishDetails.
func (*MaxTokensFinishDetails) UnmarshalJSON ¶ added in v0.4.0
func (m *MaxTokensFinishDetails) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MaxTokensFinishDetails.
type MongoDBChatExtensionConfiguration ¶ added in v0.7.0
type MongoDBChatExtensionConfiguration struct { // REQUIRED; The parameters for the MongoDB chat extension. Parameters *MongoDBChatExtensionParameters // contains filtered or unexported fields }
MongoDBChatExtensionConfiguration - A specific representation of configurable options for a MongoDB chat extension configuration.
func (*MongoDBChatExtensionConfiguration) GetAzureChatExtensionConfiguration ¶ added in v0.7.0
func (m *MongoDBChatExtensionConfiguration) GetAzureChatExtensionConfiguration() *AzureChatExtensionConfiguration
GetAzureChatExtensionConfiguration implements the AzureChatExtensionConfigurationClassification interface for type MongoDBChatExtensionConfiguration.
func (MongoDBChatExtensionConfiguration) MarshalJSON ¶ added in v0.7.0
func (m MongoDBChatExtensionConfiguration) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MongoDBChatExtensionConfiguration.
func (*MongoDBChatExtensionConfiguration) UnmarshalJSON ¶ added in v0.7.0
func (m *MongoDBChatExtensionConfiguration) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MongoDBChatExtensionConfiguration.
type MongoDBChatExtensionParameters ¶ added in v0.7.0
type MongoDBChatExtensionParameters struct { // REQUIRED; The app name for MongoDB. AppName *string // REQUIRED; The collection name for MongoDB. CollectionName *string // REQUIRED; The database name for MongoDB. DatabaseName *string // REQUIRED; The vectorization source to use with the MongoDB chat extension. EmbeddingDependency *MongoDBChatExtensionParametersEmbeddingDependency // REQUIRED; The endpoint name for MongoDB. Endpoint *string // REQUIRED; Field mappings to apply to data used by the MongoDB data source. Note that content and vector field mappings // are required for MongoDB. FieldsMapping *MongoDBChatExtensionParametersFieldsMapping // REQUIRED; The name of the MongoDB index. IndexName *string // If specified as true, the system will allow partial search results to be used and the request fails if all the queries // fail. If not specified, or specified as false, the request will fail if any // search query fails. AllowPartialResult *bool // The authentication method to use when accessing the defined data source. Each data source type supports a specific set // of available authentication methods; please see the documentation of the data // source for supported mechanisms. If not otherwise provided, On Your Data will attempt to use System Managed Identity (default // credential) authentication. Authentication *OnYourDataUsernameAndPasswordAuthenticationOptions // Whether queries should be restricted to use of indexed data. InScope *bool // The included properties of the output context. If not specified, the default value is citations and intent. IncludeContexts []OnYourDataContextProperty // The max number of rewritten queries should be send to search provider for one user message. If not specified, the system // will decide the number of queries to send. MaxSearchQueries *int32 // The configured strictness of the search relevance filtering. The higher of strictness, the higher of the precision but // lower recall of the answer. Strictness *int32 // The configured top number of documents to feature for the configured query. TopNDocuments *int32 }
MongoDBChatExtensionParameters - Parameters for the MongoDB chat extension. The supported authentication types are AccessToken, SystemAssignedManagedIdentity and UserAssignedManagedIdentity.
func (MongoDBChatExtensionParameters) MarshalJSON ¶ added in v0.7.0
func (m MongoDBChatExtensionParameters) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MongoDBChatExtensionParameters.
func (*MongoDBChatExtensionParameters) UnmarshalJSON ¶ added in v0.7.0
func (m *MongoDBChatExtensionParameters) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MongoDBChatExtensionParameters.
type MongoDBChatExtensionParametersEmbeddingDependency ¶ added in v0.7.0
type MongoDBChatExtensionParametersEmbeddingDependency struct {
// contains filtered or unexported fields
}
MongoDBChatExtensionParametersEmbeddingDependency contains the embedding dependency for the MongoDBChatExtensionParameters. NOTE: This should be created using azopenai.NewMongoDBChatExtensionParametersEmbeddingDependency
func NewMongoDBChatExtensionParametersEmbeddingDependency ¶ added in v0.7.0
func NewMongoDBChatExtensionParametersEmbeddingDependency[T OnYourDataDeploymentNameVectorizationSource | OnYourDataEndpointVectorizationSource](value T) *MongoDBChatExtensionParametersEmbeddingDependency
NewMongoDBChatExtensionParametersEmbeddingDependency creates a azopenai.MongoDBChatExtensionParametersEmbeddingDependency.
func (MongoDBChatExtensionParametersEmbeddingDependency) MarshalJSON ¶ added in v0.7.0
func (c MongoDBChatExtensionParametersEmbeddingDependency) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MongoDBChatExtensionParametersEmbeddingDependency.
type MongoDBChatExtensionParametersFieldsMapping ¶ added in v0.7.0
type MongoDBChatExtensionParametersFieldsMapping struct { // REQUIRED ContentFields []string // REQUIRED VectorFields []string ContentFieldsSeparator *string FilepathField *string TitleField *string URLField *string }
MongoDBChatExtensionParametersFieldsMapping - Field mappings to apply to data used by the MongoDB data source. Note that content and vector field mappings are required for MongoDB.
func (MongoDBChatExtensionParametersFieldsMapping) MarshalJSON ¶ added in v0.7.0
func (m MongoDBChatExtensionParametersFieldsMapping) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MongoDBChatExtensionParametersFieldsMapping.
func (*MongoDBChatExtensionParametersFieldsMapping) UnmarshalJSON ¶ added in v0.7.0
func (m *MongoDBChatExtensionParametersFieldsMapping) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MongoDBChatExtensionParametersFieldsMapping.
type OnYourDataAPIKeyAuthenticationOptions ¶ added in v0.4.0
type OnYourDataAPIKeyAuthenticationOptions struct { // REQUIRED; The API key to use for authentication. Key *string // contains filtered or unexported fields }
OnYourDataAPIKeyAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using an API key.
func (*OnYourDataAPIKeyAuthenticationOptions) GetOnYourDataAuthenticationOptions ¶ added in v0.4.0
func (o *OnYourDataAPIKeyAuthenticationOptions) GetOnYourDataAuthenticationOptions() *OnYourDataAuthenticationOptions
GetOnYourDataAuthenticationOptions implements the OnYourDataAuthenticationOptionsClassification interface for type OnYourDataAPIKeyAuthenticationOptions.
func (OnYourDataAPIKeyAuthenticationOptions) MarshalJSON ¶ added in v0.4.0
func (o OnYourDataAPIKeyAuthenticationOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OnYourDataAPIKeyAuthenticationOptions.
func (*OnYourDataAPIKeyAuthenticationOptions) UnmarshalJSON ¶ added in v0.4.0
func (o *OnYourDataAPIKeyAuthenticationOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataAPIKeyAuthenticationOptions.
type OnYourDataAccessTokenAuthenticationOptions ¶ added in v0.5.0
type OnYourDataAccessTokenAuthenticationOptions struct { // REQUIRED; The access token to use for authentication. AccessToken *string // contains filtered or unexported fields }
OnYourDataAccessTokenAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using access token.
func (*OnYourDataAccessTokenAuthenticationOptions) GetOnYourDataAuthenticationOptions ¶ added in v0.5.0
func (o *OnYourDataAccessTokenAuthenticationOptions) GetOnYourDataAuthenticationOptions() *OnYourDataAuthenticationOptions
GetOnYourDataAuthenticationOptions implements the OnYourDataAuthenticationOptionsClassification interface for type OnYourDataAccessTokenAuthenticationOptions.
func (OnYourDataAccessTokenAuthenticationOptions) MarshalJSON ¶ added in v0.5.0
func (o OnYourDataAccessTokenAuthenticationOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OnYourDataAccessTokenAuthenticationOptions.
func (*OnYourDataAccessTokenAuthenticationOptions) UnmarshalJSON ¶ added in v0.5.0
func (o *OnYourDataAccessTokenAuthenticationOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataAccessTokenAuthenticationOptions.
type OnYourDataAuthenticationOptions ¶ added in v0.4.0
type OnYourDataAuthenticationOptions struct {
// contains filtered or unexported fields
}
OnYourDataAuthenticationOptions - The authentication options for Azure OpenAI On Your Data.
func (*OnYourDataAuthenticationOptions) GetOnYourDataAuthenticationOptions ¶ added in v0.4.0
func (o *OnYourDataAuthenticationOptions) GetOnYourDataAuthenticationOptions() *OnYourDataAuthenticationOptions
GetOnYourDataAuthenticationOptions implements the OnYourDataAuthenticationOptionsClassification interface for type OnYourDataAuthenticationOptions.
func (OnYourDataAuthenticationOptions) MarshalJSON ¶ added in v0.4.0
func (o OnYourDataAuthenticationOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OnYourDataAuthenticationOptions.
func (*OnYourDataAuthenticationOptions) UnmarshalJSON ¶ added in v0.4.0
func (o *OnYourDataAuthenticationOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataAuthenticationOptions.
type OnYourDataAuthenticationOptionsClassification ¶ added in v0.4.0
type OnYourDataAuthenticationOptionsClassification interface { // GetOnYourDataAuthenticationOptions returns the OnYourDataAuthenticationOptions content of the underlying type. GetOnYourDataAuthenticationOptions() *OnYourDataAuthenticationOptions }
OnYourDataAuthenticationOptionsClassification provides polymorphic access to related types. Call the interface's GetOnYourDataAuthenticationOptions() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *OnYourDataAPIKeyAuthenticationOptions, *OnYourDataAccessTokenAuthenticationOptions, *OnYourDataAuthenticationOptions, - *OnYourDataConnectionStringAuthenticationOptions, *OnYourDataEncodedAPIKeyAuthenticationOptions, *OnYourDataKeyAndKeyIDAuthenticationOptions, - *OnYourDataSystemAssignedManagedIdentityAuthenticationOptions, *OnYourDataUserAssignedManagedIdentityAuthenticationOptions, - *OnYourDataUsernameAndPasswordAuthenticationOptions
type OnYourDataAuthenticationType ¶ added in v0.4.0
type OnYourDataAuthenticationType string
OnYourDataAuthenticationType - The authentication types supported with Azure OpenAI On Your Data.
const ( // OnYourDataAuthenticationTypeAPIKey - Authentication via API key. OnYourDataAuthenticationTypeAPIKey OnYourDataAuthenticationType = "api_key" // OnYourDataAuthenticationTypeAccessToken - Authentication via access token. OnYourDataAuthenticationTypeAccessToken OnYourDataAuthenticationType = "access_token" // OnYourDataAuthenticationTypeConnectionString - Authentication via connection string. OnYourDataAuthenticationTypeConnectionString OnYourDataAuthenticationType = "connection_string" // OnYourDataAuthenticationTypeEncodedAPIKey - Authentication via encoded API key. OnYourDataAuthenticationTypeEncodedAPIKey OnYourDataAuthenticationType = "encoded_api_key" // OnYourDataAuthenticationTypeKeyAndKeyID - Authentication via key and key ID pair. OnYourDataAuthenticationTypeKeyAndKeyID OnYourDataAuthenticationType = "key_and_key_id" // OnYourDataAuthenticationTypeSystemAssignedManagedIdentity - Authentication via system-assigned managed identity. OnYourDataAuthenticationTypeSystemAssignedManagedIdentity OnYourDataAuthenticationType = "system_assigned_managed_identity" // OnYourDataAuthenticationTypeUserAssignedManagedIdentity - Authentication via user-assigned managed identity. OnYourDataAuthenticationTypeUserAssignedManagedIdentity OnYourDataAuthenticationType = "user_assigned_managed_identity" // OnYourDataAuthenticationTypeUsernameAndPassword - Authentication via username and password. OnYourDataAuthenticationTypeUsernameAndPassword OnYourDataAuthenticationType = "username_and_password" )
func PossibleOnYourDataAuthenticationTypeValues ¶ added in v0.4.0
func PossibleOnYourDataAuthenticationTypeValues() []OnYourDataAuthenticationType
PossibleOnYourDataAuthenticationTypeValues returns the possible values for the OnYourDataAuthenticationType const type.
type OnYourDataConnectionStringAuthenticationOptions ¶ added in v0.4.0
type OnYourDataConnectionStringAuthenticationOptions struct { // REQUIRED; The connection string to use for authentication. ConnectionString *string // contains filtered or unexported fields }
OnYourDataConnectionStringAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using a connection string.
func (*OnYourDataConnectionStringAuthenticationOptions) GetOnYourDataAuthenticationOptions ¶ added in v0.4.0
func (o *OnYourDataConnectionStringAuthenticationOptions) GetOnYourDataAuthenticationOptions() *OnYourDataAuthenticationOptions
GetOnYourDataAuthenticationOptions implements the OnYourDataAuthenticationOptionsClassification interface for type OnYourDataConnectionStringAuthenticationOptions.
func (OnYourDataConnectionStringAuthenticationOptions) MarshalJSON ¶ added in v0.4.0
func (o OnYourDataConnectionStringAuthenticationOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OnYourDataConnectionStringAuthenticationOptions.
func (*OnYourDataConnectionStringAuthenticationOptions) UnmarshalJSON ¶ added in v0.4.0
func (o *OnYourDataConnectionStringAuthenticationOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataConnectionStringAuthenticationOptions.
type OnYourDataContextProperty ¶ added in v0.6.0
type OnYourDataContextProperty string
OnYourDataContextProperty - The context property.
const ( // OnYourDataContextPropertyAllRetrievedDocuments - The `all_retrieved_documents` property. OnYourDataContextPropertyAllRetrievedDocuments OnYourDataContextProperty = "all_retrieved_documents" // OnYourDataContextPropertyCitations - The `citations` property. OnYourDataContextPropertyCitations OnYourDataContextProperty = "citations" // OnYourDataContextPropertyIntent - The `intent` property. OnYourDataContextPropertyIntent OnYourDataContextProperty = "intent" )
func PossibleOnYourDataContextPropertyValues ¶ added in v0.6.0
func PossibleOnYourDataContextPropertyValues() []OnYourDataContextProperty
PossibleOnYourDataContextPropertyValues returns the possible values for the OnYourDataContextProperty const type.
type OnYourDataDeploymentNameVectorizationSource ¶ added in v0.4.0
type OnYourDataDeploymentNameVectorizationSource struct { // REQUIRED; The embedding model deployment name within the same Azure OpenAI resource. This enables you to use vector search // without Azure OpenAI api-key and without Azure OpenAI public network access. DeploymentName *string // REQUIRED; The type of vectorization source to use. Type *OnYourDataVectorizationSourceType // The number of dimensions the embeddings should have. Only supported in text-embedding-3 and later models. Dimensions *int32 }
OnYourDataDeploymentNameVectorizationSource - The details of a a vectorization source, used by Azure OpenAI On Your Data when applying vector search, that is based on an internal embeddings model deployment name in the same Azure OpenAI resource.
func (*OnYourDataDeploymentNameVectorizationSource) GetOnYourDataVectorizationSource ¶ added in v0.4.0
func (o *OnYourDataDeploymentNameVectorizationSource) GetOnYourDataVectorizationSource() *OnYourDataVectorizationSource
GetOnYourDataVectorizationSource implements the OnYourDataVectorizationSourceClassification interface for type OnYourDataDeploymentNameVectorizationSource.
func (OnYourDataDeploymentNameVectorizationSource) MarshalJSON ¶ added in v0.4.0
func (o OnYourDataDeploymentNameVectorizationSource) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OnYourDataDeploymentNameVectorizationSource.
func (*OnYourDataDeploymentNameVectorizationSource) UnmarshalJSON ¶ added in v0.4.0
func (o *OnYourDataDeploymentNameVectorizationSource) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataDeploymentNameVectorizationSource.
type OnYourDataEncodedAPIKeyAuthenticationOptions ¶ added in v0.5.0
type OnYourDataEncodedAPIKeyAuthenticationOptions struct { // REQUIRED; The encoded API key to use for authentication. EncodedAPIKey *string // contains filtered or unexported fields }
OnYourDataEncodedAPIKeyAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using an Elasticsearch encoded API key.
func (*OnYourDataEncodedAPIKeyAuthenticationOptions) GetOnYourDataAuthenticationOptions ¶ added in v0.5.0
func (o *OnYourDataEncodedAPIKeyAuthenticationOptions) GetOnYourDataAuthenticationOptions() *OnYourDataAuthenticationOptions
GetOnYourDataAuthenticationOptions implements the OnYourDataAuthenticationOptionsClassification interface for type OnYourDataEncodedAPIKeyAuthenticationOptions.
func (OnYourDataEncodedAPIKeyAuthenticationOptions) MarshalJSON ¶ added in v0.5.0
func (o OnYourDataEncodedAPIKeyAuthenticationOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OnYourDataEncodedAPIKeyAuthenticationOptions.
func (*OnYourDataEncodedAPIKeyAuthenticationOptions) UnmarshalJSON ¶ added in v0.5.0
func (o *OnYourDataEncodedAPIKeyAuthenticationOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataEncodedAPIKeyAuthenticationOptions.
type OnYourDataEndpointVectorizationSource ¶ added in v0.4.0
type OnYourDataEndpointVectorizationSource struct { // REQUIRED; Specifies the authentication options to use when retrieving embeddings from the specified endpoint. Authentication OnYourDataVectorSearchAuthenticationOptionsClassification // REQUIRED; Specifies the resource endpoint URL from which embeddings should be retrieved. It should be in the format of // https://YOURRESOURCENAME.openai.azure.com/openai/deployments/YOURDEPLOYMENTNAME/embeddings. // The api-version query parameter is not allowed. Endpoint *string // REQUIRED; The type of vectorization source to use. Type *OnYourDataVectorizationSourceType }
OnYourDataEndpointVectorizationSource - The details of a a vectorization source, used by Azure OpenAI On Your Data when applying vector search, that is based on a public Azure OpenAI endpoint call for embeddings.
func (*OnYourDataEndpointVectorizationSource) GetOnYourDataVectorizationSource ¶ added in v0.4.0
func (o *OnYourDataEndpointVectorizationSource) GetOnYourDataVectorizationSource() *OnYourDataVectorizationSource
GetOnYourDataVectorizationSource implements the OnYourDataVectorizationSourceClassification interface for type OnYourDataEndpointVectorizationSource.
func (OnYourDataEndpointVectorizationSource) MarshalJSON ¶ added in v0.4.0
func (o OnYourDataEndpointVectorizationSource) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OnYourDataEndpointVectorizationSource.
func (*OnYourDataEndpointVectorizationSource) UnmarshalJSON ¶ added in v0.4.0
func (o *OnYourDataEndpointVectorizationSource) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataEndpointVectorizationSource.
type OnYourDataIntegratedVectorizationSource ¶ added in v0.7.0
type OnYourDataIntegratedVectorizationSource struct { // REQUIRED; The type of vectorization source to use. Type *OnYourDataVectorizationSourceType }
OnYourDataIntegratedVectorizationSource - Represents the integrated vectorizer defined within the search resource.
func (*OnYourDataIntegratedVectorizationSource) GetOnYourDataVectorizationSource ¶ added in v0.7.0
func (o *OnYourDataIntegratedVectorizationSource) GetOnYourDataVectorizationSource() *OnYourDataVectorizationSource
GetOnYourDataVectorizationSource implements the OnYourDataVectorizationSourceClassification interface for type OnYourDataIntegratedVectorizationSource.
func (OnYourDataIntegratedVectorizationSource) MarshalJSON ¶ added in v0.7.0
func (o OnYourDataIntegratedVectorizationSource) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OnYourDataIntegratedVectorizationSource.
func (*OnYourDataIntegratedVectorizationSource) UnmarshalJSON ¶ added in v0.7.0
func (o *OnYourDataIntegratedVectorizationSource) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataIntegratedVectorizationSource.
type OnYourDataKeyAndKeyIDAuthenticationOptions ¶ added in v0.4.0
type OnYourDataKeyAndKeyIDAuthenticationOptions struct { // REQUIRED; The key to use for authentication. Key *string // REQUIRED; The key ID to use for authentication. KeyID *string // contains filtered or unexported fields }
OnYourDataKeyAndKeyIDAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using an Elasticsearch key and key ID pair.
func (*OnYourDataKeyAndKeyIDAuthenticationOptions) GetOnYourDataAuthenticationOptions ¶ added in v0.4.0
func (o *OnYourDataKeyAndKeyIDAuthenticationOptions) GetOnYourDataAuthenticationOptions() *OnYourDataAuthenticationOptions
GetOnYourDataAuthenticationOptions implements the OnYourDataAuthenticationOptionsClassification interface for type OnYourDataKeyAndKeyIDAuthenticationOptions.
func (OnYourDataKeyAndKeyIDAuthenticationOptions) MarshalJSON ¶ added in v0.4.0
func (o OnYourDataKeyAndKeyIDAuthenticationOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OnYourDataKeyAndKeyIDAuthenticationOptions.
func (*OnYourDataKeyAndKeyIDAuthenticationOptions) UnmarshalJSON ¶ added in v0.4.0
func (o *OnYourDataKeyAndKeyIDAuthenticationOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataKeyAndKeyIDAuthenticationOptions.
type OnYourDataModelIDVectorizationSource ¶ added in v0.4.0
type OnYourDataModelIDVectorizationSource struct { // REQUIRED; The embedding model ID build inside the search service. Currently only supported by Elasticsearch®. ModelID *string // REQUIRED; The type of vectorization source to use. Type *OnYourDataVectorizationSourceType }
OnYourDataModelIDVectorizationSource - The details of a a vectorization source, used by Azure OpenAI On Your Data when applying vector search, that is based on a search service model ID. Currently only supported by Elasticsearch®.
func (*OnYourDataModelIDVectorizationSource) GetOnYourDataVectorizationSource ¶ added in v0.4.0
func (o *OnYourDataModelIDVectorizationSource) GetOnYourDataVectorizationSource() *OnYourDataVectorizationSource
GetOnYourDataVectorizationSource implements the OnYourDataVectorizationSourceClassification interface for type OnYourDataModelIDVectorizationSource.
func (OnYourDataModelIDVectorizationSource) MarshalJSON ¶ added in v0.4.0
func (o OnYourDataModelIDVectorizationSource) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OnYourDataModelIDVectorizationSource.
func (*OnYourDataModelIDVectorizationSource) UnmarshalJSON ¶ added in v0.4.0
func (o *OnYourDataModelIDVectorizationSource) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataModelIDVectorizationSource.
type OnYourDataSystemAssignedManagedIdentityAuthenticationOptions ¶ added in v0.4.0
type OnYourDataSystemAssignedManagedIdentityAuthenticationOptions struct {
// contains filtered or unexported fields
}
OnYourDataSystemAssignedManagedIdentityAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using a system-assigned managed identity.
func (*OnYourDataSystemAssignedManagedIdentityAuthenticationOptions) GetOnYourDataAuthenticationOptions ¶ added in v0.4.0
func (o *OnYourDataSystemAssignedManagedIdentityAuthenticationOptions) GetOnYourDataAuthenticationOptions() *OnYourDataAuthenticationOptions
GetOnYourDataAuthenticationOptions implements the OnYourDataAuthenticationOptionsClassification interface for type OnYourDataSystemAssignedManagedIdentityAuthenticationOptions.
func (OnYourDataSystemAssignedManagedIdentityAuthenticationOptions) MarshalJSON ¶ added in v0.4.0
func (o OnYourDataSystemAssignedManagedIdentityAuthenticationOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OnYourDataSystemAssignedManagedIdentityAuthenticationOptions.
func (*OnYourDataSystemAssignedManagedIdentityAuthenticationOptions) UnmarshalJSON ¶ added in v0.4.0
func (o *OnYourDataSystemAssignedManagedIdentityAuthenticationOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataSystemAssignedManagedIdentityAuthenticationOptions.
type OnYourDataUserAssignedManagedIdentityAuthenticationOptions ¶ added in v0.4.0
type OnYourDataUserAssignedManagedIdentityAuthenticationOptions struct { // REQUIRED; The resource ID of the user-assigned managed identity to use for authentication. ManagedIdentityResourceID *string // contains filtered or unexported fields }
OnYourDataUserAssignedManagedIdentityAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using a user-assigned managed identity.
func (*OnYourDataUserAssignedManagedIdentityAuthenticationOptions) GetOnYourDataAuthenticationOptions ¶ added in v0.4.0
func (o *OnYourDataUserAssignedManagedIdentityAuthenticationOptions) GetOnYourDataAuthenticationOptions() *OnYourDataAuthenticationOptions
GetOnYourDataAuthenticationOptions implements the OnYourDataAuthenticationOptionsClassification interface for type OnYourDataUserAssignedManagedIdentityAuthenticationOptions.
func (OnYourDataUserAssignedManagedIdentityAuthenticationOptions) MarshalJSON ¶ added in v0.4.0
func (o OnYourDataUserAssignedManagedIdentityAuthenticationOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OnYourDataUserAssignedManagedIdentityAuthenticationOptions.
func (*OnYourDataUserAssignedManagedIdentityAuthenticationOptions) UnmarshalJSON ¶ added in v0.4.0
func (o *OnYourDataUserAssignedManagedIdentityAuthenticationOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataUserAssignedManagedIdentityAuthenticationOptions.
type OnYourDataUsernameAndPasswordAuthenticationOptions ¶ added in v0.7.0
type OnYourDataUsernameAndPasswordAuthenticationOptions struct { // REQUIRED; The password. Password *string // REQUIRED; The username. Username *string // contains filtered or unexported fields }
OnYourDataUsernameAndPasswordAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using a username and password.
func (*OnYourDataUsernameAndPasswordAuthenticationOptions) GetOnYourDataAuthenticationOptions ¶ added in v0.7.0
func (o *OnYourDataUsernameAndPasswordAuthenticationOptions) GetOnYourDataAuthenticationOptions() *OnYourDataAuthenticationOptions
GetOnYourDataAuthenticationOptions implements the OnYourDataAuthenticationOptionsClassification interface for type OnYourDataUsernameAndPasswordAuthenticationOptions.
func (OnYourDataUsernameAndPasswordAuthenticationOptions) MarshalJSON ¶ added in v0.7.0
func (o OnYourDataUsernameAndPasswordAuthenticationOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OnYourDataUsernameAndPasswordAuthenticationOptions.
func (*OnYourDataUsernameAndPasswordAuthenticationOptions) UnmarshalJSON ¶ added in v0.7.0
func (o *OnYourDataUsernameAndPasswordAuthenticationOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataUsernameAndPasswordAuthenticationOptions.
type OnYourDataVectorSearchAPIKeyAuthenticationOptions ¶ added in v0.6.0
type OnYourDataVectorSearchAPIKeyAuthenticationOptions struct { // REQUIRED; The API key to use for authentication. Key *string // REQUIRED; The type of authentication to use. Type *OnYourDataVectorSearchAuthenticationType }
OnYourDataVectorSearchAPIKeyAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using an API key.
func (*OnYourDataVectorSearchAPIKeyAuthenticationOptions) GetOnYourDataVectorSearchAuthenticationOptions ¶ added in v0.6.0
func (o *OnYourDataVectorSearchAPIKeyAuthenticationOptions) GetOnYourDataVectorSearchAuthenticationOptions() *OnYourDataVectorSearchAuthenticationOptions
GetOnYourDataVectorSearchAuthenticationOptions implements the OnYourDataVectorSearchAuthenticationOptionsClassification interface for type OnYourDataVectorSearchAPIKeyAuthenticationOptions.
func (OnYourDataVectorSearchAPIKeyAuthenticationOptions) MarshalJSON ¶ added in v0.6.0
func (o OnYourDataVectorSearchAPIKeyAuthenticationOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OnYourDataVectorSearchAPIKeyAuthenticationOptions.
func (*OnYourDataVectorSearchAPIKeyAuthenticationOptions) UnmarshalJSON ¶ added in v0.6.0
func (o *OnYourDataVectorSearchAPIKeyAuthenticationOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataVectorSearchAPIKeyAuthenticationOptions.
type OnYourDataVectorSearchAccessTokenAuthenticationOptions ¶ added in v0.6.0
type OnYourDataVectorSearchAccessTokenAuthenticationOptions struct { // REQUIRED; The access token to use for authentication. AccessToken *string // REQUIRED; The type of authentication to use. Type *OnYourDataVectorSearchAuthenticationType }
OnYourDataVectorSearchAccessTokenAuthenticationOptions - The authentication options for Azure OpenAI On Your Data vector search when using access token.
func (*OnYourDataVectorSearchAccessTokenAuthenticationOptions) GetOnYourDataVectorSearchAuthenticationOptions ¶ added in v0.6.0
func (o *OnYourDataVectorSearchAccessTokenAuthenticationOptions) GetOnYourDataVectorSearchAuthenticationOptions() *OnYourDataVectorSearchAuthenticationOptions
GetOnYourDataVectorSearchAuthenticationOptions implements the OnYourDataVectorSearchAuthenticationOptionsClassification interface for type OnYourDataVectorSearchAccessTokenAuthenticationOptions.
func (OnYourDataVectorSearchAccessTokenAuthenticationOptions) MarshalJSON ¶ added in v0.6.0
func (o OnYourDataVectorSearchAccessTokenAuthenticationOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OnYourDataVectorSearchAccessTokenAuthenticationOptions.
func (*OnYourDataVectorSearchAccessTokenAuthenticationOptions) UnmarshalJSON ¶ added in v0.6.0
func (o *OnYourDataVectorSearchAccessTokenAuthenticationOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataVectorSearchAccessTokenAuthenticationOptions.
type OnYourDataVectorSearchAuthenticationOptions ¶ added in v0.6.0
type OnYourDataVectorSearchAuthenticationOptions struct { // REQUIRED; The type of authentication to use. Type *OnYourDataVectorSearchAuthenticationType }
OnYourDataVectorSearchAuthenticationOptions - The authentication options for Azure OpenAI On Your Data vector search.
func (*OnYourDataVectorSearchAuthenticationOptions) GetOnYourDataVectorSearchAuthenticationOptions ¶ added in v0.6.0
func (o *OnYourDataVectorSearchAuthenticationOptions) GetOnYourDataVectorSearchAuthenticationOptions() *OnYourDataVectorSearchAuthenticationOptions
GetOnYourDataVectorSearchAuthenticationOptions implements the OnYourDataVectorSearchAuthenticationOptionsClassification interface for type OnYourDataVectorSearchAuthenticationOptions.
func (OnYourDataVectorSearchAuthenticationOptions) MarshalJSON ¶ added in v0.6.0
func (o OnYourDataVectorSearchAuthenticationOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OnYourDataVectorSearchAuthenticationOptions.
func (*OnYourDataVectorSearchAuthenticationOptions) UnmarshalJSON ¶ added in v0.6.0
func (o *OnYourDataVectorSearchAuthenticationOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataVectorSearchAuthenticationOptions.
type OnYourDataVectorSearchAuthenticationOptionsClassification ¶ added in v0.6.0
type OnYourDataVectorSearchAuthenticationOptionsClassification interface { // GetOnYourDataVectorSearchAuthenticationOptions returns the OnYourDataVectorSearchAuthenticationOptions content of the underlying type. GetOnYourDataVectorSearchAuthenticationOptions() *OnYourDataVectorSearchAuthenticationOptions }
OnYourDataVectorSearchAuthenticationOptionsClassification provides polymorphic access to related types. Call the interface's GetOnYourDataVectorSearchAuthenticationOptions() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *OnYourDataVectorSearchAPIKeyAuthenticationOptions, *OnYourDataVectorSearchAccessTokenAuthenticationOptions, *OnYourDataVectorSearchAuthenticationOptions
type OnYourDataVectorSearchAuthenticationType ¶ added in v0.6.0
type OnYourDataVectorSearchAuthenticationType string
OnYourDataVectorSearchAuthenticationType - The authentication types supported with Azure OpenAI On Your Data vector search.
const ( // OnYourDataVectorSearchAuthenticationTypeAPIKey - Authentication via API key. OnYourDataVectorSearchAuthenticationTypeAPIKey OnYourDataVectorSearchAuthenticationType = "api_key" // OnYourDataVectorSearchAuthenticationTypeAccessToken - Authentication via access token. OnYourDataVectorSearchAuthenticationTypeAccessToken OnYourDataVectorSearchAuthenticationType = "access_token" )
func PossibleOnYourDataVectorSearchAuthenticationTypeValues ¶ added in v0.6.0
func PossibleOnYourDataVectorSearchAuthenticationTypeValues() []OnYourDataVectorSearchAuthenticationType
PossibleOnYourDataVectorSearchAuthenticationTypeValues returns the possible values for the OnYourDataVectorSearchAuthenticationType const type.
type OnYourDataVectorizationSource ¶ added in v0.4.0
type OnYourDataVectorizationSource struct { // REQUIRED; The type of vectorization source to use. Type *OnYourDataVectorizationSourceType }
OnYourDataVectorizationSource - An abstract representation of a vectorization source for Azure OpenAI On Your Data with vector search.
func (*OnYourDataVectorizationSource) GetOnYourDataVectorizationSource ¶ added in v0.4.0
func (o *OnYourDataVectorizationSource) GetOnYourDataVectorizationSource() *OnYourDataVectorizationSource
GetOnYourDataVectorizationSource implements the OnYourDataVectorizationSourceClassification interface for type OnYourDataVectorizationSource.
func (OnYourDataVectorizationSource) MarshalJSON ¶ added in v0.4.0
func (o OnYourDataVectorizationSource) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OnYourDataVectorizationSource.
func (*OnYourDataVectorizationSource) UnmarshalJSON ¶ added in v0.4.0
func (o *OnYourDataVectorizationSource) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataVectorizationSource.
type OnYourDataVectorizationSourceClassification ¶ added in v0.4.0
type OnYourDataVectorizationSourceClassification interface { // GetOnYourDataVectorizationSource returns the OnYourDataVectorizationSource content of the underlying type. GetOnYourDataVectorizationSource() *OnYourDataVectorizationSource }
OnYourDataVectorizationSourceClassification provides polymorphic access to related types. Call the interface's GetOnYourDataVectorizationSource() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *OnYourDataDeploymentNameVectorizationSource, *OnYourDataEndpointVectorizationSource, *OnYourDataIntegratedVectorizationSource, - *OnYourDataModelIDVectorizationSource, *OnYourDataVectorizationSource
type OnYourDataVectorizationSourceType ¶ added in v0.4.0
type OnYourDataVectorizationSourceType string
OnYourDataVectorizationSourceType - Represents the available sources Azure OpenAI On Your Data can use to configure vectorization of data for use with vector search.
const ( // OnYourDataVectorizationSourceTypeDeploymentName - Represents an Ada model deployment name to use. This model deployment // must be in the same Azure OpenAI resource, but // On Your Data will use this model deployment via an internal call rather than a public one, which enables vector // search even in private networks. OnYourDataVectorizationSourceTypeDeploymentName OnYourDataVectorizationSourceType = "deployment_name" // OnYourDataVectorizationSourceTypeEndpoint - Represents vectorization performed by public service calls to an Azure OpenAI // embedding model. OnYourDataVectorizationSourceTypeEndpoint OnYourDataVectorizationSourceType = "endpoint" // OnYourDataVectorizationSourceTypeIntegrated - Represents the integrated vectorizer defined within the search resource. OnYourDataVectorizationSourceTypeIntegrated OnYourDataVectorizationSourceType = "integrated" // OnYourDataVectorizationSourceTypeModelID - Represents a specific embedding model ID as defined in the search service. // Currently only supported by Elasticsearch®. OnYourDataVectorizationSourceTypeModelID OnYourDataVectorizationSourceType = "model_id" )
func PossibleOnYourDataVectorizationSourceTypeValues ¶ added in v0.4.0
func PossibleOnYourDataVectorizationSourceTypeValues() []OnYourDataVectorizationSourceType
PossibleOnYourDataVectorizationSourceTypeValues returns the possible values for the OnYourDataVectorizationSourceType const type.
type PineconeChatExtensionConfiguration ¶ added in v0.4.0
type PineconeChatExtensionConfiguration struct { // REQUIRED; The parameters to use when configuring Azure OpenAI chat extensions. Parameters *PineconeChatExtensionParameters // contains filtered or unexported fields }
PineconeChatExtensionConfiguration - A specific representation of configurable options for Pinecone when using it as an Azure OpenAI chat extension.
func (*PineconeChatExtensionConfiguration) GetAzureChatExtensionConfiguration ¶ added in v0.4.0
func (p *PineconeChatExtensionConfiguration) GetAzureChatExtensionConfiguration() *AzureChatExtensionConfiguration
GetAzureChatExtensionConfiguration implements the AzureChatExtensionConfigurationClassification interface for type PineconeChatExtensionConfiguration.
func (PineconeChatExtensionConfiguration) MarshalJSON ¶ added in v0.4.0
func (p PineconeChatExtensionConfiguration) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PineconeChatExtensionConfiguration.
func (*PineconeChatExtensionConfiguration) UnmarshalJSON ¶ added in v0.4.0
func (p *PineconeChatExtensionConfiguration) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PineconeChatExtensionConfiguration.
type PineconeChatExtensionParameters ¶ added in v0.4.0
type PineconeChatExtensionParameters struct { // REQUIRED; The embedding dependency for vector search. EmbeddingDependency OnYourDataVectorizationSourceClassification // REQUIRED; The environment name of Pinecone. Environment *string // REQUIRED; Customized field mapping behavior to use when interacting with the search index. FieldsMapping *PineconeFieldMappingOptions // REQUIRED; The name of the Pinecone database index. IndexName *string // If specified as true, the system will allow partial search results to be used and the request fails if all the queries // fail. If not specified, or specified as false, the request will fail if any // search query fails. AllowPartialResult *bool // The authentication method to use when accessing the defined data source. Each data source type supports a specific set // of available authentication methods; please see the documentation of the data // source for supported mechanisms. If not otherwise provided, On Your Data will attempt to use System Managed Identity (default // credential) authentication. Authentication OnYourDataAuthenticationOptionsClassification // Whether queries should be restricted to use of indexed data. InScope *bool // The included properties of the output context. If not specified, the default value is citations and intent. IncludeContexts []OnYourDataContextProperty // The max number of rewritten queries should be send to search provider for one user message. If not specified, the system // will decide the number of queries to send. MaxSearchQueries *int32 // The configured strictness of the search relevance filtering. The higher of strictness, the higher of the precision but // lower recall of the answer. Strictness *int32 // The configured top number of documents to feature for the configured query. TopNDocuments *int32 }
PineconeChatExtensionParameters - Parameters for configuring Azure OpenAI Pinecone chat extensions. The supported authentication type is APIKey.
func (PineconeChatExtensionParameters) MarshalJSON ¶ added in v0.4.0
func (p PineconeChatExtensionParameters) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PineconeChatExtensionParameters.
func (*PineconeChatExtensionParameters) UnmarshalJSON ¶ added in v0.4.0
func (p *PineconeChatExtensionParameters) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PineconeChatExtensionParameters.
type PineconeFieldMappingOptions ¶ added in v0.4.0
type PineconeFieldMappingOptions struct { // REQUIRED; The names of index fields that should be treated as content. ContentFields []string // The separator pattern that content fields should use. ContentFieldsSeparator *string // The name of the index field to use as a filepath. FilePathField *string // The name of the index field to use as a title. TitleField *string // The name of the index field to use as a URL. URLField *string }
PineconeFieldMappingOptions - Optional settings to control how fields are processed when using a configured Pinecone resource.
func (PineconeFieldMappingOptions) MarshalJSON ¶ added in v0.4.0
func (p PineconeFieldMappingOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PineconeFieldMappingOptions.
func (*PineconeFieldMappingOptions) UnmarshalJSON ¶ added in v0.4.0
func (p *PineconeFieldMappingOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PineconeFieldMappingOptions.
type SpeechGenerationOptions ¶ added in v0.5.0
type SpeechGenerationOptions struct { // REQUIRED; The text to generate audio for. The maximum length is 4096 characters. Input *string // REQUIRED; The voice to use for text-to-speech. Voice *SpeechVoice // The model to use for this text-to-speech request. DeploymentName *string // The audio output format for the spoken text. By default, the MP3 format will be used. ResponseFormat *SpeechGenerationResponseFormat // The speed of speech for generated audio. Values are valid in the range from 0.25 to 4.0, with 1.0 the default and higher // values corresponding to faster speech. Speed *float32 }
SpeechGenerationOptions - A representation of the request options that control the behavior of a text-to-speech operation.
func (SpeechGenerationOptions) MarshalJSON ¶ added in v0.5.0
func (s SpeechGenerationOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type SpeechGenerationOptions.
func (*SpeechGenerationOptions) UnmarshalJSON ¶ added in v0.5.0
func (s *SpeechGenerationOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type SpeechGenerationOptions.
type SpeechGenerationResponse ¶ added in v0.5.0
type SpeechGenerationResponse struct { // REQUIRED; The generated audio, generated in the requested audio output format. Audio []byte }
SpeechGenerationResponse - A representation of a response for a text-to-speech operation.
func (SpeechGenerationResponse) MarshalJSON ¶ added in v0.5.0
func (s SpeechGenerationResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type SpeechGenerationResponse.
func (*SpeechGenerationResponse) UnmarshalJSON ¶ added in v0.5.0
func (s *SpeechGenerationResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type SpeechGenerationResponse.
type SpeechGenerationResponseFormat ¶ added in v0.5.0
type SpeechGenerationResponseFormat string
SpeechGenerationResponseFormat - The audio output format for the spoken text. By default, the MP3 format will be used.
const ( // SpeechGenerationResponseFormatAac - Use AAC as the audio output format. AAC is optimized for digital audio compression // and is preferred by YouTube, Android, and iOS. SpeechGenerationResponseFormatAac SpeechGenerationResponseFormat = "aac" // SpeechGenerationResponseFormatFlac - Use FLAC as the audio output format. FLAC is a fully lossless format optimized for // maximum quality at the expense of size. SpeechGenerationResponseFormatFlac SpeechGenerationResponseFormat = "flac" // SpeechGenerationResponseFormatMp3 - Use MP3 as the audio output format. MP3 is the default, general-purpose format. SpeechGenerationResponseFormatMp3 SpeechGenerationResponseFormat = "mp3" // SpeechGenerationResponseFormatOpus - Use Opus as the audio output format. Opus is optimized for internet streaming and // low latency. SpeechGenerationResponseFormatOpus SpeechGenerationResponseFormat = "opus" // SpeechGenerationResponseFormatPcm - Use uncompressed PCM as the audio output format, which is similar to WAV but contains // raw samples in 24kHz (16-bit signed, low-endian), without the header. SpeechGenerationResponseFormatPcm SpeechGenerationResponseFormat = "pcm" // SpeechGenerationResponseFormatWav - Use uncompressed WAV as the audio output format, suitable for low-latency applications // to avoid decoding overhead. SpeechGenerationResponseFormatWav SpeechGenerationResponseFormat = "wav" )
func PossibleSpeechGenerationResponseFormatValues ¶ added in v0.5.0
func PossibleSpeechGenerationResponseFormatValues() []SpeechGenerationResponseFormat
PossibleSpeechGenerationResponseFormatValues returns the possible values for the SpeechGenerationResponseFormat const type.
type SpeechVoice ¶ added in v0.5.0
type SpeechVoice string
SpeechVoice - The available voices for text-to-speech.
const ( // SpeechVoiceAlloy - The Alloy voice. SpeechVoiceAlloy SpeechVoice = "alloy" // SpeechVoiceEcho - The Echo voice. SpeechVoiceEcho SpeechVoice = "echo" // SpeechVoiceFable - The Fable voice. SpeechVoiceFable SpeechVoice = "fable" // SpeechVoiceNova - The Nova voice. SpeechVoiceNova SpeechVoice = "nova" // SpeechVoiceOnyx - The Onyx voice. SpeechVoiceOnyx SpeechVoice = "onyx" // SpeechVoiceShimmer - The Shimmer voice. SpeechVoiceShimmer SpeechVoice = "shimmer" )
func PossibleSpeechVoiceValues ¶ added in v0.5.0
func PossibleSpeechVoiceValues() []SpeechVoice
PossibleSpeechVoiceValues returns the possible values for the SpeechVoice const type.
type StopFinishDetails ¶ added in v0.4.0
type StopFinishDetails struct { // REQUIRED; The token sequence that the model terminated with. Stop *string // REQUIRED; The object type. Type *string }
StopFinishDetails - A structured representation of a stop reason that signifies natural termination by the model.
func (*StopFinishDetails) GetChatFinishDetails ¶ added in v0.4.0
func (s *StopFinishDetails) GetChatFinishDetails() *ChatFinishDetails
GetChatFinishDetails implements the ChatFinishDetailsClassification interface for type StopFinishDetails.
func (StopFinishDetails) MarshalJSON ¶ added in v0.4.0
func (s StopFinishDetails) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type StopFinishDetails.
func (*StopFinishDetails) UnmarshalJSON ¶ added in v0.4.0
func (s *StopFinishDetails) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type StopFinishDetails.
type Upload ¶ added in v0.7.0
type Upload struct { // REQUIRED; The intended number of bytes to be uploaded. Bytes *int64 // REQUIRED; The Unix timestamp (in seconds) for when the Upload was created. CreatedAt *time.Time // REQUIRED; The Unix timestamp (in seconds) for when the Upload was created. ExpiresAt *time.Time // REQUIRED; The name of the file to be uploaded. Filename *string // REQUIRED; The Upload unique identifier, which can be referenced in API endpoints. ID *string // REQUIRED; The intended purpose of the file. Purpose *UploadPurpose // REQUIRED; The status of the Upload. Status *UploadStatus // The ready File object after the Upload is completed. File *UploadFile // The object type, which is always "upload". Object *string }
Upload - The Upload object can accept byte chunks in the form of Parts.
func (Upload) MarshalJSON ¶ added in v0.7.0
MarshalJSON implements the json.Marshaller interface for type Upload.
func (*Upload) UnmarshalJSON ¶ added in v0.7.0
UnmarshalJSON implements the json.Unmarshaller interface for type Upload.
type UploadFile ¶ added in v0.7.0
type UploadFile struct { // REQUIRED; The size of the file, in bytes. Bytes *int32 // REQUIRED; The Unix timestamp, in seconds, representing when this object was created. CreatedAt *time.Time // REQUIRED; The name of the file. Filename *string // REQUIRED; The identifier, which can be referenced in API endpoints. ID *string // REQUIRED; The object type, which is always 'file'. Object *string // REQUIRED; The intended purpose of a file. Purpose *FilePurpose // The state of the file. This field is available in Azure OpenAI only. Status *FileState // The error message with details in case processing of this file failed. This field is available in Azure OpenAI only. StatusDetails *string }
UploadFile - The ready File object after the Upload is completed.
func (UploadFile) MarshalJSON ¶ added in v0.7.0
func (u UploadFile) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type UploadFile.
func (*UploadFile) UnmarshalJSON ¶ added in v0.7.0
func (u *UploadFile) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type UploadFile.
type UploadFileOptions ¶ added in v0.6.2
type UploadFileOptions struct { // A filename to associate with the uploaded data. Filename *string }
UploadFileOptions contains the optional parameters for the Client.UploadFile method.
type UploadFileResponse ¶ added in v0.6.2
type UploadFileResponse struct { // Represents an assistant that can call the model and use tools. File }
UploadFileResponse contains the response from method Client.UploadFile.
type UploadPart ¶ added in v0.7.0
type UploadPart struct { // REQUIRED; The Unix timestamp (in seconds) for when the Part was created. CreatedAt *time.Time // REQUIRED; The upload Part unique identifier, which can be referenced in API endpoints. ID *string // REQUIRED; The object type, which is always upload.part. Object *string // REQUIRED; The ID of the Upload object that this Part was added to. UploadID *string // Azure only field. AzureBlockID *string }
UploadPart - The upload Part represents a chunk of bytes we can add to an Upload object.
func (UploadPart) MarshalJSON ¶ added in v0.7.0
func (u UploadPart) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type UploadPart.
func (*UploadPart) UnmarshalJSON ¶ added in v0.7.0
func (u *UploadPart) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type UploadPart.
type UploadPurpose ¶ added in v0.7.0
type UploadPurpose string
UploadPurpose - The intended purpose of the file.
const ( UploadPurposeAssistants UploadPurpose = "assistants" UploadPurposeAssistantsOutput UploadPurpose = "assistants_output" UploadPurposeBatch UploadPurpose = "batch" UploadPurposeBatchOutput UploadPurpose = "batch_output" UploadPurposeFineTune UploadPurpose = "fine-tune" UploadPurposeFineTuneResults UploadPurpose = "fine-tune-results" UploadPurposeVision UploadPurpose = "vision" )
func PossibleUploadPurposeValues ¶ added in v0.7.0
func PossibleUploadPurposeValues() []UploadPurpose
PossibleUploadPurposeValues returns the possible values for the UploadPurpose const type.
type UploadStatus ¶ added in v0.7.0
type UploadStatus string
UploadStatus - The status of the Upload.
const ( UploadStatusCancelled UploadStatus = "cancelled" UploadStatusCompleted UploadStatus = "completed" UploadStatusExpired UploadStatus = "expired" UploadStatusPending UploadStatus = "pending" )
func PossibleUploadStatusValues ¶ added in v0.7.0
func PossibleUploadStatusValues() []UploadStatus
PossibleUploadStatusValues returns the possible values for the UploadStatus const type.
Source Files ¶
- build.go
- client.go
- client_custom_files.go
- client_extra.go
- constants.go
- custom_client.go
- custom_client_audio.go
- custom_client_pagers.go
- custom_models.go
- event_reader.go
- interfaces.go
- models.go
- models_extra.go
- models_serde.go
- options.go
- pager.go
- polymorphic_helpers.go
- responses.go
- time_unix.go
- version.go