Skip to content

Commit 3671a98

Browse files
authored
Merge branch 'v1.16' into fix/4687-clean
Signed-off-by: Marc Duiker <[email protected]>
2 parents 23de64e + 8de08db commit 3671a98

File tree

38 files changed

+290
-78
lines changed

38 files changed

+290
-78
lines changed

daprdocs/content/en/developing-applications/building-blocks/conversation/conversation-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The following features are out-of-the-box for [all the supported conversation co
3131

3232
### Prompt caching
3333

34-
Prompt caching improves performance by storing and reusing prompts repeated across API calls. Dapr keeps frequent prompts in a local cache for reuse with your app, reducing latency and cost by avoiding reprocessing for every request.
34+
The Conversation API includes a built-in caching mechanism (enabled by the cacheTTL parameter) that optimizes both performance and cost by storing previous model responses for faster delivery to repetitive requests. This is particularly valuable in scenarios where similar prompt patterns occur frequently. When caching is enabled, Dapr creates a deterministic hash of the prompt text and all configuration parameters, checks if a valid cached response exists for this hash within the time period (for example, 10 minutes), and returns the cached response immediately if found. If no match exists, Dapr makes the API call and stores the result. This eliminates external API calls, lowers latency, and avoids provider charges for repeated requests. The cache exists entirely within your runtime environment, with each Dapr sidecar maintaining its own local cache.
3535

3636
### Personally identifiable information (PII) obfuscation
3737

daprdocs/content/en/developing-applications/building-blocks/conversation/howto-conversation-layer.md

Lines changed: 124 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ spec:
5656
5757
## Connect the conversation client
5858
59-
The following examples use an HTTP client to send a POST request to Dapr's sidecar HTTP endpoint. You can also use [the Dapr SDK client instead]({{% ref "#related-links" %}}).
59+
The following examples use the Dapr SDK client to interact with LLMs.
6060
6161
{{< tabpane text=true >}}
6262
@@ -83,7 +83,7 @@ var response = await conversationClient.ConverseAsync("conversation",
8383
DaprConversationRole.Generic)
8484
});
8585
86-
Console.WriteLine("Received the following from the LLM:");
86+
Console.WriteLine("conversation output: ");
8787
foreach (var resp in response.Outputs)
8888
{
8989
Console.WriteLine($"\t{resp.Result}");
@@ -92,6 +92,77 @@ foreach (var resp in response.Outputs)
9292

9393
{{% /tab %}}
9494

95+
<!-- Java -->
96+
{{% tab "Java" %}}
97+
98+
```java
99+
//dependencies
100+
import io.dapr.client.DaprClientBuilder;
101+
import io.dapr.client.DaprPreviewClient;
102+
import io.dapr.client.domain.ConversationInput;
103+
import io.dapr.client.domain.ConversationRequest;
104+
import io.dapr.client.domain.ConversationResponse;
105+
import reactor.core.publisher.Mono;
106+
107+
import java.util.List;
108+
109+
public class Conversation {
110+
111+
public static void main(String[] args) {
112+
String prompt = "Please write a witty haiku about the Dapr distributed programming framework at dapr.io";
113+
114+
try (DaprPreviewClient client = new DaprClientBuilder().buildPreviewClient()) {
115+
System.out.println("Input: " + prompt);
116+
117+
ConversationInput daprConversationInput = new ConversationInput(prompt);
118+
119+
// Component name is the name provided in the metadata block of the conversation.yaml file.
120+
Mono<ConversationResponse> responseMono = client.converse(new ConversationRequest("echo",
121+
List.of(daprConversationInput))
122+
.setContextId("contextId")
123+
.setScrubPii(true).setTemperature(1.1d));
124+
ConversationResponse response = responseMono.block();
125+
System.out.printf("conversation output: %s", response.getConversationOutputs().get(0).getResult());
126+
} catch (Exception e) {
127+
throw new RuntimeException(e);
128+
}
129+
}
130+
}
131+
```
132+
133+
{{% /tab %}}
134+
135+
<!-- Python -->
136+
{{% tab "Python" %}}
137+
138+
```python
139+
#dependencies
140+
from dapr.clients import DaprClient
141+
from dapr.clients.grpc._request import ConversationInput
142+
143+
#code
144+
with DaprClient() as d:
145+
inputs = [
146+
ConversationInput(content="Please write a witty haiku about the Dapr distributed programming framework at dapr.io", role='user', scrub_pii=True),
147+
]
148+
149+
metadata = {
150+
'model': 'modelname',
151+
'key': 'authKey',
152+
'cacheTTL': '10m',
153+
}
154+
155+
response = d.converse_alpha1(
156+
name='echo', inputs=inputs, temperature=0.7, context_id='chat-123', metadata=metadata
157+
)
158+
159+
for output in response.outputs:
160+
print(f'conversation output: {output.result}')
161+
```
162+
163+
{{% /tab %}}
164+
165+
95166
<!-- Go -->
96167
{{% tab "Go" %}}
97168

@@ -189,39 +260,58 @@ dapr run --app-id conversation --dapr-grpc-port 50001 --log-level debug --resour
189260

190261
{{% /tab %}}
191262

192-
<!-- Go -->
193-
{{% tab "Go" %}}
263+
264+
{{% tab "Java" %}}
194265

195266
```bash
196-
dapr run --app-id conversation --dapr-grpc-port 50001 --log-level debug --resources-path ./config -- go run ./main.go
267+
268+
dapr run --app-id conversation --dapr-grpc-port 50001 --log-level debug --resources-path ./config -- mvn spring-boot:run
197269
```
198270

199-
**Expected output**
271+
{{% /tab %}}
272+
273+
200274

275+
{{% tab "Python" %}}
276+
277+
```bash
278+
279+
dapr run --app-id conversation --dapr-grpc-port 50001 --log-level debug --resources-path ./config -- python3 app.py
201280
```
202-
- '== APP == conversation output: Please write a witty haiku about the Dapr distributed programming framework at dapr.io'
281+
282+
{{% /tab %}}
283+
284+
285+
<!-- Go -->
286+
{{% tab "Go" %}}
287+
288+
```bash
289+
dapr run --app-id conversation --dapr-grpc-port 50001 --log-level debug --resources-path ./config -- go run ./main.go
203290
```
204291

292+
205293
{{% /tab %}}
206294

295+
296+
207297
<!-- Rust -->
208298
{{% tab "Rust" %}}
209299

210300
```bash
211301
dapr run --app-id=conversation --resources-path ./config --dapr-grpc-port 3500 -- cargo run --example conversation
212302
```
213303

304+
{{% /tab %}}
305+
306+
{{< /tabpane >}}
307+
308+
214309
**Expected output**
215310

216311
```
217-
- 'conversation input: hello world'
218-
- 'conversation output: hello world'
312+
- '== APP == conversation output: Please write a witty haiku about the Dapr distributed programming framework at dapr.io'
219313
```
220314

221-
{{% /tab %}}
222-
223-
{{< /tabpane >}}
224-
225315
## Advanced features
226316

227317
The conversation API supports the following features:
@@ -230,9 +320,11 @@ The conversation API supports the following features:
230320

231321
1. **PII scrubbing:** Allows for the obfuscation of data going in and out of the LLM.
232322

323+
1. **Tool calling:** Allows LLMs to interact with external functions and APIs.
324+
233325
To learn how to enable these features, see the [conversation API reference guide]({{% ref conversation_api %}}).
234326

235-
## Related links
327+
## Conversation API examples in Dapr SDK repositories
236328

237329
Try out the conversation API using the full examples provided in the supported SDK repos.
238330

@@ -246,7 +338,23 @@ Try out the conversation API using the full examples provided in the supported S
246338

247339
{{% /tab %}}
248340

249-
<!-- Go -->
341+
342+
<!-- Java -->
343+
{{% tab "Java" %}}
344+
345+
[Dapr conversation example with the Java SDK](https://github.com/dapr/java-sdk/tree/master/examples/src/main/java/io/dapr/examples/conversation)
346+
347+
{{% /tab %}}
348+
349+
350+
<!-- Python -->
351+
{{% tab "Python" %}}
352+
353+
[Dapr conversation example with the Python SDK](https://github.com/dapr/python-sdk/tree/main/examples/conversation)
354+
355+
{{% /tab %}}
356+
357+
<!-- Go -->
250358
{{% tab "Go" %}}
251359

252360
[Dapr conversation example with the Go SDK](https://github.com/dapr/go-sdk/tree/main/examples/conversation)
@@ -264,6 +372,6 @@ Try out the conversation API using the full examples provided in the supported S
264372

265373

266374
## Next steps
267-
375+
- [Conversation quickstart]({{% ref conversation-quickstart %}})
268376
- [Conversation API reference guide]({{% ref conversation_api %}})
269377
- [Available conversation components]({{% ref supported-conversation %}})

daprdocs/content/en/developing-applications/building-blocks/state-management/howto-outbox.md

Lines changed: 60 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,72 @@ For example, you can use the outbox pattern to:
1616

1717
With Dapr's outbox support, you can notify subscribers when an application's state is created or updated when calling Dapr's [transactions API]({{% ref "state_api.md#state-transactions" %}}).
1818

19-
The diagram below is an overview of how the outbox feature works:
19+
The diagram below is an overview of how the outbox feature works at a high level:
2020

2121
1) Service A saves/updates state to the state store using a transaction.
2222
2) A message is written to the broker under the same transaction. When the message is successfully delivered to the message broker, the transaction completes, ensuring the state and message are transacted together.
2323
3) The message broker delivers the message topic to any subscribers - in this case, Service B.
2424

25-
<img src="/images/state-management-outbox.png" width=800 alt="Diagram showing the steps of the outbox pattern">
25+
<img src="/images/state-management-outbox.png" width=800 alt="Diagram showing the overview of outbox pattern">
2626

27+
## How outbox works under the hood
28+
29+
Dapr outbox processes requests in two flows: the user request flow and the background message flow. Together, they guarantee that state and events stay consistent.
30+
31+
<img src="/images/state-management-outbox-steps.png" width=800 alt="Diagram showing the steps of the outbox pattern">
32+
33+
This is the sequence of interactions:
34+
35+
1. An application calls the Dapr State Management API to write state transactionally using the transactional methods.
36+
This is the entry point where business data, such as an order or profile update, is submitted for persistence.
37+
38+
2. Dapr publishes an intent message with a unique transaction ID to an internal outbox topic.
39+
This durable record ensures the event intent exists before any database commit happens.
40+
41+
3. The state and a transaction marker are written atomically in the same state store.
42+
Both the business data and the marker are committed in the same transaction, preventing partial writes.
43+
44+
4. The application receives a success response after the transaction commits.
45+
At this point, the application can continue, knowing state is saved and the event intent is guaranteed.
46+
47+
5. A background subscriber reads the intent message.
48+
When outbox is enabled, Dapr starts consumers that process the internal outbox topic.
49+
50+
6. The subscriber verifies the transaction marker in the state store.
51+
This check confirms that the database commit was successful before publishing externally.
52+
53+
7. Verified business event is published to the external pub/sub topic.
54+
The event is sent to the configured broker (Kafka, RabbitMQ, etc.) where other services can consume it.
55+
56+
8. The marker is cleaned up (deleted) from the state store.
57+
This prevents unbounded growth in the database once the event has been successfully delivered.
58+
59+
9. Message is acknowledged and removed from internal topic
60+
If publishing or cleanup fails, Dapr retries, ensuring reliable at-least-once delivery.
61+
2762
## Requirements
2863

29-
The outbox feature can be used with using any [transactional state store]({{% ref supported-state-stores %}}) supported by Dapr. All [pub/sub brokers]({{% ref supported-pubsub %}}) are supported with the outbox feature.
64+
1. The outbox feature requires a [transactional state store]({{% ref supported-state-stores %}}) supported by Dapr.
65+
[Learn more about the transactional methods you can use.]({{% ref "howto-get-save-state.md#perform-state-transactions" %}})
3066

31-
[Learn more about the transactional methods you can use.]({{% ref "howto-get-save-state.md#perform-state-transactions" %}})
67+
2. Any [pub/sub broker]({{% ref supported-pubsub %}}) supported by Dapr can be used with the outbox feature.
3268

33-
{{% alert title="Note" color="primary" %}}
34-
Message brokers that work with the competing consumer pattern (for example, [Apache Kafka]({{% ref setup-apache-kafka%}})) are encouraged to reduce the chances of duplicate events.
35-
{{% /alert %}}
69+
{{% alert title="Note" color="primary" %}}
70+
Message brokers that support the competing consumer pattern (for example, [Apache Kafka]({{% ref setup-apache-kafka%}})) are recommended to reduce the chance of duplicate events.
71+
{{% /alert %}}
72+
73+
3. Internal outbox topic
74+
When outbox is enabled, Dapr creates an internal topic using the following naming convention: `{namespace}{appID}{topic}outbox`, where:
75+
76+
- `namespace`: the Dapr application namespace (if configured)
77+
- `appID`: the Dapr application identifier
78+
- `topic`: the value specified in the `outboxPublishTopic` metadata
79+
80+
This way each outbox topic is uniquely identified per application and external topic, preventing routing conflicts in multi-tenant environments.
81+
82+
{{% alert title="Note" color="primary" %}}
83+
Ensure that the topic is created in advance, or Dapr has sufficient permissions to create the topic at startup time.
84+
{{% /alert %}}
3685

3786
## Enable the outbox pattern
3887

@@ -682,3 +731,7 @@ The `data` CloudEvent field is reserved for Dapr's use only, and is non-customiz
682731
Watch [this video for an overview of the outbox pattern](https://youtu.be/rTovKpG0rhY?t=1338):
683732

684733
{{< youtube id=rTovKpG0rhY start=1338 >}}
734+
735+
## Next Steps
736+
737+
[How Dapr Outbox Eliminates Dual Writes in Distributed Applications](https://www.diagrid.io/blog/how-dapr-outbox-eliminates-dual-writes-in-distributed-applications)

daprdocs/content/en/developing-applications/building-blocks/workflow/workflow-architecture.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,20 @@ Similarly, if a state store imposes restrictions on the size of a batch transact
175175
Workflow state can be purged from a state store, including all its history.
176176
Each Dapr SDK exposes APIs for purging all metadata related to specific workflow instances.
177177

178+
#### State store record count
179+
180+
The number of records which are saved as history in the state store per workflow run is determined by its complexity or "shape". In other words, the number of activities, timers, sub-workflows etc.
181+
The following table shows a general guide to the number of records that are saved by different workflow tasks.
182+
This number may be larger or smaller depending on retries or concurrency.
183+
184+
| Task type | Number of records saved |
185+
| ----------|-------------------------|
186+
| Start workflow | 5 records |
187+
| Call activity | 3 records |
188+
| Timer | 3 records |
189+
| Raise event | 3 records |
190+
| Start child workflow | 8 records |
191+
178192
## Workflow scalability
179193

180194
Because Dapr Workflows are internally implemented using actors, Dapr Workflows have the same scalability characteristics as actors.

daprdocs/content/en/developing-applications/building-blocks/workflow/workflow-overview.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ Want to skip the quickstarts? Not a problem. You can try out the workflow buildi
116116

117117
## Limitations
118118

119-
- **State stores:** Due to underlying limitations in some database choices, more commonly NoSQL databases, you might run into limitations around storing internal states. For example, CosmosDB has a maximum single operation item limit of only 100 states in a single request.
119+
- **State stores:** You can only use state stores which support workflows, as [described here]({{% ref supported-state-stores %}}).
120+
- Azure Cosmos DB has [payload and workflow complexity limitations]({{% ref "setup-azure-cosmosdb.md#workflow-limitations" %}}).
121+
- AWS DynamoDB has [workflow complexity limitations]({{% ref "setup-azure-cosmosdb.md#workflow-limitations" %}}).
120122

121123
## Watch the demo
122124

daprdocs/content/en/operations/configuration/increase-request-size.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
---
22
type: docs
3-
title: "How-To: Handle large http body requests"
4-
linkTitle: "HTTP request body size"
3+
title: "How-To: Handle larger body requests"
4+
linkTitle: "Request body size"
55
weight: 6000
66
description: "Configure http requests that are bigger than 4 MB"
77
---
88

9-
By default, Dapr has a limit for the request body size, set to 4MB. You can change this by defining:
10-
- The `dapr.io/http-max-request-size` annotation, or
11-
- The `--dapr-http-max-request-size` flag.
9+
{{% alert title="Note" color="primary" %}}
10+
The existing flag/annotation`dapr-http-max-request-size` has been deprecated and updated to `max-body-size`.
11+
{{% /alert %}}
12+
13+
By default, Dapr has a limit for the request body size, set to 4MB. You can change this for both HTTP and gRPC requests by defining:
14+
- The `dapr.io/max-body-size` annotation, or
15+
- The `--max-body-size` flag.
1216

1317
{{< tabpane text=true >}}
1418

1519
<!--self hosted-->
1620
{{% tab "Self-hosted" %}}
1721

18-
When running in self-hosted mode, use the `--dapr-http-max-request-size` flag to configure Dapr to use non-default request body size:
22+
When running in self-hosted mode, use the `--max-body-size` flag to configure Dapr to use non-default request body size:
1923

2024
```bash
21-
dapr run --dapr-http-max-request-size 16 node app.js
25+
dapr run --max-body-size 16 node app.js
2226
```
23-
This tells Dapr to set maximum request body size to `16` MB.
24-
2527
{{% /tab %}}
2628

2729
<!--kubernetes-->
@@ -50,14 +52,16 @@ spec:
5052
dapr.io/enabled: "true"
5153
dapr.io/app-id: "myapp"
5254
dapr.io/app-port: "8000"
53-
dapr.io/http-max-request-size: "16"
55+
dapr.io/max-body-size: "16"
5456
#...
5557
```
5658

5759
{{% /tab %}}
5860

5961
{{< /tabpane >}}
6062

63+
This tells Dapr to set the maximum request body size to `16` MB for both HTTP and gRPC requests.
64+
6165
## Related links
6266

6367
[Dapr Kubernetes pod annotations spec]({{% ref arguments-annotations-overview.md %}})

0 commit comments

Comments
 (0)