Skip to content

Commit

Permalink
Minor Fixes of TypeSpec for AOAI On Your Data 2023-12-01-preview /ext…
Browse files Browse the repository at this point in the history
…ensions/chat/completions (#27271)

* auth

* restore

* vector db

* fix examples

* fix

* matrix

* fix cosmosdb

* fix pinecone description

* generated

---------

Co-authored-by: Yuantao Wang <[email protected]>
  • Loading branch information
2 people authored and arifibrahim4 committed Feb 26, 2024
1 parent d269787 commit 7276d96
Show file tree
Hide file tree
Showing 27 changed files with 273 additions and 131 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
"deploymentId": "<deployment-id>",
"body": {
"messages": [
{
"role": "system",
"content": "you are a helpful assistant that talks like a pirate"
},
{
"role": "user",
"content": "can you tell me how to care for a parrot?"
Expand All @@ -20,7 +16,7 @@
{
"type": "AzureCognitiveSearch",
"parameters": {
"endpoint": "{search endpoint}",
"endpoint": "https://your-search-endpoint.search.windows.net/",
"key": "{search admin key}",
"indexName": "{index name}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
"deploymentId": "<deployment-id>",
"body": {
"messages": [
{
"role": "system",
"content": "you are a helpful assistant that talks like a pirate"
},
{
"role": "user",
"content": "can you tell me how to care for a parrot?"
Expand All @@ -20,7 +16,7 @@
{
"type": "AzureCognitiveSearch",
"parameters": {
"endpoint": "{search endpoint}",
"endpoint": "https://your-search-endpoint.search.windows.net/",
"key": "{search admin key}",
"indexName": "{index name}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
"deploymentId": "<deployment-id>",
"body": {
"messages": [
{
"role": "system",
"content": "you are a helpful assistant that talks like a pirate"
},
{
"role": "user",
"content": "can you tell me how to care for a parrot?"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
"deploymentId": "<deployment-id>",
"body": {
"messages": [
{
"role": "system",
"content": "you are a helpful assistant that talks like a pirate"
},
{
"role": "user",
"content": "can you tell me how to care for a parrot?"
Expand All @@ -20,7 +16,7 @@
{
"type": "AzureCognitiveSearch",
"parameters": {
"endpoint": "{search endpoint}",
"endpoint": "https://your-search-endpoint.search.windows.net/",
"authentication": {
"type": "UserAssignedManagedIdentity",
"managedIdentityResourceId": "/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resource-name}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
"deploymentId": "<deployment-id>",
"body": {
"messages": [
{
"role": "system",
"content": "you are a helpful assistant that talks like a pirate"
},
{
"role": "user",
"content": "can you tell me how to care for a parrot?"
Expand All @@ -20,7 +16,7 @@
{
"type": "AzureCognitiveSearch",
"parameters": {
"endpoint": "{search endpoint}",
"endpoint": "https://your-search-endpoint.search.windows.net/",
"indexName": "{index name}",
"queryType": "vector",
"fieldsMapping": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
"deploymentId": "<deployment-id>",
"body": {
"messages": [
{
"role": "system",
"content": "you are a helpful assistant that talks like a pirate"
},
{
"role": "user",
"content": "can you tell me how to care for a parrot?"
Expand All @@ -20,7 +16,7 @@
{
"type": "AzureCognitiveSearch",
"parameters": {
"endpoint": "{search endpoint}",
"endpoint": "https://your-search-endpoint.search.windows.net/",
"indexName": "{index name}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
"deploymentId": "<deployment-id>",
"body": {
"messages": [
{
"role": "system",
"content": "you are a helpful assistant that talks like a pirate"
},
{
"role": "user",
"content": "can you tell me how to care for a parrot?"
Expand All @@ -32,6 +28,9 @@
"deploymentName": "{embedding deployment name}"
},
"fieldsMapping": {
"contentFields": [
"content"
],
"vectorFields": [
"contentvector"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
"deploymentId": "<deployment-id>",
"body": {
"messages": [
{
"role": "system",
"content": "you are a helpful assistant that talks like a pirate"
},
{
"role": "user",
"content": "can you tell me how to care for a parrot?"
Expand All @@ -20,7 +16,7 @@
{
"type": "Elasticsearch",
"parameters": {
"endpoint": "{search endpoint}",
"endpoint": "https://your-elasticsearch-endpoint.eastus.azurecontainer.io",
"indexName": "{index name}",
"authentication": {
"type": "KeyAndKeyId",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
"deploymentId": "<deployment-id>",
"body": {
"messages": [
{
"role": "system",
"content": "you are a helpful assistant that talks like a pirate"
},
{
"role": "user",
"content": "can you tell me how to care for a parrot?"
Expand All @@ -22,7 +18,7 @@
"parameters": {
"authentication": {
"type": "APIKey",
"apiKey": "{api key}"
"key": "{api key}"
},
"environment": "{environment name}",
"indexName": "{index name}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ enum OnYourDataAuthenticationType {
@doc("Authentication via key and key ID pair.")
keyAndKeyId: "KeyAndKeyId",

@doc("Authentication via encoded API key.")
encodedApiKey: "EncodedAPIKey",

@doc("Authentication via access token.")
accessToken: "AccessToken",

@doc("Authentication via system-assigned managed identity.")
systemAssignedManagedIdentity: "SystemAssignedManagedIdentity",

Expand Down Expand Up @@ -75,6 +81,32 @@ model OnYourDataKeyAndKeyIdAuthenticationOptions
keyId: string;
}

@doc("""
The authentication options for Azure OpenAI On Your Data when using an Elasticsearch encoded API key.
""")
@added(ServiceApiVersions.v2023_08_01_Preview)
model OnYourDataEncodedApiKeyAuthenticationOptions
extends OnYourDataAuthenticationOptions {
@doc("The authentication type of Elasticsearch encoded API Key.")
type: OnYourDataAuthenticationType.encodedApiKey;

@doc("The encoded API key to use for authentication.")
encodedApiKey: string;
}

@doc("""
The authentication options for Azure OpenAI On Your Data when using access token.
""")
@added(ServiceApiVersions.v2023_08_01_Preview)
model OnYourDataAccessTokenAuthenticationOptions
extends OnYourDataAuthenticationOptions {
@doc("The authentication type of access token.")
type: OnYourDataAuthenticationType.accessToken;

@doc("The access token to use for authentication.")
accessToken: string;
}

@doc("""
The authentication options for Azure OpenAI On Your Data when using a system-assigned managed identity.
""")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ model AzureCognitiveSearchChatExtensionConfiguration
}

@added(ServiceApiVersions.v2023_08_01_Preview)
@doc("Parameters for Azure Cognitive Search when used as an Azure OpenAI chat extension.")
@doc("Parameters for Azure Cognitive Search when used as an Azure OpenAI chat extension. The supported authentication types are APIKey, SystemAssignedManagedIdentity and UserAssignedManagedIdentity.")
model AzureCognitiveSearchChatExtensionParameters {
...OnYourDataCommonChatExtensionConfiguration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ using TypeSpec.Versioning;
#suppress "@azure-tools/typespec-azure-core/casing-style" "this represents the case-sensitive wire format"
@added(ServiceApiVersions.v2023_12_01_Preview)
@doc("""
A specific representation of configurable options for Elasticsearch when using it as an Azure OpenAI chat
A specific representation of configurable options for Azure Cosmos DB when using it as an Azure OpenAI chat
extension.
""")
model AzureCosmosDBChatExtensionConfiguration
Expand All @@ -29,7 +29,7 @@ model AzureCosmosDBChatExtensionConfiguration
@added(ServiceApiVersions.v2023_12_01_Preview)
@doc("""
Parameters to use when configuring Azure OpenAI On Your Data chat extensions when using Azure Cosmos DB for
MongoDB vCore.
MongoDB vCore. The supported authentication type is ConnectionString.
""")
model AzureCosmosDBChatExtensionParameters {
...OnYourDataCommonChatExtensionConfiguration;
Expand All @@ -51,13 +51,33 @@ model AzureCosmosDBChatExtensionParameters {
fieldsMapping: AzureCosmosDBFieldMappingOptions;

@doc("The embedding dependency for vector search.")
embeddingDependency?: OnYourDataVectorizationSource;
embeddingDependency: OnYourDataVectorizationSource;
}

#suppress "@azure-tools/typespec-azure-core/casing-style" "this represents the case-sensitive wire format"
@doc("Optional settings to control how fields are processed when using a configured Azure Cosmos DB resource.")
@added(ServiceApiVersions.v2023_12_01_Preview)
model AzureCosmosDBFieldMappingOptions {
@doc("The name of the index field to use as a title.")
@projectedName("csharp", "TitleFieldName")
titleField?: string;

@doc("The name of the index field to use as a URL.")
@projectedName("csharp", "UrlFieldName")
urlField?: string;

@doc("The name of the index field to use as a filepath.")
@projectedName("csharp", "FilepathFieldName")
filepathField?: string;

@doc("The names of index fields that should be treated as content.")
@projectedName("csharp", "ContentFieldNames")
contentFields: string[];

@doc("The separator pattern that content fields should use.")
@projectedName("csharp", "ContentFieldSeparator")
contentFieldsSeparator?: string;

@doc("The names of fields that represent vector data.")
@projectedName("csharp", "VectorFieldNames")
vectorFields: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ model AzureMachineLearningIndexChatExtensionConfiguration
}

@added(ServiceApiVersions.v2023_12_01_Preview)
@doc("Parameters for the Azure Machine Learning vector index chat extension.")
@doc("Parameters for the Azure Machine Learning vector index chat extension. The supported authentication types are AccessToken, SystemAssignedManagedIdentity and UserAssignedManagedIdentity.")
model AzureMachineLearningIndexChatExtensionParameters {
...OnYourDataCommonChatExtensionConfiguration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ model ElasticsearchChatExtensionConfiguration
}

@added(ServiceApiVersions.v2023_12_01_Preview)
@doc("Parameters to use when configuring Elasticsearch® as an Azure OpenAI chat extension.")
@doc("Parameters to use when configuring Elasticsearch® as an Azure OpenAI chat extension. The supported authentication types are KeyAndKeyId and EncodedAPIKey.")
model ElasticsearchChatExtensionParameters {
...OnYourDataCommonChatExtensionConfiguration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ using TypeSpec.Versioning;
#suppress "@azure-tools/typespec-azure-core/casing-style" "this represents the case-sensitive wire format"
@added(ServiceApiVersions.v2023_12_01_Preview)
@doc("""
A specific representation of configurable options for Elasticsearch when using it as an Azure OpenAI chat
A specific representation of configurable options for Pinecone when using it as an Azure OpenAI chat
extension.
""")
model PineconeChatExtensionConfiguration
Expand All @@ -26,7 +26,7 @@ model PineconeChatExtensionConfiguration
}

@added(ServiceApiVersions.v2023_12_01_Preview)
@doc("Parameters for configuring Azure OpenAI Pinecone chat extensions.")
@doc("Parameters for configuring Azure OpenAI Pinecone chat extensions. The supported authentication type is APIKey.")
model PineconeChatExtensionParameters {
...OnYourDataCommonChatExtensionConfiguration;

Expand All @@ -42,7 +42,7 @@ model PineconeChatExtensionParameters {
fieldsMapping: PineconeFieldMappingOptions;

@doc("The embedding dependency for vector search.")
embeddingDependency?: OnYourDataVectorizationSource;
embeddingDependency: OnYourDataVectorizationSource;
}

@doc("Optional settings to control how fields are processed when using a configured Pinecone resource.")
Expand All @@ -62,18 +62,9 @@ model PineconeFieldMappingOptions {

@doc("The names of index fields that should be treated as content.")
@projectedName("csharp", "ContentFieldNames")
contentFields?: string[];
contentFields: string[];

@doc("The separator pattern that content fields should use.")
@projectedName("csharp", "ContentFieldSeparator")
contentFieldsSeparator?: string;

@doc("The names of fields that represent vector data.")
@projectedName("csharp", "VectorFieldNames")
vectorFields?: string[];

@added(ServiceApiVersions.v2023_12_01_Preview)
@doc("The names of fields that represent image vector data.")
@projectedName("csharp", "ImageVectorFieldNames")
imageVectorFields?: string[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
"deploymentId": "<deployment-id>",
"body": {
"messages": [
{
"role": "system",
"content": "you are a helpful assistant that talks like a pirate"
},
{
"role": "user",
"content": "can you tell me how to care for a parrot?"
Expand All @@ -20,7 +16,7 @@
{
"type": "AzureCognitiveSearch",
"parameters": {
"endpoint": "{search endpoint}",
"endpoint": "https://your-search-endpoint.search.windows.net/",
"key": "{search admin key}",
"indexName": "{index name}"
}
Expand Down
Loading

0 comments on commit 7276d96

Please sign in to comment.