diff --git a/bindings/java/sdk/batch/pom.xml b/bindings/java/sdk/batch/pom.xml index 6669e035..2ef55e36 100644 --- a/bindings/java/sdk/batch/pom.xml +++ b/bindings/java/sdk/batch/pom.xml @@ -28,12 +28,12 @@ io.dapr dapr-sdk-springboot - 1.14.1 + 1.15.0 io.dapr dapr-sdk - 1.14.1 + 1.15.0 org.projectlombok diff --git a/bindings/python/sdk/batch/requirements.txt b/bindings/python/sdk/batch/requirements.txt index 1a77b7ec..cad8183f 100644 --- a/bindings/python/sdk/batch/requirements.txt +++ b/bindings/python/sdk/batch/requirements.txt @@ -1,4 +1,4 @@ -dapr>=1.15.0 +dapr>=1.16.0-rc1 Flask uvicorn typing-extensions diff --git a/configuration/java/sdk/order-processor/pom.xml b/configuration/java/sdk/order-processor/pom.xml index 206ebfca..73982bc6 100644 --- a/configuration/java/sdk/order-processor/pom.xml +++ b/configuration/java/sdk/order-processor/pom.xml @@ -17,7 +17,7 @@ io.dapr dapr-sdk - 1.14.1 + 1.15.0 io.projectreactor diff --git a/configuration/python/sdk/order-processor/requirements.txt b/configuration/python/sdk/order-processor/requirements.txt index 6b1cd171..23710298 100644 --- a/configuration/python/sdk/order-processor/requirements.txt +++ b/configuration/python/sdk/order-processor/requirements.txt @@ -1,2 +1,2 @@ -dapr>=1.15.0 +dapr>=1.16.0-rc1 typing-extensions \ No newline at end of file diff --git a/conversation/python/http/README.md b/conversation/python/http/README.md index 2b2f7db4..afa472ba 100644 --- a/conversation/python/http/README.md +++ b/conversation/python/http/README.md @@ -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 .. 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 +``` \ No newline at end of file diff --git a/conversation/python/http/conversation/app.py b/conversation/python/http/conversation/app.py index bf80d54e..997f420c 100644 --- a/conversation/python/http/conversation/app.py +++ b/conversation/python/http/conversation/app.py @@ -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) \ No newline at end of file +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)) \ No newline at end of file diff --git a/conversation/python/http/conversation/requirements.txt b/conversation/python/http/conversation/requirements.txt index f2293605..4a5625c7 100644 --- a/conversation/python/http/conversation/requirements.txt +++ b/conversation/python/http/conversation/requirements.txt @@ -1 +1 @@ -requests +requests>=2.25.0 diff --git a/conversation/python/sdk/conversation/requirements.txt b/conversation/python/sdk/conversation/requirements.txt index 920f1239..e2ba1ce9 100644 --- a/conversation/python/sdk/conversation/requirements.txt +++ b/conversation/python/sdk/conversation/requirements.txt @@ -1 +1 @@ -dapr>=1.15.0 \ No newline at end of file +dapr>=1.16.0-rc1 \ No newline at end of file diff --git a/cryptography/python/sdk/crypto-quickstart/requirements.txt b/cryptography/python/sdk/crypto-quickstart/requirements.txt index 6b1cd171..23710298 100644 --- a/cryptography/python/sdk/crypto-quickstart/requirements.txt +++ b/cryptography/python/sdk/crypto-quickstart/requirements.txt @@ -1,2 +1,2 @@ -dapr>=1.15.0 +dapr>=1.16.0-rc1 typing-extensions \ No newline at end of file diff --git a/pub_sub/java/sdk/checkout/pom.xml b/pub_sub/java/sdk/checkout/pom.xml index 83daaf46..3d8f9561 100644 --- a/pub_sub/java/sdk/checkout/pom.xml +++ b/pub_sub/java/sdk/checkout/pom.xml @@ -17,7 +17,7 @@ io.dapr dapr-sdk - 1.14.1 + 1.15.0 com.squareup.okhttp3 diff --git a/pub_sub/java/sdk/order-processor/pom.xml b/pub_sub/java/sdk/order-processor/pom.xml index 2c3ed5b5..c829171a 100644 --- a/pub_sub/java/sdk/order-processor/pom.xml +++ b/pub_sub/java/sdk/order-processor/pom.xml @@ -24,12 +24,12 @@ io.dapr dapr-sdk-springboot - 1.14.1 + 1.15.0 io.dapr dapr-sdk - 1.14.1 + 1.15.0 org.projectlombok diff --git a/pub_sub/python/http/order-processor/requirements.txt b/pub_sub/python/http/order-processor/requirements.txt index 89f44ff4..51b3cf44 100644 --- a/pub_sub/python/http/order-processor/requirements.txt +++ b/pub_sub/python/http/order-processor/requirements.txt @@ -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 diff --git a/pub_sub/python/sdk/checkout/requirements.txt b/pub_sub/python/sdk/checkout/requirements.txt index cc1f79c0..5c95cdf8 100644 --- a/pub_sub/python/sdk/checkout/requirements.txt +++ b/pub_sub/python/sdk/checkout/requirements.txt @@ -1 +1 @@ -dapr>=1.15.0 +dapr>=1.16.0-rc1 diff --git a/pub_sub/python/sdk/order-processor/requirements.txt b/pub_sub/python/sdk/order-processor/requirements.txt index 327dc3f0..5763b4c3 100644 --- a/pub_sub/python/sdk/order-processor/requirements.txt +++ b/pub_sub/python/sdk/order-processor/requirements.txt @@ -1,5 +1,5 @@ Flask -dapr>=1.15.0 +dapr>=1.16.0-rc1 cloudevents uvicorn typing-extensions \ No newline at end of file diff --git a/secrets_management/java/sdk/order-processor/pom.xml b/secrets_management/java/sdk/order-processor/pom.xml index b9a3b893..4910d0a9 100644 --- a/secrets_management/java/sdk/order-processor/pom.xml +++ b/secrets_management/java/sdk/order-processor/pom.xml @@ -20,7 +20,7 @@ io.dapr dapr-sdk - 1.14.1 + 1.15.0 diff --git a/secrets_management/python/sdk/order-processor/requirements.txt b/secrets_management/python/sdk/order-processor/requirements.txt index 6b1cd171..23710298 100644 --- a/secrets_management/python/sdk/order-processor/requirements.txt +++ b/secrets_management/python/sdk/order-processor/requirements.txt @@ -1,2 +1,2 @@ -dapr>=1.15.0 +dapr>=1.16.0-rc1 typing-extensions \ No newline at end of file diff --git a/service_invocation/python/http/order-processor/requirements.txt b/service_invocation/python/http/order-processor/requirements.txt index fd37fc04..704704c2 100644 --- a/service_invocation/python/http/order-processor/requirements.txt +++ b/service_invocation/python/http/order-processor/requirements.txt @@ -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 diff --git a/state_management/java/sdk/order-processor/pom.xml b/state_management/java/sdk/order-processor/pom.xml index 397e11e4..5829a779 100644 --- a/state_management/java/sdk/order-processor/pom.xml +++ b/state_management/java/sdk/order-processor/pom.xml @@ -17,7 +17,7 @@ io.dapr dapr-sdk - 1.14.1 + 1.15.0 org.projectlombok diff --git a/state_management/python/sdk/order-processor/requirements.txt b/state_management/python/sdk/order-processor/requirements.txt index 6b1cd171..23710298 100644 --- a/state_management/python/sdk/order-processor/requirements.txt +++ b/state_management/python/sdk/order-processor/requirements.txt @@ -1,2 +1,2 @@ -dapr>=1.15.0 +dapr>=1.16.0-rc1 typing-extensions \ No newline at end of file diff --git a/tutorials/workflow/python/child-workflows/child_workflows/requirements.txt b/tutorials/workflow/python/child-workflows/child_workflows/requirements.txt index 5910374c..bc8b8499 100644 --- a/tutorials/workflow/python/child-workflows/child_workflows/requirements.txt +++ b/tutorials/workflow/python/child-workflows/child_workflows/requirements.txt @@ -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 \ No newline at end of file diff --git a/tutorials/workflow/python/combined-patterns/shipping_app/requirements.txt b/tutorials/workflow/python/combined-patterns/shipping_app/requirements.txt index bb058454..37b58b69 100644 --- a/tutorials/workflow/python/combined-patterns/shipping_app/requirements.txt +++ b/tutorials/workflow/python/combined-patterns/shipping_app/requirements.txt @@ -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 diff --git a/tutorials/workflow/python/combined-patterns/workflow_app/requirements.txt b/tutorials/workflow/python/combined-patterns/workflow_app/requirements.txt index bb058454..37b58b69 100644 --- a/tutorials/workflow/python/combined-patterns/workflow_app/requirements.txt +++ b/tutorials/workflow/python/combined-patterns/workflow_app/requirements.txt @@ -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 diff --git a/tutorials/workflow/python/external-system-interaction/external_events/requirements.txt b/tutorials/workflow/python/external-system-interaction/external_events/requirements.txt index 5910374c..bc8b8499 100644 --- a/tutorials/workflow/python/external-system-interaction/external_events/requirements.txt +++ b/tutorials/workflow/python/external-system-interaction/external_events/requirements.txt @@ -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 \ No newline at end of file diff --git a/tutorials/workflow/python/fan-out-fan-in/fan_out_fan_in/requirements.txt b/tutorials/workflow/python/fan-out-fan-in/fan_out_fan_in/requirements.txt index 5910374c..bc8b8499 100644 --- a/tutorials/workflow/python/fan-out-fan-in/fan_out_fan_in/requirements.txt +++ b/tutorials/workflow/python/fan-out-fan-in/fan_out_fan_in/requirements.txt @@ -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 \ No newline at end of file diff --git a/tutorials/workflow/python/fundamentals/basic/requirements.txt b/tutorials/workflow/python/fundamentals/basic/requirements.txt index 5910374c..bc8b8499 100644 --- a/tutorials/workflow/python/fundamentals/basic/requirements.txt +++ b/tutorials/workflow/python/fundamentals/basic/requirements.txt @@ -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 \ No newline at end of file diff --git a/tutorials/workflow/python/monitor-pattern/monitor/requirements.txt b/tutorials/workflow/python/monitor-pattern/monitor/requirements.txt index 5910374c..bc8b8499 100644 --- a/tutorials/workflow/python/monitor-pattern/monitor/requirements.txt +++ b/tutorials/workflow/python/monitor-pattern/monitor/requirements.txt @@ -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 \ No newline at end of file diff --git a/tutorials/workflow/python/resiliency-and-compensation/resiliency_and_compensation/requirements.txt b/tutorials/workflow/python/resiliency-and-compensation/resiliency_and_compensation/requirements.txt index 5910374c..bc8b8499 100644 --- a/tutorials/workflow/python/resiliency-and-compensation/resiliency_and_compensation/requirements.txt +++ b/tutorials/workflow/python/resiliency-and-compensation/resiliency_and_compensation/requirements.txt @@ -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 \ No newline at end of file diff --git a/tutorials/workflow/python/task-chaining/task_chaining/requirements.txt b/tutorials/workflow/python/task-chaining/task_chaining/requirements.txt index 5910374c..bc8b8499 100644 --- a/tutorials/workflow/python/task-chaining/task_chaining/requirements.txt +++ b/tutorials/workflow/python/task-chaining/task_chaining/requirements.txt @@ -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 \ No newline at end of file diff --git a/tutorials/workflow/python/workflow-management/workflow_management/requirements.txt b/tutorials/workflow/python/workflow-management/workflow_management/requirements.txt index 5910374c..bc8b8499 100644 --- a/tutorials/workflow/python/workflow-management/workflow_management/requirements.txt +++ b/tutorials/workflow/python/workflow-management/workflow_management/requirements.txt @@ -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 \ No newline at end of file diff --git a/workflows/java/sdk/order-processor/pom.xml b/workflows/java/sdk/order-processor/pom.xml index 4e8b8e56..7cf869c3 100644 --- a/workflows/java/sdk/order-processor/pom.xml +++ b/workflows/java/sdk/order-processor/pom.xml @@ -17,7 +17,7 @@ io.dapr dapr-sdk-workflows - 0.14.1 + 0.15.0 com.google.protobuf diff --git a/workflows/javascript/sdk/order-processor/orderProcessingWorkflow.ts b/workflows/javascript/sdk/order-processor/orderProcessingWorkflow.ts index ab40574b..d0866e13 100644 --- a/workflows/javascript/sdk/order-processor/orderProcessingWorkflow.ts +++ b/workflows/javascript/sdk/order-processor/orderProcessingWorkflow.ts @@ -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 = { diff --git a/workflows/python/sdk/order-processor/requirements.txt b/workflows/python/sdk/order-processor/requirements.txt index 348ac2d5..310eac94 100644 --- a/workflows/python/sdk/order-processor/requirements.txt +++ b/workflows/python/sdk/order-processor/requirements.txt @@ -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