azopenai

package module
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 18 Imported by: 15

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 opencode@microsoft.com with any additional questions or comments.

Documentation

Overview

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.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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
}

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
}

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 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, *AzureMachineLearningIndexChatExtensionConfiguration, - *AzureSearchChatExtensionConfiguration, *ElasticsearchChatExtensionConfiguration, *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 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

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 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"
	// AzureChatExtensionTypeAzureMachineLearningIndex - Represents the use of Azure Machine Learning index as an Azure OpenAI
	// chat extension.
	AzureChatExtensionTypeAzureMachineLearningIndex AzureChatExtensionType = "azure_ml_index"
	// 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"
	// 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 {
	// 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

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

	// 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

	// Give the model instructions about how it should behave and any context it should reference when generating a response.
	// You can describe the assistant's personality and tell it how to format responses.
	// There's a 100 token limit for it, and it counts against the overall token limit.
	RoleInformation *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
}

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

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 AzureMachineLearningIndexChatExtensionConfiguration added in v0.4.0

type AzureMachineLearningIndexChatExtensionConfiguration struct {

	// REQUIRED; The parameters for the Azure Machine Learning vector index chat extension.
	Parameters *AzureMachineLearningIndexChatExtensionParameters
	// contains filtered or unexported fields
}

AzureMachineLearningIndexChatExtensionConfiguration - A specific representation of configurable options for Azure Machine Learning vector index when using it as an Azure OpenAI chat extension.

func (*AzureMachineLearningIndexChatExtensionConfiguration) GetAzureChatExtensionConfiguration added in v0.4.0

GetAzureChatExtensionConfiguration implements the AzureChatExtensionConfigurationClassification interface for type AzureMachineLearningIndexChatExtensionConfiguration.

func (AzureMachineLearningIndexChatExtensionConfiguration) MarshalJSON added in v0.4.0

MarshalJSON implements the json.Marshaller interface for type AzureMachineLearningIndexChatExtensionConfiguration.

func (*AzureMachineLearningIndexChatExtensionConfiguration) UnmarshalJSON added in v0.4.0

UnmarshalJSON implements the json.Unmarshaller interface for type AzureMachineLearningIndexChatExtensionConfiguration.

type AzureMachineLearningIndexChatExtensionParameters added in v0.4.0

type AzureMachineLearningIndexChatExtensionParameters struct {
	// REQUIRED; The Azure Machine Learning vector index name.
	Name *string

	// REQUIRED; The resource ID of the Azure Machine Learning project.
	ProjectResourceID *string

	// REQUIRED; The version of the Azure Machine Learning vector index.
	Version *string

	// 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

	// Search filter. Only supported if the Azure Machine Learning vector index is of type AzureSearch.
	Filter *string

	// Whether queries should be restricted to use of indexed data.
	InScope *bool

	// Give the model instructions about how it should behave and any context it should reference when generating a response.
	// You can describe the assistant's personality and tell it how to format responses.
	// There's a 100 token limit for it, and it counts against the overall token limit.
	RoleInformation *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
}

AzureMachineLearningIndexChatExtensionParameters - Parameters for the Azure Machine Learning vector index chat extension. The supported authentication types are AccessToken, SystemAssignedManagedIdentity and UserAssignedManagedIdentity.

func (AzureMachineLearningIndexChatExtensionParameters) MarshalJSON added in v0.4.0

MarshalJSON implements the json.Marshaller interface for type AzureMachineLearningIndexChatExtensionParameters.

func (*AzureMachineLearningIndexChatExtensionParameters) UnmarshalJSON added in v0.4.0

UnmarshalJSON implements the json.Unmarshaller interface for type AzureMachineLearningIndexChatExtensionParameters.

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

	// 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 query type to use with Azure Cognitive Search.
	QueryType *AzureSearchQueryType

	// Give the model instructions about how it should behave and any context it should reference when generating a response.
	// You can describe the assistant's personality and tell it how to format responses.
	// There's a 100 token limit for it, and it counts against the overall token limit.
	RoleInformation *string

	// 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 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 reason the model stopped generating tokens, together with any applicable details. This structured representation replaces
	// 'finish_reason' for some models.
	FinishDetails ChatFinishDetailsClassification

	// 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
}

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
}

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

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

MarshalJSON implements the json.Marshaller interface for type ChatCompletionRequestMessageContentPartImageURL.

func (*ChatCompletionRequestMessageContentPartImageURL) UnmarshalJSON added in v0.4.0

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

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 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 *FunctionDefinition

	// 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 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 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

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

	// 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 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

	// 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.

func (ChatCompletionsOptions) MarshalJSON

func (c ChatCompletionsOptions) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ChatCompletionsOptions.

func (*ChatCompletionsOptions) UnmarshalJSON

