in demo-dotnet/DotNetVectorDemo/Program.cs [36:77]
static async Task Main(bool setupIndex, string query = null, string filter = null, int k = 50, int top = 3, bool exhaustive = false, bool textOnly = false, bool hybrid = false, bool semantic = false, string debug = "disabled")
{
var configuration = new Configuration();
new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddEnvironmentVariables()
.AddJsonFile("local.settings.json")
.Build()
.Bind(configuration);
if (textOnly && hybrid)
{
throw new ArgumentException("Cannot specify textOnly with hybrid", nameof(textOnly));
}
if (exhaustive && textOnly)
{
throw new ArgumentException("Cannot specify exhaustive with textOnly", nameof(exhaustive));
}
if (debug != "disabled" && debug != "semantic" && debug != "vector")
{
throw new ArgumentException("Debug must be disabled (default), semantic, or vector");
}
configuration.Validate();
var defaultCredential = new DefaultAzureCredential();
var azureOpenAIClient = InitializeOpenAIClient(configuration, defaultCredential);
var indexClient = InitializeSearchIndexClient(configuration, defaultCredential);
var searchClient = indexClient.GetSearchClient(configuration.IndexName);
if (setupIndex)
{
await SetupIndexAsync(configuration, indexClient);
await UploadSampleDocumentsAsync(configuration, searchClient, SampleVectorDocumentsPath);
}
if (!string.IsNullOrEmpty(query))
{
await Search(searchClient, query, k, top, filter, exhaustive, textOnly, hybrid, semantic, debug);
}
}