Conversation API reference

Detailed documentation on the conversation API

Dapr provides an API to interact with Large Language Models (LLMs) and enables critical performance and security functionality with features like prompt caching and PII data obfuscation.

Converse

This endpoint lets you converse with LLMs.

POST http://localhost:<daprPort>/v1.0-alpha1/conversation/<llm-name>/converse

URL parameters

ParameterDescription
llm-nameThe name of the LLM component. See a list of all available conversation components.

Request body

FieldDescription
inputsInputs for the conversation. Multiple inputs at one time are supported. Required
cacheTTLA time-to-live value for a prompt cache to expire. Uses Golang duration format. Optional
scrubPIIA boolean value to enable obfuscation of sensitive information returning from the LLM. Optional
temperatureA float value to control the temperature of the model. Used to optimize for consistency and creativity. Optional
metadataMetadata passed to conversation components. Optional

Input body

FieldDescription
contentThe message content to send to the LLM. Required
roleThe role for the LLM to assume. Possible values: ‘user’, ’tool’, ‘assistant’
scrubPIIA boolean value to enable obfuscation of sensitive information present in the content field. Optional

Request content example

REQUEST = {
  "inputs": [
    {
      "content": "What is Dapr?",
      "role": "user", // Optional
      "scrubPII": "true", // Optional. Will obfuscate any sensitive information found in the content field
    },
  ],
  "cacheTTL": "10m", // Optional
  "scrubPII": "true", // Optional. Will obfuscate any sensitive information returning from the LLM
  "temperature": 0.5 // Optional. Optimizes for consistency (0) or creativity (1)
}

HTTP response codes

CodeDescription
202Accepted
400Request was malformed
500Request formatted correctly, error in Dapr code or underlying component

Response content

RESPONSE  = {
  "outputs": {
    {
       "result": "Dapr is distribution application runtime ...",
       "parameters": {},
    },
    {
       "result": "Dapr can help developers ...",
       "parameters": {},
    }
  },
}

Next steps


Last modified February 24, 2025: Update conversation api (#4546) (0b177ecc)