Categorygithub.com/Azure/azure-sdk-for-go/sdk/ai/azopenai
modulepackage
0.7.2
Repository: https://github.com/azure/azure-sdk-for-go.git
Documentation: pkg.go.dev

# README

Azure OpenAI client module for Go

NOTE: this client can be used with Azure OpenAI and OpenAI.

Azure OpenAI Service provides access to OpenAI's features:

  • Language models including the GPT-4, GPT-35-Turbo, and Embeddings model series.
  • Image generation using DALL-E.
  • Speech transcription and speech generation.

Source code | Package (pkg.go.dev) | REST API documentation | Product documentation

Getting started

Prerequisites

Install the packages

Install the azopenai and azidentity modules with go get:

go get github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai

# optional
go get github.com/Azure/azure-sdk-for-go/sdk/azidentity

The azidentity module is used for Azure Active Directory authentication with Azure OpenAI.

Authentication

Azure OpenAI

Azure OpenAI clients can authenticate using Azure Active Directory or with an API key:

  • Using Azure Active Directory, with a TokenCredential: example
  • Using an API key: example

OpenAI

OpenAI supports connecting using an API key: example

Key concepts

See Key concepts in the product documentation for more details about general concepts.

Examples

Examples for various scenarios can be found on pkg.go.dev or in the example*_test.go files in our GitHub repo for azopenai.

Troubleshooting

Error Handling

All methods that send HTTP requests return *azcore.ResponseError when these requests fail. ResponseError has error details and the raw response from the service.

Logging

This module uses the logging implementation in azcore. To turn on logging for all Azure SDK modules, set AZURE_SDK_GO_LOGGING to all. By default, the logger writes to stderr. Use the azcore/log package to control log output. For example, logging only HTTP request and response events, and printing them to stdout:

import azlog "github.com/Azure/azure-sdk-for-go/sdk/azcore/log"

// Print log events to stdout
azlog.SetListener(func(cls azlog.Event, msg string) {
	fmt.Println(msg)
})

// Includes only requests and responses in credential logs
azlog.SetEvents(azlog.EventRequest, azlog.EventResponse)

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

# Functions

NewChatCompletionsToolChoice creates a ChatCompletionsToolChoice for a specific tool.
NewChatRequestAssistantMessageContent creates a [azopenai.ChatRequestAssistantMessageContent].
NewChatRequestDeveloperMessageContent creates a [azopenai.ChatRequestDeveloperMessageContent].
NewChatRequestSystemMessageContent creates a [azopenai.ChatRequestSystemMessageContent].
NewChatRequestToolMessageContent creates a [azopenai.ChatRequestToolMessageContent].
NewChatRequestUserMessageContent creates a [azopenai.ChatRequestUserMessageContent].
NewClient creates a new instance of Client that connects to an Azure OpenAI endpoint.
NewClientForOpenAI creates a new instance of Client which connects to the public OpenAI endpoint.
NewClientWithKeyCredential creates a new instance of Client that connects to an Azure OpenAI endpoint.
NewMongoDBChatExtensionParametersEmbeddingDependency creates a [azopenai.MongoDBChatExtensionParametersEmbeddingDependency].
NewPredictionContentContent creates a [azopenai.PredictionContentContent].
PossibleAudioTaskLabelValues returns the possible values for the AudioTaskLabel const type.
PossibleAudioTranscriptionFormatValues returns the possible values for the AudioTranscriptionFormat const type.
PossibleAudioTranscriptionTimestampGranularityValues returns the possible values for the AudioTranscriptionTimestampGranularity const type.
PossibleAudioTranslationFormatValues returns the possible values for the AudioTranslationFormat const type.
PossibleAzureChatExtensionRetrieveDocumentFilterReasonValues returns the possible values for the AzureChatExtensionRetrieveDocumentFilterReason const type.
PossibleAzureChatExtensionTypeValues returns the possible values for the AzureChatExtensionType const type.
PossibleAzureSearchQueryTypeValues returns the possible values for the AzureSearchQueryType const type.
PossibleBatchStatusValues returns the possible values for the BatchStatus const type.
PossibleChatCompletionModalityValues returns the possible values for the ChatCompletionModality const type.
PossibleChatCompletionRequestMessageContentPartImageURLDetailValues returns the possible values for the ChatCompletionRequestMessageContentPartImageURLDetail const type.
PossibleChatCompletionRequestMessageContentPartTypeValues returns the possible values for the ChatCompletionRequestMessageContentPartType const type.
PossibleChatCompletionsToolSelectionPresetValues returns the possible values for the ChatCompletionsToolSelectionPreset const type.
PossibleChatMessageImageDetailLevelValues returns the possible values for the ChatMessageImageDetailLevel const type.
PossibleChatRoleValues returns the possible values for the ChatRole const type.
PossibleCompletionsFinishReasonValues returns the possible values for the CompletionsFinishReason const type.
PossibleContentFilterSeverityValues returns the possible values for the ContentFilterSeverity const type.
PossibleCreateUploadRequestPurposeValues returns the possible values for the CreateUploadRequestPurpose const type.
PossibleElasticsearchQueryTypeValues returns the possible values for the ElasticsearchQueryType const type.
PossibleEmbeddingEncodingFormatValues returns the possible values for the EmbeddingEncodingFormat const type.
PossibleFilePurposeValues returns the possible values for the FilePurpose const type.
PossibleFileStateValues returns the possible values for the FileState const type.
PossibleFunctionCallPresetValues returns the possible values for the FunctionCallPreset const type.
PossibleImageGenerationQualityValues returns the possible values for the ImageGenerationQuality const type.
PossibleImageGenerationResponseFormatValues returns the possible values for the ImageGenerationResponseFormat const type.
PossibleImageGenerationStyleValues returns the possible values for the ImageGenerationStyle const type.
PossibleImageSizeValues returns the possible values for the ImageSize const type.
PossibleInputAudioFormatValues returns the possible values for the InputAudioFormat const type.
PossibleOnYourDataAuthenticationTypeValues returns the possible values for the OnYourDataAuthenticationType const type.
PossibleOnYourDataContextPropertyValues returns the possible values for the OnYourDataContextProperty const type.
PossibleOnYourDataVectorizationSourceTypeValues returns the possible values for the OnYourDataVectorizationSourceType const type.
PossibleOnYourDataVectorSearchAuthenticationTypeValues returns the possible values for the OnYourDataVectorSearchAuthenticationType const type.
PossibleOutputAudioFormatValues returns the possible values for the OutputAudioFormat const type.
PossibleReasoningEffortValueValues returns the possible values for the ReasoningEffortValue const type.
PossibleSpeechGenerationResponseFormatValues returns the possible values for the SpeechGenerationResponseFormat const type.
PossibleSpeechVoiceValues returns the possible values for the SpeechVoice const type.
PossibleUploadPurposeValues returns the possible values for the UploadPurpose const type.
PossibleUploadStatusValues returns the possible values for the UploadStatus const type.