func (c *ChatCompletionsOptions) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ChatCompletionsOptions.

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, *ChatCompletionsResponseFormat, *ChatCompletionsTextResponseFormat

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"
)

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, *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 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 *string

	// 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 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 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 *string

	// 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 ChatRequestToolMessage added in v0.4.0

type ChatRequestToolMessage struct {
	// REQUIRED; The content of the message.
	Content *string

	// 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 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

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 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

func (c Choice) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Choice.

func (*Choice) UnmarshalJSON

func (c *Choice) UnmarshalJSON(data []byte) error

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.Fatalf("ERROR: %s", err)
	}

	// 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.Fatalf("ERROR: %s", err)
	}

	_ = 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.Fatalf("ERROR: %s", err)
	}

	_ = 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.Fatalf("ERROR: %s", err)
	}

	_ = client
}
Output:

func (*Client) GenerateSpeechFromText added in v0.5.0

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-03-01-preview

  • 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.Fatalf("ERROR: %s", err)
	}

	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.Fatalf("ERROR: %s", err)
	}

	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.Fatalf("ERROR: %s", err)
	}

	fmt.Fprintf(os.Stderr, "Got %d bytes of FLAC audio\n", len(audioBytes))

}
Output:

func (*Client) GetAudioTranscription added in v0.3.0

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_API_KEY_WHISPER")

	// Ex: "https://<your-azure-openai-host>.openai.azure.com"
	azureOpenAIEndpoint := os.Getenv("AOAI_ENDPOINT_WHISPER")

	modelDeploymentID := os.Getenv("AOAI_MODEL_WHISPER")

	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.Fatalf("ERROR: %s", err)
	}

	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.Fatalf("ERROR: %s", err)
	}

	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.Fatalf("ERROR: %s", err)
	}

	fmt.Fprintf(os.Stderr, "Transcribed text: %s\n", *resp.Text)

}
Output:

func (*Client) GetAudioTranslation added in v0.3.0

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) 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.

Generated from API version 2024-03-01-preview

  • 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"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
)

func main() {
	azureOpenAIKey := os.Getenv("AOAI_API_KEY")
	modelDeploymentID := os.Getenv("AOAI_CHAT_COMPLETIONS_MODEL")

	// Ex: "https://<your-azure-openai-host>.openai.azure.com"
	azureOpenAIEndpoint := os.Getenv("AOAI_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.Fatalf("ERROR: %s", err)
	}

	// 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: to.Ptr("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: to.Ptr("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.Fatalf("ERROR: %s", err)
	}

	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.Fatalf("ERROR: %s", err)
	}

	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.Fatalf("ERROR: %s", err)
	}

	// 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_API_KEY")
	modelDeploymentID := os.Getenv("AOAI_CHAT_COMPLETIONS_MODEL")

	// Ex: "https://<your-azure-openai-host>.openai.azure.com"
	azureOpenAIEndpoint := os.Getenv("AOAI_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.Fatalf("ERROR: %s", err)
	}

	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: &azopenai.FunctionDefinition{
					Name:        to.Ptr("get_current_weather"),
					Description: to.Ptr("Get the current weather in a given location"),
					Parameters: 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"},
							},
						},
					},
				},
			},
		},
		Temperature: to.Ptr[float32](0.0),
	}, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	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.Fatalf("ERROR: %s", err)
	}

	// 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_API_KEY")
	modelDeploymentID := os.Getenv("AOAI_CHAT_COMPLETIONS_MODEL_LEGACY_FUNCTIONS")

	// Ex: "https://<your-azure-openai-host>.openai.azure.com"
	azureOpenAIEndpoint := os.Getenv("AOAI_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.Fatalf("ERROR: %s", err)
	}

	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: 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"},
						},
					},
				},
			},
		},
		Temperature: to.Ptr[float32](0.0),
	}, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	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.Fatalf("ERROR: %s", err)
	}

	// Prints:
	// Parameters: azopenai_test.location{Location:"Boston, MA", Unit:"celsius"}
	fmt.Fprintf(os.Stderr, "Parameters: %#v\n", *funcParams)

}
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.Fatalf("ERROR: %s", err)
	}

	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.Fatalf("ERROR: %s", err)
	}

	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

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_API_KEY")
	modelDeploymentID := os.Getenv("AOAI_CHAT_COMPLETIONS_MODEL")

	// Ex: "https://<your-azure-openai-host>.openai.azure.com"
	azureOpenAIEndpoint := os.Getenv("AOAI_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.Fatalf("ERROR: %s", err)
	}

	// 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: to.Ptr("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: to.Ptr("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.ChatCompletionsOptions{
		// 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.Fatalf("ERROR: %s", err)
	}

	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.Fatalf("ERROR: %s", err)
		}

		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.

