Merge branch 'release-1.16' into fix/go-jobs-quickstart-failures

This commit is contained in:
Nelson Parente 2025-08-18 09:39:01 +01:00 committed by GitHub
commit 40f0db5fcb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 201 additions and 62 deletions

View File

@ -28,12 +28,12 @@
<dependency>
<groupId>io.dapr</groupId>
<artifactId>dapr-sdk-springboot</artifactId>
<version>1.14.1</version>
<version>1.15.0</version>
</dependency>
<dependency>
<groupId>io.dapr</groupId>
<artifactId>dapr-sdk</artifactId>
<version>1.14.1</version>
<version>1.15.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>

View File

@ -1,4 +1,4 @@
dapr>=1.15.0
dapr>=1.16.0-rc1
Flask
uvicorn
typing-extensions

View File

@ -17,7 +17,7 @@
<dependency>
<groupId>io.dapr</groupId>
<artifactId>dapr-sdk</artifactId>
<version>1.14.1</version>
<version>1.15.0</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>

View File

@ -1,2 +1,2 @@
dapr>=1.15.0
dapr>=1.16.0-rc1
typing-extensions

View File

@ -8,7 +8,7 @@ Visit [this](https://docs.dapr.io/developing-applications/building-blocks/conver
This quickstart includes one app:
- `app.py`, responsible for sending an input to the underlying LLM and retrieving an output.
- `app.py`, responsible for sending an input to the underlying LLM and retrieving an output. It includes a secondary conversation request to showcase tool calling to the underlying LLM.
## Run the app with the template file
@ -35,8 +35,11 @@ cd ..
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- '== APP - conversation == INFO:root:Input sent: What is dapr?'
- '== APP - conversation == INFO:root:Output response: What is dapr?'
- '== APP - conversation == Conversation input sent: What is dapr?'
- '== APP - conversation == Output response: What is dapr?'
- '== APP - conversation == Tool calling input sent: What is the weather like in San Francisco in celsius?'
- '== APP - conversation == Output message: What is the weather like in San Francisco in celsius?'
- '== APP - conversation == No tool calls in response'
expected_stderr_lines:
output_match_mode: substring
match_order: none
@ -51,14 +54,27 @@ dapr run -f .
The terminal console output should look similar to this, where:
- The app sends an input `What is dapr?` to the `echo` Component mock LLM.
- The app first sends an input `What is dapr?` to the `echo` Component mock LLM.
- The mock LLM echoes `What is dapr?`.
- The app then sends a weather request to the component with tools available to the LLM.
- The LLM will either respond back with a tool call for the user, or an ask for more information.
```text
== APP - conversation == Input sent: What is dapr?
== APP - conversation == Output response: What is dapr?
```
- The app then sends an input `What is the weather like in San Francisco in celsius?` to the `echo` Component mock LLM.
- The mock LLM echoes `What is the weather like in San Francisco in celsius?` and calls the `get_weather` tool.
- Since we are using the `echo` Component mock LLM, the tool call is not executed and the LLM returns `No tool calls in response`.
```text
== APP == Tool calling input sent: What is the weather like in San Francisco in celsius?
== APP == Output message: What is the weather like in San Francisco in celsius?
== APP == No tool calls in response
```
```
<!-- END_STEP -->
2. Stop and clean up application processes.
@ -91,9 +107,17 @@ pip3 install -r requirements.txt
dapr run --app-id conversation --resources-path ../../../components -- python3 app.py
```
You should see the output:
The terminal console output should look similar to this, where:
```bash
== APP == INFO:root:Input sent: What is dapr?
== APP == INFO:root:Output response: What is dapr?
```
- The app first sends an input `What is dapr?` to the `echo` Component mock LLM.
- The mock LLM echoes `What is dapr?`.
- The app then sends an input `What is the weather like in San Francisco in celsius?` to the `echo` Component mock LLM.
- The mock LLM echoes `What is the weather like in San Francisco in celsius?`
```text
== APP - conversation == Conversation input sent: What is dapr?
== APP - conversation == Output response: What is dapr?
== APP - conversation == Tool calling input sent: What is the weather like in San Francisco in celsius?
== APP - conversation == Output message: What is the weather like in San Francisco in celsius?
== APP - conversation == No tool calls in response
```

View File

@ -14,7 +14,11 @@ import logging
import requests
import os
logging.basicConfig(level=logging.INFO)
# Configure logging to only show the message without level/logger prefix
logging.basicConfig(
level=logging.INFO,
format='%(message)s'
)
base_url = os.getenv('BASE_URL', 'http://localhost') + ':' + os.getenv(
'DAPR_HTTP_PORT', '3500')
@ -22,21 +26,132 @@ base_url = os.getenv('BASE_URL', 'http://localhost') + ':' + os.getenv(
CONVERSATION_COMPONENT_NAME = 'echo'
input = {
'inputs': [{'content':'What is dapr?'}],
'parameters': {},
'metadata': {}
}
'name': 'anthropic',
'inputs': [{
'messages': [{
'of_user': {
'content': [{
'text': 'What is dapr?'
}]
}
}]
}],
'parameters': {},
'metadata': {}
}
# Send input to conversation endpoint
result = requests.post(
url='%s/v1.0-alpha1/conversation/%s/converse' % (base_url, CONVERSATION_COMPONENT_NAME),
json=input
url='%s/v1.0-alpha2/conversation/%s/converse' % (base_url, CONVERSATION_COMPONENT_NAME),
json=input
)
logging.info('Input sent: What is dapr?')
logging.info('Conversation input sent: What is dapr?')
# Parse conversation output
data = result.json()
output = data["outputs"][0]["result"]
try:
if 'outputs' in data and len(data['outputs']) > 0:
output = data["outputs"][0]["choices"][0]["message"]["content"]
logging.info('Output response: ' + output)
else:
logging.error('No outputs found in response')
logging.error('Response data: ' + str(data))
except (KeyError, IndexError) as e:
logging.error(f'Error parsing response: {e}')
if 'outputs' in data:
logging.info(f'Available outputs: {data["outputs"]}')
else:
logging.info(f'No outputs found in response')
logging.info('Output response: ' + output)
tool_call_input = {
'name': 'anthropic',
'inputs': [{
'messages': [{
'of_user': {
'content': [{
'text': 'What is the weather like in San Francisco in celsius?'
}]
}
}],
'scrubPII': False
}],
'parameters': {
'max_tokens': {
'@type': 'type.googleapis.com/google.protobuf.Int64Value',
'value': '100'
},
'model': {
'@type': 'type.googleapis.com/google.protobuf.StringValue',
'value': 'claude-3-5-sonnet-20240620'
}
},
'metadata': {
'api_key': 'test-key',
'version': '1.0'
},
'scrubPii': False,
'temperature': 0.7,
'tools': [{
'function': {
'name': 'get_weather',
'description': 'Get the current weather for a location',
'parameters': {
'type': 'object',
'properties': {
'location': {
'type': 'string',
'description': 'The city and state, e.g. San Francisco, CA'
},
'unit': {
'type': 'string',
'enum': ['celsius', 'fahrenheit'],
'description': 'The temperature unit to use'
}
},
'required': ['location']
}
}
}],
'toolChoice': 'auto'
}
# Send input to conversation endpoint
tool_call_result = requests.post(
url='%s/v1.0-alpha2/conversation/%s/converse' % (base_url, CONVERSATION_COMPONENT_NAME),
json=tool_call_input
)
logging.info('Tool calling input sent: What is the weather like in San Francisco in celsius?')
# Parse conversation output
data = tool_call_result.json()
if 'outputs' in data and len(data['outputs']) > 0:
output = data['outputs'][0]
if 'choices' in output and len(output['choices']) > 0:
choice = output['choices'][0]
if 'message' in choice:
message = choice['message']
if 'content' in message and message['content']:
logging.info('Output message: ' + message['content'])
if 'toolCalls' in message and message['toolCalls']:
logging.info('Tool calls detected:')
for tool_call in message['toolCalls']:
logging.info('Tool call: ' + str(tool_call))
if 'function' in tool_call:
func_call = tool_call['function']
logging.info(f"Function name: {func_call.get('name', 'unknown')}")
logging.info(f"Function arguments: {func_call.get('arguments', 'none')}")
else:
logging.info('No tool calls in response')
else:
logging.error('No message in choice')
else:
logging.error('No choices in output')
else:
logging.error('No outputs in response')
logging.error('Response data: ' + str(data))

View File

@ -1 +1 @@
requests
requests>=2.25.0

View File

@ -1 +1 @@
dapr>=1.15.0
dapr>=1.16.0-rc1

View File

@ -1,2 +1,2 @@
dapr>=1.15.0
dapr>=1.16.0-rc1
typing-extensions

View File

@ -17,7 +17,7 @@
<dependency>
<groupId>io.dapr</groupId>
<artifactId>dapr-sdk</artifactId>
<version>1.14.1</version>
<version>1.15.0</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>

View File

@ -24,12 +24,12 @@
<dependency>
<groupId>io.dapr</groupId>
<artifactId>dapr-sdk-springboot</artifactId>
<version>1.14.1</version>
<version>1.15.0</version>
</dependency>
<dependency>
<groupId>io.dapr</groupId>
<artifactId>dapr-sdk</artifactId>
<version>1.14.1</version>
<version>1.15.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>

View File

@ -1,5 +1,5 @@
Flask
uvicorn
dapr>=1.15.0
dapr>=1.16.0-rc1
cloudevents
werkzeug>=3.0.3 # not directly required, pinned by Snyk to avoid a vulnerability

View File

@ -1 +1 @@
dapr>=1.15.0
dapr>=1.16.0-rc1

View File

@ -1,5 +1,5 @@
Flask
dapr>=1.15.0
dapr>=1.16.0-rc1
cloudevents
uvicorn
typing-extensions

View File

@ -20,7 +20,7 @@
<dependency>
<groupId>io.dapr</groupId>
<artifactId>dapr-sdk</artifactId>
<version>1.14.1</version>
<version>1.15.0</version>
</dependency>
</dependencies>
<build>

View File

@ -1,2 +1,2 @@
dapr>=1.15.0
dapr>=1.16.0-rc1
typing-extensions

View File

@ -1,6 +1,6 @@
Flask
uvicorn
dapr>=1.15.0
dapr>=1.16.0-rc1
typing-extensions
werkzeug>=3.0.3 # not directly required, pinned by Snyk to avoid a vulnerability

View File

@ -17,7 +17,7 @@
<dependency>
<groupId>io.dapr</groupId>
<artifactId>dapr-sdk</artifactId>
<version>1.14.1</version>
<version>1.15.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>

View File

@ -1,2 +1,2 @@
dapr>=1.15.0
dapr>=1.16.0-rc1
typing-extensions

View File

@ -1,4 +1,4 @@
dapr>=1.15.0
dapr-ext-workflow>=1.15.0
dapr>=1.16.0-rc1
dapr-ext-workflow>=1.16.0rc1
fastapi>=0.115.0
uvicorn>=0.34.2

View File

@ -1,5 +1,5 @@
dapr>=1.15.0
dapr-ext-workflow>=1.15.0
dapr>=1.16.0-rc1
dapr-ext-workflow>=1.16.0rc1
fastapi>=0.115.0
fastapi-cloudevents>=2.0.2
pydantic>=2.11.4

View File

@ -1,5 +1,5 @@
dapr>=1.15.0
dapr-ext-workflow>=1.15.0
dapr>=1.16.0-rc1
dapr-ext-workflow>=1.16.0rc1
fastapi>=0.115.0
fastapi-cloudevents>=2.0.2
pydantic>=2.11.4

View File

@ -1,4 +1,4 @@
dapr>=1.15.0
dapr-ext-workflow>=1.15.0
dapr>=1.16.0-rc1
dapr-ext-workflow>=1.16.0rc1
fastapi>=0.115.0
uvicorn>=0.34.2

View File

@ -1,4 +1,4 @@
dapr>=1.15.0
dapr-ext-workflow>=1.15.0
dapr>=1.16.0-rc1
dapr-ext-workflow>=1.16.0rc1
fastapi>=0.115.0
uvicorn>=0.34.2

View File

@ -1,4 +1,4 @@
dapr>=1.15.0
dapr-ext-workflow>=1.15.0
dapr>=1.16.0-rc1
dapr-ext-workflow>=1.16.0rc1
fastapi>=0.115.0
uvicorn>=0.34.2

View File

@ -1,4 +1,4 @@
dapr>=1.15.0
dapr-ext-workflow>=1.15.0
dapr>=1.16.0-rc1
dapr-ext-workflow>=1.16.0rc1
fastapi>=0.115.0
uvicorn>=0.34.2

View File

@ -1,4 +1,4 @@
dapr>=1.15.0
dapr-ext-workflow>=1.15.0
dapr>=1.16.0-rc1
dapr-ext-workflow>=1.16.0rc1
fastapi>=0.115.0
uvicorn>=0.34.2

View File

@ -1,4 +1,4 @@
dapr>=1.15.0
dapr-ext-workflow>=1.15.0
dapr>=1.16.0-rc1
dapr-ext-workflow>=1.16.0rc1
fastapi>=0.115.0
uvicorn>=0.34.2

View File

@ -1,4 +1,4 @@
dapr>=1.15.0
dapr-ext-workflow>=1.15.0
dapr>=1.16.0-rc1
dapr-ext-workflow>=1.16.0rc1
fastapi>=0.115.0
uvicorn>=0.34.2

View File

@ -17,7 +17,7 @@
<dependency>
<groupId>io.dapr</groupId>
<artifactId>dapr-sdk-workflows</artifactId>
<version>0.14.1</version>
<version>0.15.0</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>

View File

@ -87,7 +87,7 @@ export const orderProcessingWorkflow: TWorkflow = async function* (ctx: Workflow
tasks.push(approvalEvent);
const timeOutEvent = ctx.createTimer(30);
tasks.push(timeOutEvent);
const winner = ctx.whenAny(tasks);
const winner = yield ctx.whenAny(tasks);
if (winner == timeOutEvent) {
const orderNotification: OrderNotification = {

View File

@ -1,2 +1,2 @@
dapr-ext-workflow>=1.15.0
dapr>=1.15.0
dapr>=1.16.0-rc1
dapr-ext-workflow>=1.16.0rc1