# Constants

AudioTaskLabelTranscribe - Accompanying response data resulted from an audio transcription task.
AudioTaskLabelTranslate - Accompanying response data resulted from an audio translation task.
AudioTranscriptionFormatJSON - Use a response body that is a JSON object containing a single 'text' field for the transcription.
AudioTranscriptionFormatSrt - Use a response body that is plain text in SubRip (SRT) format that also includes timing information.
AudioTranscriptionFormatText - Use a response body that is plain text containing the raw, unannotated transcription.
AudioTranscriptionFormatVerboseJSON - Use a response body that is a JSON object containing transcription text along with timing, segments, and other metadata.
AudioTranscriptionFormatVtt - Use a response body that is plain text in Web Video Text Tracks (VTT) format that also includes timing information.
AudioTranscriptionTimestampGranularitySegment - Indicates that responses should include timing and other information about each transcribed audio segment.
AudioTranscriptionTimestampGranularityWord - Indicates that responses should include timing information about each transcribed word.
AudioTranslationFormatJSON - Use a response body that is a JSON object containing a single 'text' field for the translation.
AudioTranslationFormatSrt - Use a response body that is plain text in SubRip (SRT) format that also includes timing information.
AudioTranslationFormatText - Use a response body that is plain text containing the raw, unannotated translation.
AudioTranslationFormatVerboseJSON - Use a response body that is a JSON object containing translation text along with timing, segments, and other metadata.
AudioTranslationFormatVtt - Use a response body that is plain text in Web Video Text Tracks (VTT) format that also includes timing information.
AzureChatExtensionRetrieveDocumentFilterReasonRerank - The document is not filtered by original search score threshold, but is filtered by rerank score and `top_n_documents` configure.
AzureChatExtensionRetrieveDocumentFilterReasonScore - The document is filtered by original search score threshold defined by `strictness` configure.
AzureChatExtensionTypeAzureCosmosDB - Represents the use of Azure Cosmos DB as an Azure OpenAI chat extension.
AzureChatExtensionTypeAzureSearch - Represents the use of Azure AI Search as an Azure OpenAI chat extension.
AzureChatExtensionTypeElasticsearch - Represents the use of Elasticsearch® index as an Azure OpenAI chat extension.
AzureChatExtensionTypeMongoDB - Represents the use of a MongoDB chat extension.
AzureChatExtensionTypePinecone - Represents the use of Pinecone index as an Azure OpenAI chat extension.
AzureSearchQueryTypeSemantic - Represents the semantic query parser for advanced semantic modeling.
AzureSearchQueryTypeSimple - Represents the default, simple query parser.
AzureSearchQueryTypeVector - Represents vector search over computed data.
AzureSearchQueryTypeVectorSemanticHybrid - Represents a combination of semantic search and vector data querying.
AzureSearchQueryTypeVectorSimpleHybrid - Represents a combination of the simple query strategy with vector data.
BatchStatusCancelled - The batch was cancelled.
BatchStatusCancelling - Cancellation of the batch has been initiated.
BatchStatusCompleted - The batch has been completed and the results are ready.
BatchStatusExpired - The batch was not able to complete within the 24-hour time window.
BatchStatusFailed - The input file has failed the validation process.
BatchStatusFinalizing - The batch has completed and the results are being prepared.
BatchStatusInProgress - The input file was successfully validated and the batch is currently being executed.
BatchStatusValidating - The input file is being validated before the batch can begin.
ChatCompletionModalityAudio - The model is to generate audio output.
ChatCompletionModalityText - The model is to generate text output.
No description provided by the author
No description provided by the author
No description provided by the author
ChatCompletionRequestMessageContentPartTypeImageURL - Chat content contains an image URL.
ChatCompletionRequestMessageContentPartTypeText - Chat content contains text.
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.
ChatCompletionsToolSelectionPresetNone - Specifies that the model should not respond with a tool call and should instead provide a standard chat completions response.
ChatCompletionsToolSelectionPresetRequired - Specifies that the model must call one or more tools.
ChatMessageImageDetailLevelAuto - Specifies that the model should determine which detail level to apply using heuristics like image size.
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.
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.
ChatRoleAssistant - The role that provides responses to system-instructed, user-prompted input.
ChatRoleDeveloper - The role that provides instructions that the model should follow.
ChatRoleFunction - The role that provides function results for chat completions.
ChatRoleSystem - The role that instructs or sets the behavior of the assistant.
ChatRoleTool - The role that represents extension tool activity within a chat completions operation.
ChatRoleUser - The role that provides input for chat completions.
CompletionsFinishReasonContentFiltered - Completions generated a response that was identified as potentially sensitive per content moderation policies.
CompletionsFinishReasonFunctionCall - Completion ended normally, with the model requesting a function to be called.
CompletionsFinishReasonStopped - Completions ended normally and reached its end of token generation.
CompletionsFinishReasonTokenLimitReached - Completions exhausted available token limits before generation could complete.
CompletionsFinishReasonToolCalls - Completion ended with the model calling a provided tool for output.
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.
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.
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.
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.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ElasticsearchQueryTypeSimple - Represents the default, simple query parser.
ElasticsearchQueryTypeVector - Represents vector search over computed data.
EmbeddingEncodingFormatBase64 - Specifies that responses should provide a base64-encoded string for each embedding.
EmbeddingEncodingFormatFloat - Specifies that responses should provide arrays of floats for each embedding.
FilePurposeAssistants - Indicates a file is used as input to assistants.
FilePurposeAssistantsOutput - Indicates a file is used as output by assistants.
FilePurposeBatch - Indicates a file is used as input to .
FilePurposeBatchOutput - Indicates a file is used as output by a vector store batch operation.
FilePurposeFineTune - Indicates a file is used for fine tuning input.
FilePurposeFineTuneResults - Indicates a file is used for fine tuning results.
FilePurposeVision - Indicates a file is used as input to a vision operation.
FileStateDeleted - The entity has been deleted but may still be referenced by other entities predating the deletion.
FileStateDeleting - The entity is in the process to be deleted.
FileStateError - The operation has completed processing with a failure and cannot be further consumed.
FileStatePending - The operation was created and is not queued to be processed in the future.
FileStateProcessed - The operation has successfully processed and is ready for consumption.
FileStateRunning - The operation has started to be processed.
FileStateUploaded - The file has been uploaded but it's not yet processed.
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.
FunctionCallPresetNone - Specifies that the model should not respond with a function call and should instead provide a standard chat completions response.
ImageGenerationQualityHd - Requests image generation with higher quality, higher cost and lower speed relative to standard.
ImageGenerationQualityStandard - Requests image generation with standard, balanced characteristics of quality, cost, and speed.
ImageGenerationResponseFormatBase64 - Image generation response items should provide image data as a base64-encoded string.
ImageGenerationResponseFormatURL - Image generation response items should provide a URL from which the image may be retrieved.
ImageGenerationStyleNatural - Requests image generation in a natural style with less preference for dramatic and hyper-realistic characteristics.
ImageGenerationStyleVivid - Requests image generation in a vivid style with a higher preference for dramatic and hyper-realistic characteristics.
ImageSizeSize1024X1024 - A standard, square image size of 1024x1024 pixels.
ImageSizeSize1024X1792 - A taller image size of 1792x1024 pixels.
ImageSizeSize1792X1024 - A wider image size of 1024x1792 pixels.
ImageSizeSize256X256 - Very small image size of 256x256 pixels.
ImageSizeSize512X512 - A smaller image size of 512x512 pixels.
InputAudioFormatMp3 - Specifies that the audio data is in the MP3 format.
InputAudioFormatWav - Specifies that the audio data is in the WAV format.
OnYourDataAuthenticationTypeAccessToken - Authentication via access token.
OnYourDataAuthenticationTypeAPIKey - Authentication via API key.
OnYourDataAuthenticationTypeConnectionString - Authentication via connection string.
OnYourDataAuthenticationTypeEncodedAPIKey - Authentication via encoded API key.
OnYourDataAuthenticationTypeKeyAndKeyID - Authentication via key and key ID pair.
OnYourDataAuthenticationTypeSystemAssignedManagedIdentity - Authentication via system-assigned managed identity.
OnYourDataAuthenticationTypeUserAssignedManagedIdentity - Authentication via user-assigned managed identity.
OnYourDataAuthenticationTypeUsernameAndPassword - Authentication via username and password.
OnYourDataContextPropertyAllRetrievedDocuments - The `all_retrieved_documents` property.
OnYourDataContextPropertyCitations - The `citations` property.
OnYourDataContextPropertyIntent - The `intent` property.
OnYourDataVectorizationSourceTypeDeploymentName - Represents an Ada model deployment name to use.
OnYourDataVectorizationSourceTypeEndpoint - Represents vectorization performed by public service calls to an Azure OpenAI embedding model.
OnYourDataVectorizationSourceTypeIntegrated - Represents the integrated vectorizer defined within the search resource.
OnYourDataVectorizationSourceTypeModelID - Represents a specific embedding model ID as defined in the search service.
OnYourDataVectorSearchAuthenticationTypeAccessToken - Authentication via access token.
OnYourDataVectorSearchAuthenticationTypeAPIKey - Authentication via API key.
OutputAudioFormatFlac - The output audio format is FLAC.
OutputAudioFormatMp3 - The output audio format is MP3.
OutputAudioFormatOpus - The output audio format is OPUS.
OutputAudioFormatPcm16 - The output audio format is PCM16.
OutputAudioFormatWav - The output audio format is WAV.
ReasoningEffortValueHigh - The reasoning effort is high.
ReasoningEffortValueLow - The reasoning effort is low.
ReasoningEffortValueMedium - The reasoning effort is medium.
SpeechGenerationResponseFormatAac - Use AAC as the audio output format.
SpeechGenerationResponseFormatFlac - Use FLAC as the audio output format.
SpeechGenerationResponseFormatMp3 - Use MP3 as the audio output format.
SpeechGenerationResponseFormatOpus - Use Opus as the audio output format.
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.
SpeechGenerationResponseFormatWav - Use uncompressed WAV as the audio output format, suitable for low-latency applications to avoid decoding overhead.
SpeechVoiceAlloy - The Alloy voice.
SpeechVoiceEcho - The Echo voice.
SpeechVoiceFable - The Fable voice.
SpeechVoiceNova - The Nova voice.
SpeechVoiceOnyx - The Onyx voice.
SpeechVoiceShimmer - The Shimmer voice.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

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.