Generated from API version 2024-03-01-preview

  • 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_API_KEY")
	modelDeployment := os.Getenv("AOAI_COMPLETIONS_MODEL")

	// Ex: "https://<your-azure-openai-host>.openai.azure.com"
	azureOpenAIEndpoint := os.Getenv("AOAI_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.Fatalf("ERROR: %s", err)
	}

	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.Fatalf("ERROR: %s", err)
	}

	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 CompletionsOptions, 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_API_KEY")
	modelDeploymentID := os.Getenv("AOAI_COMPLETIONS_MODEL")

	// Ex: "https://<your-azure-openai-host>.openai.azure.com"
	azureOpenAIEndpoint := os.Getenv("AOAI_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.Fatalf("ERROR: %s", err)
	}

	resp, err := client.GetCompletionsStream(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: &modelDeploymentID,
	}, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	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.Fatalf("ERROR: %s", err)
		}

		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-03-01-preview

  • 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_API_KEY")
	modelDeploymentID := os.Getenv("AOAI_EMBEDDINGS_MODEL")

	// Ex: "https://<your-azure-openai-host>.openai.azure.com"
	azureOpenAIEndpoint := os.Getenv("AOAI_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.Fatalf("ERROR: %s", err)
	}

	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.Fatalf("ERROR: %s", err)
	}

	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) 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-03-01-preview

  • 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.Fatalf("ERROR: %s", err)
	}

	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.Fatalf("ERROR: %s", err)
	}

	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.Fatalf("ERROR: %s", err)
		}

		fmt.Fprintf(os.Stderr, "Image generated, HEAD request on URL returned %d\n", resp.StatusCode)
	}

}
Output:

type ClientOptions

type ClientOptions struct {
	azcore.ClientOptions
}

ClientOptions contains optional settings for Client.

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
}

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

	// 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.

func (CompletionsOptions) MarshalJSON

func (c CompletionsOptions) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CompletionsOptions.

func (*CompletionsOptions) UnmarshalJSON

func (c *CompletionsOptions) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CompletionsOptions.

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
}

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 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

	// REQUIRED; 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 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 []ContentFilterBlocklistIDResult

	// 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 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 {
	// Describes detection results against configured custom blocklists.
	CustomBlocklists []ContentFilterBlocklistIDResult

	// 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 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

	// 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 query type of Elasticsearch®.
	QueryType *ElasticsearchQueryType

	// Give the model instructions about how it should behave and any context it should reference when generating a response.
	// You can describe the assistant's personality and tell it how to format responses.
	// There's a 100 token limit for it, and it counts against the overall token limit.
	RoleInformation *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
}

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
}

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

func (e *Error) Error() string

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

func (e Error) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Error.

func (*Error) UnmarshalJSON added in v0.3.0

func (e *Error) UnmarshalJSON(data []byte) error

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 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 any
}

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 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 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 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 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 {
	// 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 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 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

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

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"
)

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

GetOnYourDataAuthenticationOptions implements the OnYourDataAuthenticationOptionsClassification interface for type OnYourDataConnectionStringAuthenticationOptions.

func (OnYourDataConnectionStringAuthenticationOptions) MarshalJSON added in v0.4.0

MarshalJSON implements the json.Marshaller interface for type OnYourDataConnectionStringAuthenticationOptions.

func (*OnYourDataConnectionStringAuthenticationOptions) UnmarshalJSON added in v0.4.0

UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataConnectionStringAuthenticationOptions.

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
}

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

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

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 OnYourDataAuthenticationOptionsClassification

	// 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 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

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

GetOnYourDataAuthenticationOptions implements the OnYourDataAuthenticationOptionsClassification interface for type OnYourDataSystemAssignedManagedIdentityAuthenticationOptions.

func (OnYourDataSystemAssignedManagedIdentityAuthenticationOptions) MarshalJSON added in v0.4.0

MarshalJSON implements the json.Marshaller interface for type OnYourDataSystemAssignedManagedIdentityAuthenticationOptions.

func (*OnYourDataSystemAssignedManagedIdentityAuthenticationOptions) UnmarshalJSON added in v0.4.0

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

GetOnYourDataAuthenticationOptions implements the OnYourDataAuthenticationOptionsClassification interface for type OnYourDataUserAssignedManagedIdentityAuthenticationOptions.

func (OnYourDataUserAssignedManagedIdentityAuthenticationOptions) MarshalJSON added in v0.4.0

MarshalJSON implements the json.Marshaller interface for type OnYourDataUserAssignedManagedIdentityAuthenticationOptions.

func (*OnYourDataUserAssignedManagedIdentityAuthenticationOptions) UnmarshalJSON added in v0.4.0

UnmarshalJSON implements the json.Unmarshaller interface for type OnYourDataUserAssignedManagedIdentityAuthenticationOptions.

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, *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"
	// 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

	// 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

	// Give the model instructions about how it should behave and any context it should reference when generating a response.
	// You can describe the assistant's personality and tell it how to format responses.
	// There's a 100 token limit for it, and it counts against the overall token limit.
	RoleInformation *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
}

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"
)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL