Skip to content

Commit 6a0cc8b

Browse files
committed
Merge branch 'main' into filinto/dapr-default-better-devex
2 parents 97d1d91 + cd255bd commit 6a0cc8b

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

dapr_agents/llm/dapr/chat.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@
2323
from dapr_agents.prompt.prompty import Prompty
2424
from dapr_agents.tool import AgentTool
2525
from dapr_agents.types.exceptions import DaprRuntimeVersionNotSupportedError
26+
from dapr_agents.types.exceptions import DaprRuntimeVersionNotSupportedError
2627
from dapr_agents.types.message import (
2728
BaseMessage,
2829
LLMChatResponse,
2930
)
3031
from dapr_agents.utils import is_version_supported
32+
from dapr_agents.utils import is_version_supported
3133

3234

3335
# Lazy import to avoid import issues during test collection
@@ -80,6 +82,8 @@ class DaprChatClient(DaprInferenceClientBase, ChatClientBase):
8082

8183
component_name: Optional[str] = None
8284

85+
component_name: Optional[str] = None
86+
8387
# Only function_call–style structured output is supported
8488
SUPPORTED_STRUCTURED_MODES: ClassVar[set[str]] = {"function_call"}
8589

quickstarts/01-hello-world/03_durable_agent.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import asyncio
1010
import logging
1111

12+
1213
from typing import List
1314
from pydantic import BaseModel, Field
1415
from dapr_agents import tool, DurableAgent
@@ -85,6 +86,8 @@ async def main():
8586
print(f"Error starting service: {e}")
8687
finally:
8788
travel_planner.graceful_shutdown()
89+
finally:
90+
travel_planner.graceful_shutdown()
8891

8992

9093
if __name__ == "__main__":

quickstarts/01-hello-world/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,22 @@ uv pip install -r requirements.txt
2424

2525
</details>
2626

27+
<details>
28+
<summary><strong>Option 2: Using pip</strong></summary>
29+
<details open>
30+
<summary><strong>Option 1: Using uv (Recommended)</strong></summary>
31+
32+
```bash
33+
# Create and activate virtual environment
34+
uv venv .venv
35+
source .venv/bin/activate
36+
37+
# Install core dependencies
38+
uv pip install -r requirements.txt
39+
```
40+
41+
</details>
42+
2743
<details>
2844
<summary><strong>Option 2: Using pip</strong></summary>
2945

@@ -44,12 +60,18 @@ pip install -r requirements.txt
4460

4561
</details>
4662

63+
</details>
64+
4765

4866
## Configuration
4967

5068
> **Warning**
5169
> The examples will not work if you do not have a OpenAI API key exported in the environment.
5270
71+
Create a `.env` file in the project root and add your OpenAI API key:
72+
> **Warning**
73+
> The examples will not work if you do not have a OpenAI API key exported in the environment.
74+
5375
Create a `.env` file in the project root and add your OpenAI API key:
5476

5577
```env
@@ -63,6 +85,11 @@ Export the environment variables from the .env file to your shell:
6385
export $(grep -v '^#' .env | xargs) # or if .env is in the root directory, you can just run `export $(grep -v '^#' ../../.env | xargs)`
6486
```
6587

88+
Export the environment variables from the .env file to your shell:
89+
```bash
90+
export $(grep -v '^#' .env | xargs) # or if .env is in the root directory, you can just run `export $(grep -v '^#' ../../.env | xargs)`
91+
```
92+
6693
## Examples
6794

6895
### 1. Basic LLM Usage
@@ -167,6 +194,9 @@ A stateful agent that uses Dapr Workflows to ensure durability and persistence o
167194
We are using the Dapr ChatClient to interact with the OpenAI API. In the components folder, we have a `openai.yaml` file that contains the configuration for the OpenAI API.
168195
You need to replace the `{YOUR_OPENAI_API_KEY}` with your actual OpenAI API key.
169196

197+
We are using the Dapr ChatClient to interact with the OpenAI API. In the components folder, we have a `openai.yaml` file that contains the configuration for the OpenAI API.
198+
You need to replace the `{YOUR_OPENAI_API_KEY}` with your actual OpenAI API key.
199+
170200
Make sure Dapr is initialized on your system:
171201

172202
```bash
@@ -185,15 +215,31 @@ output_match_mode: substring
185215
-->
186216

187217

218+
We are using the `resolve_env_templates.py` script to resolve the environment variables in the components folder and substitute them with the actual values in your .env file, like the OpenAI API key.
219+
220+
<!-- STEP
221+
name: Run basic LLM example
222+
expected_stdout_lines:
223+
- "I want to find flights to Paris"
224+
- "TravelBuddy"
225+
timeout_seconds: 30
226+
output_match_mode: substring
227+
-->
228+
229+
188230
We are using the `resolve_env_templates.py` script to resolve the environment variables in the components folder and substitute them with the actual values in your .env file, like the OpenAI API key.
189231

190232
```bash
191233
dapr run --app-id stateful-llm --dapr-http-port 3500 --resources-path $(../resolve_env_templates.py ./components) -- python 03_durable_agent.py
234+
dapr run --app-id stateful-llm --dapr-http-port 3500 --resources-path $(../resolve_env_templates.py ./components) -- python 03_durable_agent.py
192235
```
193236

194237
<!-- END_STEP -->
195238

196239

240+
<!-- END_STEP -->
241+
242+
197243
This example demonstrates a stateful travel planning assistant that:
198244
1. Remembers user context persistently (across restarts)
199245
2. Uses a tool to search for flight options
@@ -322,6 +368,7 @@ output_match_mode: substring
322368
-->
323369
```bash
324370
dapr run --app-id dapr-agent-wf --resources-path $(../resolve_env_templates.py ./components) -- python 04_chain_tasks.py
371+
dapr run --app-id dapr-agent-wf --resources-path $(../resolve_env_templates.py ./components) -- python 04_chain_tasks.py
325372
```
326373
<!-- END_STEP -->
327374

@@ -392,6 +439,8 @@ Run the vector store agent example to see how to create an agent that can search
392439

393440
<!-- STEP
394441
name: Run agent with vector store example
442+
expected_stderr_lines:
443+
- "Batches"
395444
expected_stderr_lines:
396445
- "Batches"
397446
expected_stdout_lines:

0 commit comments

Comments
 (0)