Skip to content

Commit f7ebc65

Browse files
Merge branch 'release-1.15' into python-sdk-1.15.0rc2
Signed-off-by: Elena Kolevska <elena-kolevska@users.noreply.github.com>
2 parents 87cbc68 + 7dfc415 commit f7ebc65

File tree

65 files changed

+1603
-292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1603
-292
lines changed

.github/env/global.env

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
DAPR_CLI_VERSION: 1.14.1
2-
DAPR_RUNTIME_VERSION: 1.15.0-rc.2
1+
DAPR_CLI_VERSION: 1.15.0-rc.2
2+
DAPR_RUNTIME_VERSION: 1.15.0-rc.5
33
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/v${DAPR_CLI_VERSION}/install/
44
DAPR_DEFAULT_IMAGE_REGISTRY: ghcr
55

@@ -11,4 +11,4 @@ GOVER: 1.22
1111

1212
KUBERNETES_VERSION: v1.32.0
1313
KIND_VERSION: v0.26.0
14-
KIND_IMAGE_SHA: sha256:c48c62eac5da28cdadcf560d1d8616cfa6783b58f0d94cf63ad1bf49600cb027
14+
KIND_IMAGE_SHA: sha256:c48c62eac5da28cdadcf560d1d8616cfa6783b58f0d94cf63ad1bf49600cb027

actors/csharp/sdk/README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Let's take a look at the Dapr [Actors building block](https://docs.dapr.io/devel
1313
For this example, you will need:
1414

