Skip to content

Commit

Permalink
Samples update #120
Browse files Browse the repository at this point in the history
  • Loading branch information
marcominerva committed Oct 9, 2023
1 parent ded1df7 commit 960418c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions samples/ChatGptApi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ await foreach (var delta in responseStream.AsDeltas())
})
.WithOpenApi();

app.MapPost("/api/embeddings", async (EmbeddingRequest request, IChatGptClient chatGptClient) =>
{
var embeddingResponse = await chatGptClient.GenerateEmbeddingAsync(request.Message);
return TypedResults.Ok(embeddingResponse);
})
.WithOpenApi();

app.Run();

public record class Request(Guid ConversationId, string Message);

public record class EmbeddingRequest(string Message);
1 change: 1 addition & 0 deletions samples/ChatGptApi/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values : ApiKey (default) or ActiveDirectory

"DefaultModel": "my-model",
"DefaultEmbeddingModel": "text-embedding-ada-002",
"MessageLimit": 20,
"MessageExpiration": "00:30:00",
"ThrowExceptionOnError": true
Expand Down
1 change: 1 addition & 0 deletions samples/ChatGptConsole/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values: ApiKey (default) or ActiveDirectory

"DefaultModel": "my-model",
"DefaultEmbeddingModel": "text-embedding-ada-002",
"MessageLimit": 20,
"MessageExpiration": "00:30:00",
"ThrowExceptionOnError": true
Expand Down
1 change: 1 addition & 0 deletions samples/ChatGptFunctionCallingConsole/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values: ApiKey (default) or ActiveDirectory

"DefaultModel": "gpt-3.5-turbo",
"DefaultEmbeddingModel": "text-embedding-ada-002",
"MessageLimit": 20,
"MessageExpiration": "00:30:00",
"ThrowExceptionOnError": true
Expand Down
1 change: 1 addition & 0 deletions samples/ChatGptStreamConsole/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values : ApiKey (default) or ActiveDirectory

"DefaultModel": "my-model",
"DefaultEmbeddingModel": "text-embedding-ada-002",
"MessageLimit": 20,
"MessageExpiration": "00:30:00",
"ThrowExceptionOnError": true
Expand Down

0 comments on commit 960418c

Please sign in to comment.