Skip to content

Commit 2389eef

Browse files
Adds docs
Signed-off-by: Elena Kolevska <[email protected]>
1 parent 47db0d8 commit 2389eef

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

daprdocs/content/en/python-sdk-docs/python-client.md

+32
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,38 @@ if __name__ == '__main__':
381381
- For more information about pub/sub, visit [How-To: Publish & subscribe]({{< ref howto-publish-subscribe.md >}}).
382382
- Visit [Python SDK examples](https://github.com/dapr/python-sdk/tree/main/examples/pubsub-simple) for code samples and instructions to try out streaming pub/sub.
383383

384+
### Conversation (Alpha)
385+
386+
{{% alert title="Note" color="primary" %}}
387+
The Dapr Conversation API is currently in alpha.
388+
{{% /alert %}}
389+
390+
Since version 1.15 Dapr offers developers the capability to securely and reliably interact with Large Language Models (LLM) through the [Conversation API]({{< ref conversation-overview.md >}}).
391+
392+
```python
393+
from dapr.clients import DaprClient
394+
from dapr.clients.grpc._request import ConversationInput
395+
396+
with DaprClient() as d:
397+
inputs = [
398+
ConversationInput(message="What's Dapr?", role='user', scrub_pii=True),
399+
ConversationInput(message='Give a brief overview.', role='user', scrub_pii=True),
400+
]
401+
402+
metadata = {
403+
'model': 'foo',
404+
'key': 'authKey',
405+
'cacheTTL': '10m',
406+
}
407+
408+
response = d.converse_alpha1(
409+
name='echo', inputs=inputs, temperature=0.7, context_id='chat-123', metadata=metadata
410+
)
411+
412+
for output in response.outputs:
413+
print(f'Result: {output.result}')
414+
```
415+
384416
### Interact with output bindings
385417

386418
```python

0 commit comments

Comments
 (0)