1515
- [Dapr CLI and initialized environment](https://docs.dapr.io/getting-started).
16-
- [.NET 7 SDK](https://dotnet.microsoft.com/download).
16+
- [.NET 8 SDK](https://dotnet.microsoft.com/download).
1717
- Docker Desktop
1818

1919
### Step 2: Set up the environment
@@ -34,7 +34,7 @@ Run the `SmartDevice.Service`, which will start service itself and the Dapr side
3434
<!-- STEP
3535
name: Run actor service
3636
expected_stdout_lines:
37-
- "Request finished HTTP/1.1 GET http://127.0.0.1:5001/healthz - 200"
37+
- "Request finished HTTP/1.1 GET http://127.0.0.1:5001/dapr/config - 200"
3838
expected_stderr_lines:
3939
working_dir: .
4040
output_match_mode: substring
@@ -50,14 +50,23 @@ dapr run --app-id actorservice --app-port 5001 --app-protocol http --dapr-http-p
5050
Expected output:
5151

5252
```bash
53+
== APP == info: Microsoft.Hosting.Lifetime[14]
54+
== APP == Now listening on: http://localhost:5001
55+
== APP == info: Microsoft.Hosting.Lifetime[0]
56+
== APP == Application started. Press Ctrl+C to shut down.
57+
== APP == info: Microsoft.Hosting.Lifetime[0]
58+
== APP == Hosting environment: Production
59+
== APP == info: Microsoft.Hosting.Lifetime[0]
5360
== APP == info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
54-
== APP == Request starting HTTP/1.1 GET http://127.0.0.1:5001/healthz - -
61+
== APP == Request starting HTTP/1.1 GET http://127.0.0.1:5001/dapr/config - application/json -
62+
== APP == warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
63+
== APP == Failed to determine the https port for redirect.
5564
== APP == info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
56-
== APP == Executing endpoint 'Dapr Actors Health Check'
65+
== APP == Executing endpoint 'Dapr Actors Config'
5766
== APP == info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
58-
== APP == Executed endpoint 'Dapr Actors Health Check'
67+
== APP == Executed endpoint 'Dapr Actors Config'
5968
== APP == info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
60-
== APP == Request finished HTTP/1.1 GET http://127.0.0.1:5001/healthz - - - 200 - text/plain 5.2599ms
69+
== APP == Request finished HTTP/1.1 GET http://127.0.0.1:5001/dapr/config - 200 - application/json 30.6175ms
6170
```
6271

6372
### Step 4: Run the client app

actors/csharp/sdk/client/SmartDevice.Client.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Dapr.Actors" Version="1.14.*-*" />
11+
<PackageReference Include="Dapr.Actors" Version="1.15.0-rc02" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

actors/csharp/sdk/service/SmartDevice.Service.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Dapr.Actors" Version="1.14.*-*" />
11-
<PackageReference Include="Dapr.Actors.AspNetCore" Version="1.14.*-*" />
10+
<PackageReference Include="Dapr.Actors" Version="1.15.0-rc02" />
11+
<PackageReference Include="Dapr.Actors.AspNetCore" Version="1.15.0-rc02" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

bindings/csharp/sdk/batch/batch.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Dapr.AspNetCore" Version="1.14.*-*" />
11+
<PackageReference Include="Dapr.AspNetCore" Version="1.15.0-rc02" />
1212
</ItemGroup>
1313

1414
</Project>

bindings/csharp/sdk/batch/program.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,21 @@ limitations under the License.
3131
options.SupportedCultures = [invariantCulture];
3232
});
3333

34+
builder.Services.AddDaprClient();
35+
3436
var app = builder.Build();
3537

3638
if (app.Environment.IsDevelopment()) { app.UseDeveloperExceptionPage(); }
3739

3840
app.UseRequestLocalization();
3941

4042
// Triggered by Dapr input binding
41-
app.MapPost("/" + cronBindingName, async () =>
43+
app.MapPost("/" + cronBindingName, async (DaprClient client) =>
4244
{
4345
Console.WriteLine("Processing batch..");
4446

4547
string jsonFile = File.ReadAllText("../../../orders.json");
4648
var ordersArray = JsonSerializer.Deserialize<Orders>(jsonFile);
47-
using var client = new DaprClientBuilder().Build();
4849
foreach (Order ord in ordersArray?.orders ?? new Order[] { })
4950
{
5051
var sqlText = $"insert into orders (orderid, customer, price) values ({ord.OrderId}, '{ord.Customer}', {ord.Price});";
@@ -65,5 +66,5 @@ limitations under the License.
6566

6667
await app.RunAsync();
6768

68-
public record Order([property: JsonPropertyName("orderid")] int OrderId, [property: JsonPropertyName("customer")] string Customer, [property: JsonPropertyName("price")] float Price);
69-
public record Orders([property: JsonPropertyName("orders")] Order[] orders);
69+
public sealed record Order([property: JsonPropertyName("orderid")] int OrderId, [property: JsonPropertyName("customer")] string Customer, [property: JsonPropertyName("price")] float Price);
70+
public sealed record Orders([property: JsonPropertyName("orders")] Order[] orders);
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
dapr>=1.15.0rc2
22
Flask
3-
typing-extensions
3+
typing-extensions
4+
werkzeug>=3.0.3 # not directly required, pinned by Snyk to avoid a vulnerability
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
requests
2-
flask
2+
flask
3+
urllib3>=2.2.2 # not directly required, pinned by Snyk to avoid a vulnerability
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: dapr.io/v1alpha1
2+
kind: Component
3+
metadata:
4+
name: echo
5+
spec:
6+
type: conversation.echo
7+
version: v1

conversation/csharp/http/README.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Dapr Conversation API (C# HTTP)
2+
3+
In this quickstart, you'll send an input to a mock Large Language Model (LLM) using Dapr's Conversation API. This API is responsible for providing one consistent API entry point to talk to underlying LLM providers.
4+
5+
Visit [this](https://v1-15.docs.dapr.io/developing-applications/building-blocks/conversation/conversation-overview/) link for more information about Dapr and the Conversation API.
6+
7+
> **Note:** This example leverages HTTP `requests` only. If you are looking for the example using the Dapr Client SDK (recommended) [click here](../sdk/).
8+
9+
This quickstart includes one app:
10+
11+
- Conversation, responsible for sending an input to the underlying LLM and retrieving an output.
12+
13+
## Run the app with the template file
14+
15+
This section shows how to run the application using the [multi-app run template file](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) and Dapr CLI with `dapr run -f .`.
16+
17+
This example uses the default LLM Component provided by Dapr which simply echoes the input provided, for testing purposes. Integrate with popular LLM models by using one of the other [supported conversation components](https://v1-15.docs.dapr.io/reference/components-reference/supported-conversation/).
18+
19+
Open a new terminal window and run the multi app run template:
20+
21+
<!-- STEP
22+
name: Run multi app run template
23+
expected_stdout_lines:
24+
- '== APP - conversation == Input sent: What is dapr?'
25+
- '== APP - conversation == Output response: What is dapr?'
26+
expected_stderr_lines:
27+
output_match_mode: substring
28+
match_order: none
29+
background: true
30+
sleep: 15
31+
timeout_seconds: 15
32+
-->
33+
34+
```bash
35+
dapr run -f .
36+
```
37+
38+
The terminal console output should look similar to this, where:
39+
40+
- The app sends an input `What is dapr?` to the `echo` Component mock LLM.
41+
- The mock LLM echoes `What is dapr?`.
42+
43+
```text
44+
== APP - conversation == Input sent: What is dapr?
45+
== APP - conversation == Output response: What is dapr?
46+
```
47+
48+
<!-- END_STEP -->
49+
50+
2. Stop and clean up application processes.
51+
52+
<!-- STEP
53+
name: Stop multi-app run
54+
-->
55+
56+
```bash
57+
dapr stop -f .
58+
```
59+
60+
<!-- END_STEP -->
61+
62+
## Run the app individually
63+
64+
1. Open a terminal and run the `conversation` app. Build the dependencies if you haven't already.
65+
66+
```bash
67+
cd ./conversation
68+
dotnet build
69+
```
70+
71+
2. Run the Dapr process alongside the application.
72+
73+
```bash
74+
dapr run --app-id conversation --resources-path ../../../components/ -- dotnet run
75+
```
76+
77+
The terminal console output should look similar to this, where:
78+
79+
- The app sends an input `What is dapr?` to the `echo` Component mock LLM.
80+
- The mock LLM echoes `What is dapr?`.
81+
82+
```text
83+
== APP - conversation == Input sent: What is dapr?
84+
== APP - conversation == Output response: What is dapr?
85+
```
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
Copyright 2024 The Dapr Authors
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
*/
15+
16+
using System.Net.Http;
17+
using System.Text.Json;
18+
using System.Text;
19+
20+
class Program
21+
{
22+
private const string ConversationComponentName = "echo";
23+
24+
static async Task Main(string[] args)
25+
{
26+
var daprHost = Environment.GetEnvironmentVariable("DAPR_HOST") ?? "http://localhost";
27+
var daprHttpPort = Environment.GetEnvironmentVariable("DAPR_HTTP_PORT") ?? "3500";
28+
29+
var client = new HttpClient
30+
{
31+
Timeout = TimeSpan.FromSeconds(15)
32+
};
33+
34+
var inputBody = new
35+
{
36+
name = "echo",
37+
inputs = new[] { new { message = "What is dapr?" } },
38+
parameters = new { },
39+
metadata = new { }
40+
};
41+
42+
var daprUrl = $"{daprHost}:{daprHttpPort}/v1.0-alpha1/conversation/{ConversationComponentName}/converse";
43+
44+
try
45+
{
46+
var content = new StringContent(JsonSerializer.Serialize(inputBody), Encoding.UTF8, "application/json");
47+
48+
// Send a request to the echo mock LLM component
49+
var response = await client.PostAsync(daprUrl, content);
50+
response.EnsureSuccessStatusCode();
51+
52+
Console.WriteLine("Input sent: " + inputBody.inputs[0].message);
53+
54+
var responseBody = await response.Content.ReadAsStringAsync();
55+
56+
// Parse the response
57+
var data = JsonSerializer.Deserialize<Dictionary<string, List<Dictionary<string, string>>>>(responseBody);
58+
var result = data?["outputs"]?[0]?["result"];
59+
60+
Console.WriteLine("Output response: " + result);
61+
}
62+
catch (Exception ex)
63+
{
64+
Console.WriteLine("Error: " + ex.Message);
65+
}
66+
}
67+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="System.Text.Json" Version="9.0.1" />
12+
</ItemGroup>
13+
14+
</Project>

conversation/csharp/http/dapr.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 1
2+
common:
3+
resourcesPath: ../../components/
4+
apps:
5+
- appDirPath: ./conversation/
6+
appID: conversation
7+
daprHTTPPort: 3500
8+
command: ["dotnet", "run"]

conversation/csharp/http/makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include ../../../docker.mk
2+
include ../../../validate.mk

0 commit comments

Comments
 (0)