Skip to content

Commit

Permalink
chat with my data using beta7 and AzureCognitiveSearchChatExtensionCo…
Browse files Browse the repository at this point in the history
…nfiguration
  • Loading branch information
robch committed Aug 26, 2023
1 parent cdc0f36 commit 94b184a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ limitations under the License.

---------------------------------------------------------

Azure.AI.OpenAI 1.0.0-beta.6 - MIT
Azure.AI.OpenAI 1.0.0-beta.7 - MIT


(c) Microsoft Corporation
Expand Down
2 changes: 1 addition & 1 deletion src/ai/.x/help/chat
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ EXAMPLES

ai config @myindex --set MyIndex
ai search index create --name @myindex --files *.txt --interactive
ai chat --index @myindex --interactive
ai chat --search-index @myindex --interactive

SEE ALSO

Expand Down
2 changes: 1 addition & 1 deletion src/ai/BuildCommon.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<PropertyGroup>
<CLIAssemblyVersion>1.0.0</CLIAssemblyVersion>
<DefaultPublicOAISDKVersion>1.0.0-beta.6</DefaultPublicOAISDKVersion>
<DefaultPublicOAISDKVersion>1.0.0-beta.7</DefaultPublicOAISDKVersion>
<OAISDKVersion Condition="'$(OAISDKVersion)' == ''">$(DefaultPublicOAISDKVersion)</OAISDKVersion>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
</PropertyGroup>
Expand Down
13 changes: 13 additions & 0 deletions src/ai/commands/chat_command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,19 @@ private ChatCompletionsOptions CreateChatCompletionOptions()
stops.ForEach(s => options.StopSequences.Add(s));
}

var searchKey = _values["service.config.search.api.key"];
var searchEndpoint = _values["service.config.search.endpoint.uri"];
var indexName = _values["service.config.search.index.name"];
var searchExtensionOk = !string.IsNullOrEmpty(searchKey) && !string.IsNullOrEmpty(searchEndpoint) && !string.IsNullOrEmpty(indexName);
if (searchExtensionOk)
{
var acsOptions = new AzureCognitiveSearchChatExtensionConfiguration(AzureChatExtensionType.AzureCognitiveSearch, new Uri(searchEndpoint), new AzureKeyCredential(searchKey), indexName);
var extensionOptions = new AzureChatExtensionsOptions();
extensionOptions.Extensions.Add(acsOptions);

options.AzureExtensionsOptions = extensionOptions;
}

return options;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ai/commands/parsers/chat_command_parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public static bool ParseCommandValues(INamedValueTokens tokens, ICommandValues v
new NamedValueTokenParser("--deployment", "service.config.deployment", "001", "1"),

new NamedValueTokenParser(null, "service.config.embeddings.deployment", "0010", "1"),
new NamedValueTokenParser(null, "service.config.embeddings.index.name", "00010", "1"),

new NamedValueTokenParser(null, "service.config.search.api.key", "00101", "1"),
new NamedValueTokenParser(null, "service.config.search.endpoint.uri", "00110;00101", "1"),
new NamedValueTokenParser(null, "service.config.search.index.name", "00010", "1"),

new NamedValueTokenParser("--interactive", "chat.input.interactive", "001", "0", null, null, "true"),

Expand Down

0 comments on commit 94b184a

Please sign in to comment.