# Structs

AddUploadPartOptions contains the optional parameters for the Client.AddUploadPart method.
AddUploadPartRequest - The multipart/form-data request body of a data part addition request for an upload.
AddUploadPartResponse contains the response from method Client.AddUploadPart.
AudioOutputParameters - Describes the parameters for audio output.
AudioResponseData - Object containing audio response data and its metadata.
AudioTranscription - Result information for an operation that transcribed spoken audio into written text.
AudioTranscriptionOptions - The configuration information for an audio transcription request.
AudioTranscriptionSegment - Extended information about a single segment of transcribed audio data.
AudioTranscriptionWord - Extended information about a single transcribed word, as provided on responses when the 'word' timestamp granularity is provided.
AudioTranslation - Result information for an operation that translated spoken audio into written text.
AudioTranslationOptions - The configuration information for an audio translation request.
AudioTranslationSegment - Extended information about a single segment of translated audio data.
AzureChatEnhancementConfiguration - A representation of the available Azure OpenAI enhancement configurations.
AzureChatEnhancements - Represents the output results of Azure enhancements to chat completions, as configured via the matching input provided in the request.
AzureChatExtensionConfiguration - A representation of configuration data for a single Azure OpenAI chat extension.
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.
AzureChatExtensionOptions provides Azure specific options to extend ChatCompletions.
AzureChatExtensionRetrievedDocument - The retrieved document.
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.
AzureChatGroundingEnhancementConfiguration - A representation of the available options for the Azure OpenAI grounding enhancement.
AzureChatOCREnhancementConfiguration - A representation of the available options for the Azure OpenAI optical character recognition (OCR) enhancement.
AzureCosmosDBChatExtensionConfiguration - A specific representation of configurable options for Azure Cosmos DB when using it as an Azure OpenAI chat extension.
AzureCosmosDBChatExtensionParameters - Parameters to use when configuring Azure OpenAI On Your Data chat extensions when using Azure Cosmos DB for MongoDB vCore.
AzureCosmosDBFieldMappingOptions - Optional settings to control how fields are processed when using a configured Azure Cosmos DB resource.
AzureGroundingEnhancement - The grounding enhancement that returns the bounding box of the objects detected in the image.
AzureGroundingEnhancementCoordinatePoint - A representation of a single polygon point as used by the Azure grounding enhancement.
AzureGroundingEnhancementLine - A content line object consisting of an adjacent sequence of content elements, such as words and selection marks.
AzureGroundingEnhancementLineSpan - A span object that represents a detected object and its bounding box information.
AzureSearchChatExtensionConfiguration - A specific representation of configurable options for Azure Search when using it as an Azure OpenAI chat extension.
AzureSearchChatExtensionParameters - Parameters for Azure Cognitive Search when used as an Azure OpenAI chat extension.
AzureSearchIndexFieldMappingOptions - Optional settings to control how fields are processed when using a configured Azure Search resource.
Batch - The Batch object.
BatchCreateRequest - Defines the request to create a batch.
BatchCreateResponseRequestCounts - The request counts for different statuses within the batch.
BatchErrorDatum - A Datum containing information about a Batch Error.
BatchErrorList - A list of Batch errors.
BatchRequestCounts - The request counts for different statuses within the batch.
BatchRequestInput - The per-line object of the batch input file.
BatchRequestOutput - The per-line object of the batch output and error files.
BatchRequestOutputError - For requests that failed with a non-HTTP error, this will contain more information on the cause of the failure.
BatchRequestOutputResponse - The http response.
CancelBatchOptions contains the optional parameters for the Client.CancelBatch method.
CancelBatchResponse contains the response from method Client.CancelBatch.
CancelUploadOptions contains the optional parameters for the Client.CancelUpload method.
CancelUploadResponse contains the response from method Client.CancelUpload.
ChatChoice - The representation of a single prompt completion as part of an overall chat completions request.
ChatChoiceLogProbabilityInfo - Log probability information for a choice, as requested via 'logprobs' and 'top_logprobs'.
ChatChoiceLogProbs - The log probability information for this choice, as enabled via the 'logprobs' request option.
ChatCompletionRequestMessageContentPart - represents either an image URL or text content for a prompt.
ChatCompletionRequestMessageContentPartImage - represents an image URL, to be used as part of a prompt.
ChatCompletionRequestMessageContentPartImageURL - contains the URL and level of detail for an image prompt.
ChatCompletionRequestMessageContentPartText - represents text content, to be used as part of a prompt.
ChatCompletions - Representation of the response data from a chat completions request.
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.
ChatCompletionsFunctionToolDefinition - The definition information for a chat completions function tool that can call a function in response to a tool call.
ChatCompletionsFunctionToolDefinitionFunction - The function definition details for the function tool.
ChatCompletionsFunctionToolSelection - A tool selection of a specific, named function tool that will limit chat completions to using the named function.
ChatCompletionsJSONResponseFormat - A response format for Chat Completions that restricts responses to emitting valid JSON objects.
ChatCompletionsJSONSchemaResponseFormat - A response format for Chat Completions that restricts responses to emitting JSON that conforms to a provided JSON Schema for Structured Outputs.
ChatCompletionsJSONSchemaResponseFormatJSONSchema - A description of what the response format is for, used by the model to determine how to respond in the format.
ChatCompletionsNamedFunctionToolSelection - A tool selection of a specific, named function tool that will limit chat completions to using the named function.
ChatCompletionsNamedToolSelection - An abstract representation of an explicit, named tool selection to use for a chat completions request.
ChatCompletionsOptions - The configuration information for a chat completions request.
ChatCompletionsOptionsFunctionCall - Controls how the model responds to function calls.
ChatCompletionsResponseFormat - An abstract representation of a response format configuration usable by Chat Completions.
ChatCompletionsStreamOptions - The configuration information for a chat completions request.
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.
ChatCompletionsToolCall - An abstract representation of a tool call that must be resolved in a subsequent request to perform the requested chat completion.
ChatCompletionsToolChoice controls which tool is used for this ChatCompletions call.
ChatCompletionsToolChoiceFunction can be used to force the model to call a particular function.
ChatCompletionsToolDefinition - An abstract representation of a tool that can be used by the model to improve a chat completions response.
ChatCompletionStreamOptions - Options for streaming response.
ChatFinishDetails - An abstract representation of structured information about why a chat completions response terminated.
ChatMessageAudioContentItem - A structured chat content item containing audio data.
ChatMessageContentItem - An abstract representation of a structured content item within a chat message.
ChatMessageImageContentItem - A structured chat content item containing an image reference.
ChatMessageImageURL - An internet location from which the model may retrieve an image.
ChatMessageRefusalContentItem - A structured chat content item containing model refusal information for a structured outputs request.
ChatMessageTextContentItem - A structured chat content item containing plain text.
ChatRequestAssistantMessage - A request chat message representing response or action from the assistant.
ChatRequestAssistantMessageContent represents the content for a [azopenai.ChatRequestAssistantMessage].
ChatRequestDeveloperMessage - Developer-provided instructions that the model should follow, regardless of messages sent by the user.
ChatRequestDeveloperMessageContent contains the content for a [ChatRequestDeveloperMessage].
ChatRequestFunctionMessage - A request chat message representing requested output from a configured function.
ChatRequestMessage - An abstract representation of a chat message as provided in a request.
ChatRequestSystemMessage - A request chat message containing system instructions that influence how the model will generate a chat completions response.
ChatRequestSystemMessageContent contains the content for a [ChatRequestSystemMessage].
ChatRequestToolMessage - A request chat message representing requested output from a configured tool.
ChatRequestToolMessageContent contains the content for a [ChatRequestToolMessage].
ChatRequestUserMessage - A request chat message representing user input to the assistant.
ChatRequestUserMessageContent contains the user prompt - either as a single string or as a []ChatCompletionRequestMessageContentPart, enabling images and text as input.
ChatResponseMessage - A representation of a chat message as received in a response.
ChatTokenLogProbabilityInfo - A representation of the log probability information for a single message content token.
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.
Choice - The representation of a single prompt completion as part of an overall completions request.
ChoiceLogProbs - The log probabilities model for tokens associated with this completions choice.
Client contains the methods for the OpenAI group.
ClientOptions contains optional settings for Client.
CompleteUploadOptions contains the optional parameters for the Client.CompleteUpload method.
CompleteUploadRequest - The request body of an upload completion request.
CompleteUploadResponse contains the response from method Client.CompleteUpload.
Completions - Representation of the response data from a completions request.
CompletionsLogProbabilityModel - Representation of a log probabilities model for a completions generation.
CompletionsOptions - The configuration information for a completions request.
CompletionsStreamOptions - The configuration information for a completions request.
CompletionsUsage - Representation of the token counts processed for a completions request.
CompletionsUsageCompletionTokensDetails - Breakdown of tokens used in a completion.
CompletionsUsagePromptTokensDetails - Details of the prompt tokens.
ContentFilterBlocklistIDResult - Represents the outcome of an evaluation against a custom blocklist as performed by content filtering.
ContentFilterCitedDetectionResult - Represents the outcome of a detection operation against protected resources as performed by content filtering.
ContentFilterCompletionTextSpan - Describes a span within generated completion text.
ContentFilterCompletionTextSpanResult - Describes a span within generated completion text.
ContentFilterDetailedResults - Represents a structured collection of result details for content filtering.
ContentFilterDetectionResult - Represents the outcome of a detection operation performed by content filtering.
ContentFilterResponseError is an error as a result of a request being filtered.
ContentFilterResult - Information about filtered content severity level and if it has been filtered or not.
ContentFilterResultDetailsForPrompt - Information about content filtering evaluated against input data to Azure OpenAI.
ContentFilterResults are the content filtering results for a [ContentFilterResponseError].
ContentFilterResultsForChoice - Information about content filtering evaluated against generated model output.
ContentFilterResultsForPrompt - Content filtering results for a single prompt in the request.
CreateBatchOptions contains the optional parameters for the Client.CreateBatch method.
CreateBatchResponse contains the response from method Client.CreateBatch.
CreateUploadOptions contains the optional parameters for the Client.CreateUpload method.
CreateUploadRequest - The request body of an upload creation operation.
CreateUploadResponse contains the response from method Client.CreateUpload.
DeleteFileOptions contains the optional parameters for the Client.DeleteFile method.
DeleteFileResponse contains the response from method Client.DeleteFile.
ElasticsearchChatExtensionConfiguration - A specific representation of configurable options for Elasticsearch when using it as an Azure OpenAI chat extension.
ElasticsearchChatExtensionParameters - Parameters to use when configuring Elasticsearch® as an Azure OpenAI chat extension.
ElasticsearchIndexFieldMappingOptions - Optional settings to control how fields are processed when using a configured Elasticsearch® resource.
EmbeddingItem - Representation of a single embeddings relatedness comparison.
Embeddings - Representation of the response data from an embeddings request.
EmbeddingsOptions - The configuration information for an embeddings request.
EmbeddingsUsage - Measurement of the amount of tokens used in this request and response.
Error - The error object.
EventReader streams events dynamically from an OpenAI endpoint.
File - Represents an assistant that can call the model and use tools.
FileDeletionStatus - A status response from a file deletion operation.
FileListResponse - The response data from a file list operation.
FunctionCall - The name and arguments of a function that should be called, as generated by the model.
FunctionDefinition - The definition of a caller-specified function that chat completions may invoke in response to matching user input.
FunctionName - A structure that specifies the exact name of a specific, request-provided function to use when processing a chat completions operation.
GenerateSpeechFromTextOptions contains the optional parameters for the Client.GenerateSpeechFromText method.
GenerateSpeechFromTextResponse contains the response from method Client.GenerateSpeechFromText.
GetAudioTranscriptionBody - Get audio transcription body.
GetAudioTranscriptionOptions contains the optional parameters for the [Client.GetAudioTranscription] method.
GetAudioTranscriptionResponse contains the response from method [Client.GetAudioTranscription].
GetAudioTranslationBody - Get audio translation body.
GetAudioTranslationOptions contains the optional parameters for the [Client.GetAudioTranslation] method.
GetAudioTranslationResponse contains the response from method [Client.GetAudioTranslation].
GetBatchOptions contains the optional parameters for the Client.GetBatch method.
GetBatchResponse contains the response from method Client.GetBatch.
GetChatCompletionsOptions contains the optional parameters for the Client.GetChatCompletions method.
GetChatCompletionsResponse contains the response from method Client.GetChatCompletions.
GetChatCompletionsStreamOptions contains the optional parameters for the [Client.GetChatCompletionsStream] method.
GetChatCompletionsStreamResponse is the response from [Client.GetChatCompletionsStream].
GetCompletionsOptions contains the optional parameters for the Client.GetCompletions method.
GetCompletionsResponse contains the response from method Client.GetCompletions.
GetCompletionsStreamOptions contains the optional parameters for the [Client.GetCompletionsStream] method.
GetCompletionsStreamResponse is the response from [Client.GetCompletionsStream].
GetEmbeddingsOptions contains the optional parameters for the Client.GetEmbeddings method.
GetEmbeddingsResponse contains the response from method Client.GetEmbeddings.
GetFileContentOptions contains the optional parameters for the Client.GetFileContent method.
GetFileContentResponse contains the response from method Client.GetFileContent.
GetFileOptions contains the optional parameters for the Client.GetFile method.
GetFileResponse contains the response from method Client.GetFile.
GetImageGenerationsOptions contains the optional parameters for the Client.GetImageGenerations method.
GetImageGenerationsResponse contains the response from method Client.GetImageGenerations.
ImageGenerationContentFilterResults - Describes the content filtering result for the image generation request.
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.
ImageGenerationOptions - Represents the request data used to generate images.
ImageGenerationPromptFilterResults - Describes the content filtering results for the prompt of a image generation request.
ImageGenerations - The result of a successful image generation operation.
ImageGenerationsDataItem contains the results of image generation.
InputAudioContent - A structured chat content item containing audio data.
ListBatchesOptions contains the optional parameters for the Client.ListBatches method.
ListBatchesPage - The response data for a requested list of items.
ListBatchesResponse contains the response from method Client.ListBatches.
ListFilesOptions contains the optional parameters for the Client.ListFiles method.
ListFilesResponse contains the response from method Client.ListFiles.
MaxTokensFinishDetails - A structured representation of a stop reason that signifies a token limit was reached before the model could naturally complete.
MongoDBChatExtensionConfiguration - A specific representation of configurable options for a MongoDB chat extension configuration.
MongoDBChatExtensionParameters - Parameters for the MongoDB chat extension.
MongoDBChatExtensionParametersEmbeddingDependency contains the embedding dependency for the [MongoDBChatExtensionParameters].
MongoDBChatExtensionParametersFieldsMapping - Field mappings to apply to data used by the MongoDB data source.
OnYourDataAccessTokenAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using access token.
OnYourDataAPIKeyAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using an API key.
OnYourDataAuthenticationOptions - The authentication options for Azure OpenAI On Your Data.
OnYourDataConnectionStringAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using a connection string.
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.
OnYourDataEncodedAPIKeyAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using an Elasticsearch encoded API key.
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.
OnYourDataIntegratedVectorizationSource - Represents the integrated vectorizer defined within the search resource.
OnYourDataKeyAndKeyIDAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using an Elasticsearch key and key ID pair.
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.
OnYourDataSystemAssignedManagedIdentityAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using a system-assigned managed identity.
OnYourDataUserAssignedManagedIdentityAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using a user-assigned managed identity.
OnYourDataUsernameAndPasswordAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using a username and password.
OnYourDataVectorizationSource - An abstract representation of a vectorization source for Azure OpenAI On Your Data with vector search.
OnYourDataVectorSearchAccessTokenAuthenticationOptions - The authentication options for Azure OpenAI On Your Data vector search when using access token.
OnYourDataVectorSearchAPIKeyAuthenticationOptions - The authentication options for Azure OpenAI On Your Data when using an API key.
OnYourDataVectorSearchAuthenticationOptions - The authentication options for Azure OpenAI On Your Data vector search.
PineconeChatExtensionConfiguration - A specific representation of configurable options for Pinecone when using it as an Azure OpenAI chat extension.
PineconeChatExtensionParameters - Parameters for configuring Azure OpenAI Pinecone chat extensions.
PineconeFieldMappingOptions - Optional settings to control how fields are processed when using a configured Pinecone resource.
PredictionContent - Static predicted output content, such as the content of a text file that is being regenerated.
PredictionContentContent contains the content for a [PredictionContent].
SpeechGenerationOptions - A representation of the request options that control the behavior of a text-to-speech operation.
SpeechGenerationResponse - A representation of a response for a text-to-speech operation.
StopFinishDetails - A structured representation of a stop reason that signifies natural termination by the model.
Upload - The Upload object can accept byte chunks in the form of Parts.
UploadFile - The ready File object after the Upload is completed.
UploadFileOptions contains the optional parameters for the Client.UploadFile method.
UploadFileResponse contains the response from method Client.UploadFile.
UploadPart - The upload Part represents a chunk of bytes we can add to an Upload object.
UserSecurityContext - User security context contains several parameters that describe the AI application itself, and the end user that interacts with the AI application.

