Add HTTP client config, update settings, and add package

- Added HTTP client defaults configuration in Program.cs.
- Adjusted OpenAPI configuration order in Program.cs.
- Changed MaxTokensPerParagraph in AppSettings.cs to 1000.
- Added Microsoft.Extensions.Http.Resilience package in SqlDatabaseVectorSearch.csproj.
- Reordered and added ModelId properties in appsettings.json.
This commit is contained in:
Marco Minerva
2025-01-16 15:06:31 +01:00
parent 6dbecfbc63
commit 9342b8d1e9
4 changed files with 11 additions and 5 deletions
+6 -1
View File
@@ -34,6 +34,11 @@ builder.Services.AddHybridCache(options =>
}; };
}); });
builder.Services.ConfigureHttpClientDefaults(builder =>
{
builder.AddStandardResilienceHandler();
});
// Semantic Kernel is used to generate embeddings and to reformulate questions taking into account all the previous interactions, // Semantic Kernel is used to generate embeddings and to reformulate questions taking into account all the previous interactions,
// so that embeddings themselves can be generated more accurately. // so that embeddings themselves can be generated more accurately.
builder.Services.AddKernel() builder.Services.AddKernel()
@@ -46,8 +51,8 @@ builder.Services.AddScoped<VectorSearchService>();
builder.Services.AddOpenApi(options => builder.Services.AddOpenApi(options =>
{ {
options.AddDefaultResponse();
options.RemoveServerList(); options.RemoveServerList();
options.AddDefaultResponse();
}); });
builder.Services.AddDefaultProblemDetails(); builder.Services.AddDefaultProblemDetails();
@@ -4,7 +4,7 @@ public class AppSettings
{ {
public int MaxTokensPerLine { get; init; } = 300; public int MaxTokensPerLine { get; init; } = 300;
public int MaxTokensPerParagraph { get; init; } = 1024; public int MaxTokensPerParagraph { get; init; } = 1000;
public int OverlapTokens { get; init; } = 100; public int OverlapTokens { get; init; } = 100;
@@ -13,6 +13,7 @@
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.1" /> <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.1" />
<PackageReference Include="Microsoft.Extensions.Caching.Hybrid" Version="9.1.0-preview.1.25064.3" /> <PackageReference Include="Microsoft.Extensions.Caching.Hybrid" Version="9.1.0-preview.1.25064.3" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="9.1.0" />
<PackageReference Include="Microsoft.ML.Tokenizers" Version="1.0.1" /> <PackageReference Include="Microsoft.ML.Tokenizers" Version="1.0.1" />
<PackageReference Include="Microsoft.ML.Tokenizers.Data.Cl100kBase" Version="1.0.1" /> <PackageReference Include="Microsoft.ML.Tokenizers.Data.Cl100kBase" Version="1.0.1" />
<PackageReference Include="Microsoft.ML.Tokenizers.Data.O200kBase" Version="1.0.1" /> <PackageReference Include="Microsoft.ML.Tokenizers.Data.O200kBase" Version="1.0.1" />
+3 -3
View File
@@ -6,14 +6,14 @@
"ChatCompletion": { "ChatCompletion": {
"Endpoint": "", "Endpoint": "",
"Deployment": "", "Deployment": "",
"ApiKey": "", "ModelId": "", // o1, gpt-4o, gpt-4, gpt-3.5
"ModelId": "" // o1, gpt-4o, gpt-4, gpt-3.5 "ApiKey": ""
}, },
"Embedding": { "Embedding": {
"Endpoint": "", "Endpoint": "",
"Deployment": "", "Deployment": "",
"ModelId": "", // text-embedding-3-small, text-embedding-3-large, text-embedding-ada-002
"ApiKey": "", "ApiKey": "",
"ModelId": "",
// Set this value only if you're using a model that allows to specify the dimensions of the embeddings // Set this value only if you're using a model that allows to specify the dimensions of the embeddings
// (e.g. text-embedding-3-small or text-embedding-3-large). Currently, a maximum value of 1998 is supported. // (e.g. text-embedding-3-small or text-embedding-3-large). Currently, a maximum value of 1998 is supported.
"Dimensions": null "Dimensions": null