UNPKG

@azure/openai

Version:
461 lines (423 loc) 23 kB
import type { ChatCompletion } from 'openai/resources/index'; import type { ChatCompletionChunk } from 'openai/resources/index'; import type { ChatCompletionCreateParamsNonStreaming } from 'openai/resources/index'; import type { ChatCompletionCreateParamsStreaming } from 'openai/resources/index'; import type { ChatCompletionMessage } from 'openai/resources/index'; import type { Completion } from 'openai/resources/index'; import type { CompletionCreateParamsNonStreaming } from 'openai/resources/index'; import type { CompletionCreateParamsStreaming } from 'openai/resources/index'; import type { ErrorModel } from '@azure-rest/core-client'; /** * 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. */ export declare type AzureChatExtensionConfiguration = AzureChatExtensionConfigurationParent | AzureSearchChatExtensionConfiguration | AzureCosmosDBChatExtensionConfiguration; /** * 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. */ export declare interface AzureChatExtensionConfigurationParent { /** The type label. */ type: string; } /** * 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. */ export declare interface AzureChatExtensionDataSourceResponseCitationOutput { /** The content of the citation. */ content: string; /** The title of the citation. */ title?: string; /** The URL of the citation. */ url?: string; /** The file path of the citation. */ filepath?: string; /** The chunk ID of the citation. */ chunk_id?: string; } /** * 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. */ export declare interface AzureChatExtensionsMessageContextOutput { /** * 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?: Array<AzureChatExtensionDataSourceResponseCitationOutput>; /** The detected intent from the chat history, used to pass to the next turn to carry over the context. */ intent?: string; } /** * A specific representation of configurable options for Azure Cosmos DB when using it as an Azure OpenAI chat * extension. */ export declare interface AzureCosmosDBChatExtensionConfiguration extends AzureChatExtensionConfigurationParent { /** * The type label to use when configuring Azure OpenAI chat extensions. This should typically not be changed from its * default value for Azure Cosmos DB. */ type: "azure_cosmos_db"; /** The parameters to use when configuring Azure OpenAI CosmosDB chat extensions. */ parameters: 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. */ export declare interface AzureCosmosDBChatExtensionParameters { /** * 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: OnYourDataAuthenticationOptions; /** The configured top number of documents to feature for the configured query. */ top_n_documents?: number; /** Whether queries should be restricted to use of indexed data. */ in_scope?: boolean; /** The configured strictness of the search relevance filtering. The higher of strictness, the higher of the precision but lower recall of the answer. */ strictness?: number; /** The MongoDB vCore database name to use with Azure Cosmos DB. */ database_name: string; /** The name of the Azure Cosmos DB resource container. */ container_name: string; /** The MongoDB vCore index name to use with Azure Cosmos DB. */ index_name: string; /** Customized field mapping behavior to use when interacting with the search index. */ fields_mapping: AzureCosmosDBFieldMappingOptions; /** The embedding dependency for vector search. */ embedding_dependency: OnYourDataVectorizationSource; } /** Optional settings to control how fields are processed when using a configured Azure Cosmos DB resource. */ export declare interface AzureCosmosDBFieldMappingOptions { /** The name of the index field to use as a title. */ title_field?: string; /** The name of the index field to use as a URL. */ url_field?: string; /** The name of the index field to use as a filepath. */ filepath_field?: string; /** The names of index fields that should be treated as content. */ content_fields: string[]; /** The separator pattern that content fields should use. */ content_fields_separator?: string; /** The names of fields that represent vector data. */ vector_fields: string[]; } /** * A specific representation of configurable options for Azure Search when using it as an Azure OpenAI chat * extension. */ export declare interface AzureSearchChatExtensionConfiguration extends AzureChatExtensionConfigurationParent { /** * The type label to use when configuring Azure OpenAI chat extensions. This should typically not be changed from its * default value for Azure Cognitive Search. */ type: "azure_search"; /** The parameters to use when configuring Azure Search. */ parameters: AzureSearchChatExtensionParameters; } /** Parameters for Azure Cognitive Search when used as an Azure OpenAI chat extension. The supported authentication types are APIKey, SystemAssignedManagedIdentity and UserAssignedManagedIdentity. */ export declare interface AzureSearchChatExtensionParameters { /** * 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: OnYourDataAuthenticationOptions; /** The configured top number of documents to feature for the configured query. */ top_n_documents?: number; /** Whether queries should be restricted to use of indexed data. */ in_scope?: boolean; /** The configured strictness of the search relevance filtering. The higher of strictness, the higher of the precision but lower recall of the answer. */ strictness?: number; /** The absolute endpoint path for the Azure Cognitive Search resource to use. */ endpoint: string; /** The name of the index to use as available in the referenced Azure Cognitive Search resource. */ index_name: string; /** Customized field mapping behavior to use when interacting with the search index. */ fields_mapping?: AzureSearchIndexFieldMappingOptions; /** * The query type to use with Azure Cognitive Search. * * Possible values: "simple", "semantic", "vector", "vector_simple_hybrid", "vector_semantic_hybrid" */ query_type?: string; /** The additional semantic configuration for the query. */ semantic_configuration?: string; /** Search filter. */ filter?: string; /** The embedding dependency for vector search. */ embedding_dependency?: OnYourDataVectorizationSource; } /** Optional settings to control how fields are processed when using a configured Azure Search resource. */ export declare interface AzureSearchIndexFieldMappingOptions { /** The name of the index field to use as a title. */ title_field?: string; /** The name of the index field to use as a URL. */ url_field?: string; /** The name of the index field to use as a filepath. */ filepath_field?: string; /** The names of index fields that should be treated as content. */ content_fields?: string[]; /** The separator pattern that content fields should use. */ content_fields_separator?: string; /** The names of fields that represent vector data. */ vector_fields?: string[]; } export { ChatCompletion } export { ChatCompletionChunk } export { ChatCompletionCreateParamsNonStreaming } export { ChatCompletionCreateParamsStreaming } export { ChatCompletionMessage } export { Completion } export { CompletionCreateParamsNonStreaming } export { CompletionCreateParamsStreaming } /** Represents the outcome of a detection operation against protected resources as performed by content filtering. */ export declare interface ContentFilterCitedDetectionResultOutput { /** A value indicating whether or not the content has been filtered. */ filtered: boolean; /** A value indicating whether detection occurred, irrespective of severity or whether the content was filtered. */ detected: boolean; /** The internet location associated with the detection. */ URL?: string; /** The license description associated with the detection. */ license?: string; } /** Represents the outcome of a detection operation performed by content filtering. */ export declare interface ContentFilterDetectionResultOutput { /** A value indicating whether or not the content has been filtered. */ filtered: boolean; /** A value indicating whether detection occurred, irrespective of severity or whether the content was filtered. */ detected: boolean; } /** Information about content filtering evaluated against input data to Azure OpenAI. */ export declare interface ContentFilterResultDetailsForPromptOutput { /** * 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?: ContentFilterResultOutput; /** * Describes language related to physical actions intended to hurt, injure, damage, or * kill someone or something; describes weapons, etc. */ violence?: ContentFilterResultOutput; /** * 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?: ContentFilterResultOutput; /** * Describes language related to physical actions intended to purposely hurt, injure, * or damage one’s body, or kill oneself. */ self_harm?: ContentFilterResultOutput; /** Describes whether profanity was detected. */ profanity?: ContentFilterDetectionResultOutput; /** * Describes an error returned if the content filtering system is * down or otherwise unable to complete the operation in time. */ error?: ErrorModel; /** Whether a jailbreak attempt was detected in the prompt. */ jailbreak?: ContentFilterDetectionResultOutput; } /** Information about filtered content severity level and if it has been filtered or not. */ export declare interface ContentFilterResultOutput { /** * Ratings for the intensity and risk level of filtered content. * * Possible values: "safe", "low", "medium", "high" */ severity: string; /** A value indicating whether or not the content has been filtered. */ filtered: boolean; } /** Information about content filtering evaluated against generated model output. */ export declare interface ContentFilterResultsForChoiceOutput { /** * 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?: ContentFilterResultOutput; /** * Describes language related to physical actions intended to hurt, injure, damage, or * kill someone or something; describes weapons, etc. */ violence?: ContentFilterResultOutput; /** * 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?: ContentFilterResultOutput; /** * Describes language related to physical actions intended to purposely hurt, injure, * or damage one’s body, or kill oneself. */ self_harm?: ContentFilterResultOutput; /** Describes whether profanity was detected. */ profanity?: ContentFilterDetectionResultOutput; /** * Describes an error returned if the content filtering system is * down or otherwise unable to complete the operation in time. */ error?: ErrorModel; /** Information about detection of protected text material. */ protected_material_text?: ContentFilterDetectionResultOutput; /** Information about detection of protected code material. */ protected_material_code?: ContentFilterCitedDetectionResultOutput; } /** Content filtering results for a single prompt in the request. */ export declare interface ContentFilterResultsForPromptOutput { /** The index of this prompt in the set of prompt results */ prompt_index: number; /** Content filtering results for this prompt */ content_filter_results: ContentFilterResultDetailsForPromptOutput; } /** Describes the content filtering result for the image generation request. */ export declare interface ImageGenerationContentFilterResults { /** * 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?: ContentFilterResultOutput; /** * Describes language related to physical actions intended to hurt, injure, damage, or * kill someone or something; describes weapons, etc. */ violence?: ContentFilterResultOutput; /** * 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?: ContentFilterResultOutput; /** * Describes language related to physical actions intended to purposely hurt, injure, * or damage one’s body, or kill oneself. */ self_harm?: ContentFilterResultOutput; } /** * Describes the content filtering results for the prompt of a image generation request. */ export declare interface ImageGenerationPromptFilterResults { /** * 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?: ContentFilterResultOutput; /** * Describes language related to physical actions intended to hurt, injure, damage, or * kill someone or something; describes weapons, etc. */ violence?: ContentFilterResultOutput; /** * 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?: ContentFilterResultOutput; /** * Describes language related to physical actions intended to purposely hurt, injure, * or damage one’s body, or kill oneself. */ self_harm?: ContentFilterResultOutput; /** Describes whether profanity was detected. */ profanity?: ContentFilterDetectionResultOutput; /** Whether a jailbreak attempt was detected in the prompt. */ jailbreak?: ContentFilterDetectionResultOutput; } /** The authentication options for Azure OpenAI On Your Data when using an API key. */ export declare interface OnYourDataApiKeyAuthenticationOptions extends OnYourDataAuthenticationOptionsParent { /** The authentication type of API key. */ type: "api_key"; /** The API key to use for authentication. */ key: string; } /** The authentication options for Azure OpenAI On Your Data. */ export declare type OnYourDataAuthenticationOptions = OnYourDataAuthenticationOptionsParent | OnYourDataApiKeyAuthenticationOptions | OnYourDataConnectionStringAuthenticationOptions | OnYourDataSystemAssignedManagedIdentityAuthenticationOptions | OnYourDataUserAssignedManagedIdentityAuthenticationOptions; /** The authentication options for Azure OpenAI On Your Data. */ export declare interface OnYourDataAuthenticationOptionsParent { /** The authentication type. */ type: string; } /** The authentication options for Azure OpenAI On Your Data when using a connection string. */ export declare interface OnYourDataConnectionStringAuthenticationOptions extends OnYourDataAuthenticationOptionsParent { /** The authentication type of connection string. */ type: "connection_string"; /** The connection string to use for authentication. */ connection_string: string; } /** * 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. */ export declare interface OnYourDataDeploymentNameVectorizationSource extends OnYourDataVectorizationSourceParent { /** The type of vectorization source to use. Always 'deployment_name' for this type. */ type: "deployment_name"; /** 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. */ deployment_name: string; } /** * 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. */ export declare interface OnYourDataEndpointVectorizationSource extends OnYourDataVectorizationSourceParent { /** The type of vectorization source to use. Always 'endpoint' for this type. */ type: "endpoint"; /** Specifies the resource endpoint URL from which embeddings should be retrieved. It should be in the format of https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/embeddings. The api-version query parameter is not allowed. */ endpoint: string; /** Specifies the authentication options to use when retrieving embeddings from the specified endpoint. */ authentication: OnYourDataApiKeyAuthenticationOptions; } /** The authentication options for Azure OpenAI On Your Data when using a system-assigned managed identity. */ export declare interface OnYourDataSystemAssignedManagedIdentityAuthenticationOptions extends OnYourDataAuthenticationOptionsParent { /** The authentication type of system-assigned managed identity. */ type: "system_assigned_managed_identity"; } /** The authentication options for Azure OpenAI On Your Data when using a user-assigned managed identity. */ export declare interface OnYourDataUserAssignedManagedIdentityAuthenticationOptions extends OnYourDataAuthenticationOptionsParent { /** The authentication type of user-assigned managed identity. */ type: "user_assigned_managed_identity"; /** The resource ID of the user-assigned managed identity to use for authentication. */ managed_identity_resource_id: string; } /** An abstract representation of a vectorization source for Azure OpenAI On Your Data with vector search. */ export declare type OnYourDataVectorizationSource = OnYourDataVectorizationSourceParent | OnYourDataEndpointVectorizationSource | OnYourDataDeploymentNameVectorizationSource; /** An abstract representation of a vectorization source for Azure OpenAI On Your Data with vector search. */ export declare interface OnYourDataVectorizationSourceParent { /** The authentication type. */ type: string; } export { }