# Interfaces

AzureChatExtensionConfigurationClassification provides polymorphic access to related types.
ChatCompletionRequestMessageContentPartClassification provides polymorphic access to related types.
ChatCompletionsNamedToolSelectionClassification provides polymorphic access to related types.
ChatCompletionsResponseFormatClassification provides polymorphic access to related types.
ChatCompletionsToolCallClassification provides polymorphic access to related types.
ChatCompletionsToolDefinitionClassification provides polymorphic access to related types.
ChatFinishDetailsClassification provides polymorphic access to related types.
ChatMessageContentItemClassification provides polymorphic access to related types.
ChatRequestMessageClassification provides polymorphic access to related types.
OnYourDataAuthenticationOptionsClassification provides polymorphic access to related types.
OnYourDataVectorizationSourceClassification provides polymorphic access to related types.
OnYourDataVectorSearchAuthenticationOptionsClassification provides polymorphic access to related types.

# Type aliases

AudioTaskLabel - Defines the possible descriptors for available audio operation responses.
AudioTranscriptionFormat - Defines available options for the underlying response format of output transcription information.
AudioTranscriptionTimestampGranularity - Defines the timestamp granularities that can be requested on a verbose transcription response.
AudioTranslationFormat - Defines available options for the underlying response format of output translation information.
AzureChatExtensionRetrieveDocumentFilterReason - The reason for filtering the retrieved document.
AzureChatExtensionType - A representation of configuration data for a single Azure OpenAI chat extension.
AzureSearchQueryType - The type of Azure Search retrieval query that should be executed when using it as an Azure OpenAI chat extension.
BatchStatus - The status of a batch.
ChatCompletionModality - Values to specified the required modality for the model to use.
ChatCompletionRequestMessageContentPartImageURLDetail - Specifies the detail level of the image.
ChatCompletionRequestMessageContentPartType - The type of the content part.
ChatCompletionsToolSelectionPreset - Represents a generic policy for how a chat completions tool may be selected.
ChatMessageImageDetailLevel - A representation of the possible image detail levels for image-based chat completions message content.
ChatRole - A description of the intended purpose of a message within a chat completions interaction.
CompletionsFinishReason - Representation of the manner in which a completions response concluded.
ContentFilterSeverity - Ratings for the intensity and risk level of harmful content.
CreateUploadRequestPurpose - The intended purpose of the uploaded file.
ElasticsearchQueryType - The type of Elasticsearch® retrieval query that should be executed when using it as an Azure OpenAI chat extension.
EmbeddingEncodingFormat - Represents the available formats for embeddings data on responses.
FilePurpose - The possible values denoting the intended usage of a file.
FileState - The state of the file.
FunctionCallPreset - The collection of predefined behaviors for handling request-provided function information in a chat completions operation.
ImageGenerationQuality - The desired image generation quality level to use.
ImageGenerationResponseFormat - The format in which image generation response items should be presented.
ImageGenerationStyle - The desired image generation style to use.
ImageSize - The desired dimensions for generated images.
InputAudioFormat - Values to describe the format of the input audio data.
OnYourDataAuthenticationType - The authentication types supported with Azure OpenAI On Your Data.
OnYourDataContextProperty - The context property.
OnYourDataVectorizationSourceType - Represents the available sources Azure OpenAI On Your Data can use to configure vectorization of data for use with vector search.
OnYourDataVectorSearchAuthenticationType - The authentication types supported with Azure OpenAI On Your Data vector search.
OutputAudioFormat - The output audio format.
ReasoningEffortValue - This option is only valid for o1 models, Constrains effort on reasoning for reasoning models (see https://platform.openai.com/docs/guides/reasoning).
SpeechGenerationResponseFormat - The audio output format for the spoken text.
SpeechVoice - The available voices for text-to-speech.
UploadPurpose - The intended purpose of the file.
UploadStatus - The status of the Upload.