Skip to content

Commit

Permalink
[OpenAI] Add back beta features
Browse files Browse the repository at this point in the history
  • Loading branch information
deyaaeldeen committed Nov 18, 2024
1 parent 28b3e59 commit a7199c2
Show file tree
Hide file tree
Showing 80 changed files with 744 additions and 102 deletions.
2 changes: 1 addition & 1 deletion sdk/openai/openai/MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Migrated code:
```typescript
import { AzureOpenAI } from "openai";
const deployment = "Your Azure OpenAI deployment";
const apiVersion = "2024-10-21";
const apiVersion = "2024-10-01-preview";
const options = { azureADTokenProvider, deployment, apiVersion }
const client = new AzureOpenAI(options);
```
Expand Down
6 changes: 3 additions & 3 deletions sdk/openai/openai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ There are several ways to authenticate with the Azure OpenAI service and the rec
import { AzureOpenAI } from "openai";
const deployment = "Your deployment name";
const apiVersion = "2024-10-21";
const apiVersion = "2024-10-01-preview";
const client = new AzureOpenAI({ azureADTokenProvider, deployment, apiVersion });
```
Expand Down Expand Up @@ -126,7 +126,7 @@ export async function main() {
const scope = "https://cognitiveservices.azure.com/.default";
const azureADTokenProvider = getBearerTokenProvider(new DefaultAzureCredential(), scope);
const deployment = "gpt-4-1106-preview";
const apiVersion = "2024-10-21";
const apiVersion = "2024-10-01-preview";
const client = new AzureOpenAI({ azureADTokenProvider, deployment, apiVersion });
const events = await client.chat.completions.create({
stream: true,
Expand Down Expand Up @@ -182,7 +182,7 @@ async function main() {
const scope = "https://cognitiveservices.azure.com/.default";
const azureADTokenProvider = getBearerTokenProvider(new DefaultAzureCredential(), scope);
const deployment = "gpt-35-turbo";
const apiVersion = "2024-10-21";
const apiVersion = "2024-10-01-preview";
const client = new AzureOpenAI({ azureADTokenProvider, deployment, apiVersion });
const events = await client.chat.completions.create({
messages: [
Expand Down
212 changes: 208 additions & 4 deletions sdk/openai/openai/review/openai-types.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ import type { CompletionCreateParamsStreaming } from 'openai/resources/index';
import type { ErrorModel } from '@azure-rest/core-client';

// @public
export type AzureChatExtensionConfiguration = AzureChatExtensionConfigurationParent | AzureSearchChatExtensionConfiguration | AzureCosmosDBChatExtensionConfiguration;
export type AzureChatExtensionConfiguration = AzureChatExtensionConfigurationParent | AzureSearchChatExtensionConfiguration | AzureCosmosDBChatExtensionConfiguration | ElasticsearchChatExtensionConfiguration | PineconeChatExtensionConfiguration | MongoDBChatExtensionConfiguration;

// @public
export interface AzureChatExtensionConfigurationParent {
type: string;
}

// @public
export interface AzureChatExtensionDataSourceResponseCitation {
chunk_id?: string;
content: string;
filepath?: string;
rerank_score?: number;
title?: string;
url?: string;
}

// @public
export interface AzureChatExtensionDataSourceResponseCitationOutput {
chunk_id?: string;
Expand All @@ -31,8 +41,20 @@ export interface AzureChatExtensionDataSourceResponseCitationOutput {
url?: string;
}

// @public
export interface AzureChatExtensionRetrievedDocument extends AzureChatExtensionDataSourceResponseCitation {
data_source_index: number;
filter_reason?: AzureChatExtensionRetrieveDocumentFilterReason;
original_search_score?: number;
search_queries: string[];
}

// @public
export type AzureChatExtensionRetrieveDocumentFilterReason = "score" | "rerank";

// @public
export interface AzureChatExtensionsMessageContextOutput {
all_retrieved_documents?: Array<AzureChatExtensionRetrievedDocument>;
citations?: Array<AzureChatExtensionDataSourceResponseCitationOutput>;
intent?: string;
}
Expand All @@ -45,13 +67,17 @@ export interface AzureCosmosDBChatExtensionConfiguration extends AzureChatExtens

// @public
export interface AzureCosmosDBChatExtensionParameters {
allow_partial_result?: boolean;
authentication: OnYourDataAuthenticationOptions;
container_name: string;
database_name: string;
embedding_dependency: OnYourDataVectorizationSource;
fields_mapping: AzureCosmosDBFieldMappingOptions;
in_scope?: boolean;
include_contexts?: OnYourDataContextProperty[];
index_name: string;
max_search_queries?: number;
role_information?: string;
strictness?: number;
top_n_documents?: number;
}
Expand All @@ -74,14 +100,18 @@ export interface AzureSearchChatExtensionConfiguration extends AzureChatExtensio

// @public
export interface AzureSearchChatExtensionParameters {
allow_partial_result?: boolean;
authentication: OnYourDataAuthenticationOptions;
embedding_dependency?: OnYourDataVectorizationSource;
endpoint: string;
fields_mapping?: AzureSearchIndexFieldMappingOptions;
filter?: string;
in_scope?: boolean;
include_contexts?: OnYourDataContextProperty[];
index_name: string;
max_search_queries?: number;
query_type?: string;
role_information?: string;
semantic_configuration?: string;
strictness?: number;
top_n_documents?: number;
Expand All @@ -92,6 +122,7 @@ export interface AzureSearchIndexFieldMappingOptions {
content_fields?: string[];
content_fields_separator?: string;
filepath_field?: string;
image_vector_fields?: string[];
title_field?: string;
url_field?: string;
vector_fields?: string[];
Expand All @@ -113,6 +144,12 @@ export { CompletionCreateParamsNonStreaming }

export { CompletionCreateParamsStreaming }

// @public
export interface ContentFilterBlocklistIdResultOutput {
filtered: boolean;
id: string;
}

// @public
export interface ContentFilterCitedDetectionResultOutput {
detected: boolean;
Expand All @@ -121,6 +158,12 @@ export interface ContentFilterCitedDetectionResultOutput {
URL?: string;
}

// @public
export interface ContentFilterDetailedResults {
details: ContentFilterBlocklistIdResultOutput[];
filtered: boolean;
}

// @public
export interface ContentFilterDetectionResultOutput {
detected: boolean;
Expand All @@ -129,8 +172,10 @@ export interface ContentFilterDetectionResultOutput {

// @public
export interface ContentFilterResultDetailsForPromptOutput {
custom_blocklists?: ContentFilterDetailedResults;
error?: ErrorModel;
hate?: ContentFilterResultOutput;
indirect_attack?: ContentFilterDetectionResultOutput;
jailbreak?: ContentFilterDetectionResultOutput;
profanity?: ContentFilterDetectionResultOutput;
self_harm?: ContentFilterResultOutput;
Expand All @@ -146,6 +191,7 @@ export interface ContentFilterResultOutput {

// @public
export interface ContentFilterResultsForChoiceOutput {
custom_blocklists?: ContentFilterDetailedResults;
error?: ErrorModel;
hate?: ContentFilterResultOutput;
profanity?: ContentFilterDetectionResultOutput;
Expand All @@ -162,6 +208,39 @@ export interface ContentFilterResultsForPromptOutput {
prompt_index: number;
}

// @public
export interface ElasticsearchChatExtensionConfiguration extends AzureChatExtensionConfigurationParent {
parameters: ElasticsearchChatExtensionParameters;
type: "elasticsearch";
}

// @public
export interface ElasticsearchChatExtensionParameters {
allow_partial_result?: boolean;
authentication: OnYourDataAuthenticationOptions;
embedding_dependency?: OnYourDataVectorizationSource;
endpoint: string;
fields_mapping?: ElasticsearchIndexFieldMappingOptions;
in_scope?: boolean;
include_contexts?: OnYourDataContextProperty[];
index_name: string;
max_search_queries?: number;
query_type?: string;
role_information?: string;
strictness?: number;
top_n_documents?: number;
}

// @public
export interface ElasticsearchIndexFieldMappingOptions {
content_fields?: string[];
content_fields_separator?: string;
filepath_field?: string;
title_field?: string;
url_field?: string;
vector_fields?: string[];
}

// @public
export interface ImageGenerationContentFilterResults {
hate?: ContentFilterResultOutput;
Expand All @@ -172,6 +251,7 @@ export interface ImageGenerationContentFilterResults {

// @public
export interface ImageGenerationPromptFilterResults {
custom_blocklists?: ContentFilterDetailedResults;
hate?: ContentFilterResultOutput;
jailbreak?: ContentFilterDetectionResultOutput;
profanity?: ContentFilterDetectionResultOutput;
Expand All @@ -180,14 +260,55 @@ export interface ImageGenerationPromptFilterResults {
violence?: ContentFilterResultOutput;
}

// @public
export interface MongoDBChatExtensionConfiguration extends AzureChatExtensionConfigurationParent {
parameters: MongoDBChatExtensionParameters;
type: "mongo_db";
}

// @public
export interface MongoDBChatExtensionParameters {
allow_partial_result?: boolean;
app_name: string;
authentication: OnYourDataUsernameAndPasswordAuthenticationOptions;
collection_name: string;
database_name: string;
embedding_dependency: OnYourDataEndpointVectorizationSource | OnYourDataDeploymentNameVectorizationSource;
endpoint: string;
fields_mapping: MongoDBFieldMappingOptions;
in_scope?: boolean;
include_contexts?: OnYourDataContextProperty[];
index_name: string;
max_search_queries?: number;
role_information?: string;
strictness?: number;
top_n_documents?: number;
}

// @public
export interface MongoDBFieldMappingOptions {
content_fields: string[];
content_fields_separator?: string;
filepath_field?: string;
title_field?: string;
url_field?: string;
vector_fields: string[];
}

// @public
export interface OnYourDataAccessTokenAuthenticationOptions extends OnYourDataAuthenticationOptionsParent {
access_token: string;
type: "access_token";
}

// @public
export interface OnYourDataApiKeyAuthenticationOptions extends OnYourDataAuthenticationOptionsParent {
key: string;
type: "api_key";
}

// @public
export type OnYourDataAuthenticationOptions = OnYourDataAuthenticationOptionsParent | OnYourDataApiKeyAuthenticationOptions | OnYourDataConnectionStringAuthenticationOptions | OnYourDataSystemAssignedManagedIdentityAuthenticationOptions | OnYourDataUserAssignedManagedIdentityAuthenticationOptions;
export type OnYourDataAuthenticationOptions = OnYourDataAuthenticationOptionsParent | OnYourDataApiKeyAuthenticationOptions | OnYourDataConnectionStringAuthenticationOptions | OnYourDataKeyAndKeyIdAuthenticationOptions | OnYourDataEncodedApiKeyAuthenticationOptions | OnYourDataAccessTokenAuthenticationOptions | OnYourDataSystemAssignedManagedIdentityAuthenticationOptions | OnYourDataUserAssignedManagedIdentityAuthenticationOptions;

// @public
export interface OnYourDataAuthenticationOptionsParent {
Expand All @@ -200,19 +321,47 @@ export interface OnYourDataConnectionStringAuthenticationOptions extends OnYourD
type: "connection_string";
}

// @public
export type OnYourDataContextProperty = "citations" | "intent" | "all_retrieved_documents";

// @public
export interface OnYourDataDeploymentNameVectorizationSource extends OnYourDataVectorizationSourceParent {
deployment_name: string;
dimensions?: number;
type: "deployment_name";
}

// @public
export interface OnYourDataEncodedApiKeyAuthenticationOptions extends OnYourDataAuthenticationOptionsParent {
encoded_api_key: string;
type: "encoded_api_key";
}

// @public
export interface OnYourDataEndpointVectorizationSource extends OnYourDataVectorizationSourceParent {
authentication: OnYourDataApiKeyAuthenticationOptions;
authentication: OnYourDataVectorSearchAuthenticationOptions;
endpoint: string;
type: "endpoint";
}

// @public
export interface OnYourDataIntegratedVectorizationSource extends OnYourDataVectorizationSourceParent {
type: "integrated";
}

// @public
export interface OnYourDataKeyAndKeyIdAuthenticationOptions extends OnYourDataAuthenticationOptionsParent {
key: string;
key_id: string;
type: "key_and_key_id";
}

// @public
export interface OnYourDataModelIdVectorizationSource extends OnYourDataVectorizationSourceParent {
model_id: string;
type: "model_id";
}

// @public
export interface OnYourDataSystemAssignedManagedIdentityAuthenticationOptions extends OnYourDataAuthenticationOptionsParent {
type: "system_assigned_managed_identity";
Expand All @@ -225,13 +374,68 @@ export interface OnYourDataUserAssignedManagedIdentityAuthenticationOptions exte
}

// @public
export type OnYourDataVectorizationSource = OnYourDataVectorizationSourceParent | OnYourDataEndpointVectorizationSource | OnYourDataDeploymentNameVectorizationSource;
export interface OnYourDataUsernameAndPasswordAuthenticationOptions extends OnYourDataAuthenticationOptionsParent {
password: string;
type: "username_and_password";
username: string;
}

// @public
export type OnYourDataVectorizationSource = OnYourDataVectorizationSourceParent | OnYourDataEndpointVectorizationSource | OnYourDataDeploymentNameVectorizationSource | OnYourDataModelIdVectorizationSource | OnYourDataIntegratedVectorizationSource;

// @public
export interface OnYourDataVectorizationSourceParent {
type: string;
}

// @public
export interface OnYourDataVectorSearchAccessTokenAuthenticationOptions extends OnYourDataVectorSearchAuthenticationOptions {
access_token: string;
type: "access_token";
}

// @public
export interface OnYourDataVectorSearchApiKeyAuthenticationOptions extends OnYourDataVectorSearchAuthenticationOptions {
key: string;
type: "api_key";
}

// @public
export interface OnYourDataVectorSearchAuthenticationOptions {
type: string;
}

// @public
export interface PineconeChatExtensionConfiguration extends AzureChatExtensionConfigurationParent {
parameters: PineconeChatExtensionParameters;
type: "pinecone";
}

// @public
export interface PineconeChatExtensionParameters {
allow_partial_result?: boolean;
authentication: OnYourDataAuthenticationOptions;
embedding_dependency: OnYourDataVectorizationSource;
environment: string;
fields_mapping: PineconeFieldMappingOptions;
in_scope?: boolean;
include_contexts?: OnYourDataContextProperty[];
index_name: string;
max_search_queries?: number;
role_information?: string;
strictness?: number;
top_n_documents?: number;
}

// @public
export interface PineconeFieldMappingOptions {
content_fields: string[];
content_fields_separator?: string;
filepath_field?: string;
title_field?: string;
url_field?: string;
}

// (No @packageDocumentation comment for this package)

```
Loading

0 comments on commit a7199c2

Please sign in to comment.