Create conversation title

Prev Next

Available in VPC

LLM generates titles for conversations with users.

Request

This section describes the request format. The method and URI are as follows:

Method URI
POST /api/v1/svc/{serviceId}/conversation-title

Request headers

For information about the headers common to all RAG APIs, see RAG request headers.

Request path parameters

The following describes the parameters.

Field Type Required Description
serviceId String Required Service's unique identifier

Request body

You can include the following data in the body of your request:

Field Type Required Description
serviceId String Required Service's unique identifier
messages Array Required Message list
  • Array of message objects representing the conversation history

messages

This is an array of messages that provide context for the conversation.

Field Type Required Description
role String Required Message role
  • user | assistant
    • user: user query
    • assistant: model response
content String Required Message content

Request example

The request example is as follows:

curl --location --request POST 'https://kr-pub-gateway.rag.naverncp.com/api/v1/svc/{serviceId}/conversation-title' \
--header 'Authorization: Bearer {apiKey}' \
--header 'Accept: text/event-stream' \
--data '{
  "serviceId": "{serviceId}",
  "messages": [
    {
      "role": "user",
      "content": "How can I use AI safely?"
    },
    {
      "role": "assistant",
      "content": "The following describes how to use AI safely:\n\n1. **Technical improvements**: Provide accurate and neutral data to ensure that AI systems are not trained with misinformation or bias, and continue research and development to improve the stability and reliability of the system.\n\n2. **Ethical guidelines and adherence**: Like NAVER, companies should create and adhere to their own AI ethics guidelines. For example, emphasize human-centered values and have an AI ethics consultation process so that all employees can consider and discuss ethical issues.\n\n3. **Education and training**: Educate those who use AI technology about its proper use and potential risks to help prevent over-reliance on AI and maintain decision-making control.\n\n4. **Implementation of safeguards**: Implement technical and policy safeguards where necessary to minimize the risks of AI systems, and deploy systems after a full risk assessment.\n\n5. **Collaboration with multiple stakeholders**: Work with academia, industry, and other stakeholders to build and share culturally relevant datasets to ensure the safe and effective use of AI in localized contexts.\n\nCollectively, these methods will lead to safer and more ethical use of AI."
    }
  ]
}'

Response stream

Server-Sent Events (SSE) provides real-time streaming responses. Each SSE message consists of the following format. (Events are separated by blank lines.)

event: [event_type]
data: [json_data]

The Create conversation title API supports four event types: ping, token, result, and error.

  • ping: Output data to prevent read timeouts while waiting before generating the answer (every second until the answer is generated).
  • token: Output the token of the answer being generated in real time.
  • result: Output the final answer.
  • error: Output when an error occurs during answer generation.

Response headers

The following describes the response headers.

Headers Required Description
Accept - Response data format
  • text/event-stream

Response body

The response body differs depending on the event type.

ping, token, result events

The following describes the ping, token, and result events.

Field Type Required Description
message Object - Message information
message.role String - Message role
  • assistant
message.content String - Currently generated tokens
message.totalContent String - All tokens generated so far
status String - Message status
  • IN_PROGRESS | COMPLETE
    • IN_PROGRESS: creating
    • COMPLETE: creation completed
references Array - Citation information
rateLimit String - API usage limit information (only included in result events)
rateLimit.limitRequests String - Request count limit
rateLimit.remainingRequests String - Remaining number of requests
rateLimit.resetRequests String - Request limit reset time (second)
rateLimit.limitTokens String - Token count limit
rateLimit.remainingTokens String - Remaining number of tokens
rateLimit.resetTokens String - Token limit reset time (second)
metadata String - Requested metadata (only included in result events)
metadata.chatModel String - LLM model
  • HyperClovaX
metadata.modelName String - HyperCLOVA X model version
  • HCX-003 | HCX-005 | HCX-DASH-001 | HCX-DASH-002
metadata.inputTokens Integer - Input token count
metadata.outputTokens Integer - Output token count
metadata.totalTokens Integer - Total token count

error event

The following describes the error events.

Field Type Required Description
code Integer Required API response status code
message String Required API response status message

Response status codes

For information about the HTTP status codes common to all RAG APIs, see RAG response status codes.

Response example

The response example is as follows:

event: ping
data: {
    "message": {
        "role": "assistant",
        "content": "",
        "totalContent": ""
    },
    "status": "IN_PROGRESS",
    "references": [],
    "rateLimit": null,
    "metadata": {}
}

...

event: token
data: {
    "message": {
        "role": "assistant",
        "content": " Safe",
        "totalContent": "\"Safe AI"
    },
    "status": "IN_PROGRESS",
    "references": [],
    "rateLimit": null,
    "metadata": {}
}

...

event: result
data: {
    "message": {
        "role": "assistant",
        "content": "\"Safe AI utilization\"",
        "totalContent": "\"Safe AI utilization\""
    },
    "status": "COMPLETE",
    "references": [],
    "rateLimit": {
        "limitRequests": null,
        "remainingRequests": null,
        "resetRequests": null,
        "limitTokens": "60000",
        "remainingTokens": "58824",
        "resetTokens": "41s"
    },
    "metadata": {
        "chatModel": "HyperClovaX",
        "modelName": "HCX-005",
        "inputTokens": 327,
        "outputTokens": 8,
        "totalTokens": 335
    }
}