Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Conversation API] initial docs setup #4419

Open
wants to merge 17 commits into
base: v1.15
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions daprdocs/content/en/concepts/building-blocks-concept.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ Dapr provides the following building blocks:
| [**Distributed lock**]({{< ref "distributed-lock-api-overview.md" >}}) | `/v1.0-alpha1/lock` | The distributed lock API enables you to take a lock on a resource so that multiple instances of an application can access the resource without conflicts and provide consistency guarantees.
| [**Cryptography**]({{< ref "cryptography-overview.md" >}}) | `/v1.0-alpha1/crypto` | The Cryptography API enables you to perform cryptographic operations, such as encrypting and decrypting messages, without exposing keys to your application.
| [**Jobs**]({{< ref "jobs-overview.md" >}}) | `/v1.0-alpha1/jobs` | The Jobs API enables you to schedule and orchestrate jobs. Example scenarios include: <ul><li>Schedule batch processing jobs to run every business day</li><li>Schedule various maintenance scripts to perform clean-ups</li><li>Schedule ETL jobs to run at specific times (hourly, daily) to fetch new data, process it, and update the data warehouse with the latest information.</li></ul>
| [**Conversation**]({{< ref "conversation-overview.md" >}}) | `/v1.0-alpha1/conversation` | The Conversation API provides a common way to converse with different large language model providers.
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 7 additions & 0 deletions daprdocs/content/en/concepts/components-concept.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,10 @@ Dapr allows custom [middleware]({{< ref "middleware.md" >}}) to be plugged into
{{% alert title="Note" color="primary" %}}
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved
Since pluggable components are not required to be written in Go, they follow a different implementation process than built-in Dapr components. For more information on developing built-in components, read [developing new components](https://github.com/dapr/components-contrib/blob/master/docs/developing-component.md).
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved
{{% /alert %}}

### Conversation
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved

Dapr provides a way for developers to migrate and converse between different large language model servers and toolkits.
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved

- [List of supported conversation components]({{< ref supported-conversation >}})
- [Conversation implementations](https://github.com/dapr/components-contrib/tree/main/conversation)
1 change: 1 addition & 0 deletions daprdocs/content/en/concepts/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Each of these building block APIs is independent, meaning that you can use any n
| [**Distributed lock**]({{< ref "distributed-lock-api-overview.md" >}}) | The distributed lock API enables your application to acquire a lock for any resource that gives it exclusive access until either the lock is released by the application, or a lease timeout occurs.
| [**Cryptography**]({{< ref "cryptography-overview.md" >}}) | The cryptography API provides an abstraction layer on top of security infrastructure such as key vaults. It contains APIs that allow you to perform cryptographic operations, such as encrypting and decrypting messages, without exposing keys to your applications.
| [**Jobs**]({{< ref "jobs-overview.md" >}}) | The jobs API enables you to schedule jobs at specific times or intervals.
| [**Conversation**]({{< ref "conversation-overview.md" >}}) | The conversation API enables you to migrate between large language model servers and toolkits.
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved

### Cross-cutting APIs

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
type: docs
title: "Conversation"
linkTitle: "Conversation"
weight: 130
description: "Consistently leverage Large Language Models services"
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
type: docs
title: "Conversation overview"
linkTitle: "Overview"
weight: 1000
description: "Overview of the conversation API building block"
---

Using the Dapr conversation API you can reduce the complexity of interacting with LLMS and enable critical security and reliability functionality with out-of-the-box features like prompt caching and PII data obfuscation.
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved

## Features

hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved

## Try out pub/sub
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved

### Quickstarts and tutorials

Want to put the Dapr conversation API to the test? Walk through the following quickstart and tutorials to see it in action:

| Quickstart/tutorial | Description |
| ------------------- | ----------- |
| [Conversation quickstart](todo) | . |

### Start using pub/sub directly in your app

Want to skip the quickstarts? Not a problem. You can try out the conversation building block directly in your application. After [Dapr is installed]({{< ref "getting-started/_index.md" >}}), you can begin using the conversation API starting with [the how-to guide](todo).

## Next steps

- [How-To: Migrate between large language models]({{< ref howto-conversation-layer.md >}})
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved
- [Conversation API components]({{< ref supported-conversation >}})
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
type: docs
title: "How-To: Migrate using the conversation API"
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved
linkTitle: "How-To: Migrate"
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved
weight: 2000
description: "Learn how to use the conversation API to migrate between large language model servers and toolkits"
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved
---

todo
63 changes: 63 additions & 0 deletions daprdocs/content/en/reference/api/conversation_api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
type: docs
title: "Conversation API reference"
linkTitle: "Conversation API"
description: "Detailed documentation on the conversation API"
weight: 1400
---

Dapr provides users with an abstraction layer to reduce the complexity of interacting with LLMS using either a new runtime method or HTTP endpoint.
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved

## Converse

This endpoint lets you converse with LLMs.

```
POST /v1.0/conversation/[component]/converse
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved
```

### URL parameters

| Parameter | Description |
| --------- | ----------- |
| `component` | The name of the component you're using. [See a list of all available Conversation components]({{< ref supported-conversation >}})
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add Request Body fields into a table like this https://docs.dapr.io/reference/api/state_api/#request-body

conversationContext  - The conversation context to provide to the LLM
prompt  - The conversation prompt to provide to the LLM

The "inputs" name below should be replace with "prompt"

### Request content

```json
REQUEST = {
"conversationContext": "ID of an existing chat room",
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved
"inputs": ["what is Dapr", "Why use Dapr"],
"parameters": {},
}
```

### HTTP response codes

Code | Description
---- | -----------
`202` | Accepted
`400` | Request was malformed
`500` | Request formatted correctly, error in dapr code or underlying component

### Response content

```json
RESPONSE = {
"conversationContext": "ID of an existing chat room",
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved
"outputs": {
{
"result": "Dapr is distribution application runtime ...",
"parameters": {},
},
{
"result": "Dapr can help developers ...",
"parameters": {},
}
},
}
```

## Next steps

[Conversation API overview]({{< ref conversation-overview.md >}})
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
type: docs
title: "Conversation component specs"
linkTitle: "Conversation"
weight: 9000
description: The supported conversation components that interface with Dapr
no_list: true
---

{{< partial "components/description.html" >}}

{{< partial "components/conversation.html" >}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
type: docs
title: "Anthropic"
linkTitle: "Anthropic"
description: Detailed information on the Anthropic conversation component
---

## Component format

A Dapr `conversation.yaml` component file has the following structure:

```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: anthropic
spec:
type: conversation.anthropic
metadata:
- name: key
value: "mykey"
- name: model
value: claude-3-5-sonnet-20240620
- name: cacheTTL
value: 10m
```

{{% alert title="Warning" color="warning" %}}
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets, as described [here]({{< ref component-secrets.md >}}).
{{% /alert %}}

## Spec metadata fields

| Field | Required | Details | Example |
|--------------------|:--------:|---------|---------|
| `key` | Y | API key for Anthropic. | `"mykey"` |
| `model` | N | The Anthropic LLM to use. Defaults to `claude-3-5-sonnet-20240620` | `claude-3-5-sonnet-20240620` |
| `cacheTTL` | N | A time-to-live value for a prompt cache to expire. Uses Golang duration format. | `10m` |

## Related links

- [Conversation API overview]({{< ref conversation-overview.md >}})
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
type: docs
title: "AWS Bedrock"
linkTitle: "AWS Bedrock"
description: Detailed information on the AWS Bedrock conversation component
---

## Component format

A Dapr `conversation.yaml` component file has the following structure:

```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: awsbedrock
spec:
type: conversation.aws.bedrock
metadata:
- name: endpoint
value: "http://localhost:4566"
- name: model
value: amazon.titan-text-express-v1
- name: cacheTTL
value: 10m
```

{{% alert title="Warning" color="warning" %}}
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets, as described [here]({{< ref component-secrets.md >}}).
{{% /alert %}}

## Spec metadata fields

| Field | Required | Details | Example |
|--------------------|:--------:|---------|---------|
| `endpoint` | N | AWS endpoint for the component to use and connect to emulators. Not recommended for production AWS use. | `http://localhost:4566` |
| `model` | N | The LLM to use. Defaults to Bedrock's default provider model from Amazon. | `amazon.titan-text-express-v1` |
| `cacheTTL` | N | A time-to-live value for a prompt cache to expire. Uses Golang duration format. | `10m` |

## Related links

- [Conversation API overview]({{< ref conversation-overview.md >}})
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
type: docs
title: "Huggingface"
linkTitle: "Huggingface"
description: Detailed information on the Huggingface conversation component
---

## Component format

A Dapr `conversation.yaml` component file has the following structure:

```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: huggingface
spec:
type: conversation.huggingface
metadata:
- name: key
value: mykey
- name: model
value: meta-llama/Meta-Llama-3-8B
- name: cacheTTL
value: 10m
```

{{% alert title="Warning" color="warning" %}}
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets, as described [here]({{< ref component-secrets.md >}}).
{{% /alert %}}

## Spec metadata fields

| Field | Required | Details | Example |
|--------------------|:--------:|---------|---------|
| `key` | Y | API key for Huggingface. | `mykey` |
| `model` | N | The Huggingface LLM to use. Defaults to `meta-llama/Meta-Llama-3-8B`. | `meta-llama/Meta-Llama-3-8B` |
| `cacheTTL` | N | A time-to-live value for a prompt cache to expire. Uses Golang duration format. | `10m` |

## Related links

- [Conversation API overview]({{< ref conversation-overview.md >}})
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
type: docs
title: "Mistral"
linkTitle: "Mistral"
description: Detailed information on the Mistral conversation component
---

## Component format

A Dapr `conversation.yaml` component file has the following structure:

```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: mistral
spec:
type: conversation.mistral
metadata:
- name: key
value: mykey
- name: model
value: open-mistral-7b
- name: cacheTTL
value: 10m
```

{{% alert title="Warning" color="warning" %}}
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets, as described [here]({{< ref component-secrets.md >}}).
{{% /alert %}}

## Spec metadata fields

| Field | Required | Details | Example |
|--------------------|:--------:|---------|---------|
| `key` | Y | API key for Mistral. | `mykey` |
| `model` | N | The Mistral LLM to use. Defaults to `open-mistral-7b`. | `open-mistral-7b` |
| `cacheTTL` | N | A time-to-live value for a prompt cache to expire. Uses Golang duration format. | `10m` |

## Related links

- [Conversation API overview]({{< ref conversation-overview.md >}})
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
type: docs
title: "OpenAI"
linkTitle: "OpenAI"
description: Detailed information on the OpenAI conversation component
---

## Component format

A Dapr `conversation.yaml` component file has the following structure:

```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: openai
spec:
type: conversation.openai
metadata:
- name: key
value: mykey
- name: model
value: gpt-4-turbo
- name: cacheTTL
value: 10m
```

{{% alert title="Warning" color="warning" %}}
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets, as described [here]({{< ref component-secrets.md >}}).
{{% /alert %}}

## Spec metadata fields

| Field | Required | Details | Example |
|--------------------|:--------:|---------|---------|
| `key` | Y | API key for OpenAI. | `mykey` |
| `model` | N | The OpenAI LLM to use. Defaults to `gpt-4-turbo`. | `gpt-4-turbo` |
| `cacheTTL` | N | A time-to-live value for a prompt cache to expire. Uses Golang duration format. | `10m` |

## Related links

- [Conversation API overview]({{< ref conversation-overview.md >}})
5 changes: 5 additions & 0 deletions daprdocs/data/components/conversation/aws.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- component: AWS Bedrock
link: aws-bedrock
state: Alpha
version: v1
since: "1.15"
Loading
Loading