---
title: "Generate a response for the provided conversation messages"
method: POST
path: "/ai/v1/complete"
tags: ["Conversation"]
---

# Generate a response for the provided conversation messages

`POST /ai/v1/complete`

## Request

- Base URL: `https://.clinia.cloud`
- URL: `https://.clinia.cloud/ai/v1/complete`
- Auth: API key in header `X-Clinia-API-Key`

Generate a response for the provided conversation messages.
This is similar to the `AppendConversationMessage` endpoint, but is stateless;
it does not require a conversation ID and does not store the conversation history.

## Request body

- object
  - `agent` 'medical-librarian', required
  - `tools` V1ToolsConfig
    - `data-partition-retriever` V1DataPartitionRetrieverToolConfig
      - `partitions` V1DataPartitionRetrievalConfig[], required
        - `key` string, required: The key of the data partition.
        - `description` string, required: The description of the data partition. This will be used to give more details to the agent.
  - `messages` V1Message[], required
    - union
      - V1UserMessage
        - `role` 'user' | 'assistant', required
        - `id` string
        - `content` string, required: The content of the message. This should only be set when the message is created. It will never be returned by the API.
        - `parts` V1MessagePart[]
          - union
            - V1MessagePartText
              - …
            - V1MessagePartToolCall
              - …
      - V1AssistantMessage
        - `role` 'user' | 'assistant', required
        - `id` string, required
        - `parts` V1MessagePart[], required
          - union
            - V1MessagePartText
              - …
            - V1MessagePartToolCall
              - …

## Response `201`

A successful response.

- V1Message[]: The list of new messages added to the conversation. This will only include the assistant message.
  - union
    - V1UserMessage
      - `role` 'user' | 'assistant', required
      - `id` string
      - `content` string, required: The content of the message. This should only be set when the message is created. It will never be returned by the API.
      - `parts` V1MessagePart[]
        - union
          - V1MessagePartText
            - `type` 'text' | 'object' | 'tool-call', required
            - `text` string, required: The content of the message.
          - V1MessagePartToolCall
            - `type` 'text' | 'object' | 'tool-call', required
            - `toolCall` object
              - …
    - V1AssistantMessage
      - `role` 'user' | 'assistant', required
      - `id` string, required
      - `parts` V1MessagePart[], required
        - union
          - V1MessagePartText
            - `type` 'text' | 'object' | 'tool-call', required
            - `text` string, required: The content of the message.
          - V1MessagePartToolCall
            - `type` 'text' | 'object' | 'tool-call', required
            - `toolCall` object
              - …

## Other responses

- `400`: Returned when the request is malformed or invalid.
- `404`: Returned when the conversation does not exist.
- `413`: Returned when the payload exceeds the max content size (100kB).

---

[API](https://skmtc.dev/clinia/apis/ai-api.md) - [All operations](https://skmtc.dev/clinia/apis/ai-api/llms.txt) - [OpenAPI document](https://skmtc.dev/clinia/apis/ai-api/revisions/caf49145c239?raw)
