Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CM README.MD #47036

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions sdk/cloudmachine/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,12 @@ class AssistantService {
Lastly, create an instance of the service and call the `Chat` method when the app users browses the app:
```csharp
var service = new AssistantService();
app.MapGet("/", async () => {
return await service.Chat("List all noble gases");
});
app.MapGet("/", async () => await service.Chat("List all noble gases"));
```
The full program should look like following:
```csharp
using Azure.CloudMachine;
using Azure.CloudMachine.OpenAI;
using Azure.Provisioning.CloudMachine;
using Azure.Provisioning.CloudMachine.OpenAI;
using OpenAI.Chat;

if (CloudMachineInfrastructure.Configure(args, AssistantService.Configure)) return;
Expand All @@ -116,9 +112,7 @@ var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

var service = new AssistantService();
app.MapGet("/", async () => {
return await service.Chat("List all noble gases");
});
app.MapGet("/", async () => await service.Chat("List all noble gases"));

app.Run();

Expand Down Expand Up @@ -167,10 +161,7 @@ Your program shoud now look like following:
```csharp
using Azure.CloudMachine;
using Azure.CloudMachine.OpenAI;
using Azure.Provisioning.CloudMachine;
using Azure.Provisioning.CloudMachine.OpenAI;
using OpenAI.Chat;
using System.ClientModel.TypeSpec;

if (CloudMachineInfrastructure.Configure(args, AssistantService.Configure)) return;

Expand All @@ -179,9 +170,7 @@ var app = builder.Build();

var service = new AssistantService();
app.Map(service);
app.MapGet("/", async () => {
return await service.Chat("List all noble gasses");
});
app.MapGet("/", async () => await service.Chat("List all noble gases"));

app.Run();

Expand Down Expand Up @@ -243,6 +232,11 @@ npm install @typespec/http-client-csharp
tsp compile .\server\tsp\AssistantService.tsp --emit "@typespec/http-client-csharp"
dotnet build tsp-output\@typespec\http-client-csharp\src\AssistantService.csproj
```
You can also generate libraries for other languages, e.g.
```dotnetcli
npm install @typespec/http-client-python
tsp compile .\server\tsp\AssistantService.tsp --emit "@typespec/http-client-python"
```

#### Create command line client app for the service
```dotnetcli
Expand Down