Skip to content

Generate a Chat response

POST
/api/v4/chat/completions

Generates a response for a GitLab Duo Chat question.

Media type application/json
object
content
required

Prompt from user

string
nullable <= 1000 characters
resource_type

Resource type

string
nullable <= 100 characters
Allowed values: issue epic group project merge_request commit build work_item
resource_id
One of:
string
nullable
referer_url

Referer URL

string
nullable <= 1000 characters
client_subscription_id

Client Subscription ID

string
nullable <= 500 characters
with_clean_history

Indicates if we need to reset the history before and after the request

boolean
nullable
project_id

Project ID. Required if resource_type is a commit.

integer
nullable
current_file

Object that contains information about the current file

object
file_name

The name of the current file

string
nullable <= 1000 characters
content_above_cursor

The content above cursor

string
nullable <= 400000 characters
content_below_cursor

The content below cursor

string
nullable <= 400000 characters
selected_text

The content currently selected by the user

string
nullable <= 400000 characters
additional_context

List of additional context to be passed for the chat

Array<object>
nullable
object
category
required

Category of the additional context.

string
>= 1 characters
Allowed values: file snippet merge_request issue dependency local_git terminal user_rule repository directory agent_user_environment
id
required

ID of the additional context.

string
nullable <= 255 characters
content
required

Content of the additional context.

string
nullable <= 1000 characters
metadata

Metadata of the additional context.

object

Created

Bad Request