POST
/
v1
/
chat
/
completions
curl --request POST \
  --url https://premai.io/v1/chat/completions \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "project_id": 123,
  "session_id": "<string>",
  "repositories": {
    "ids": [
      123
    ],
    "limit": 3,
    "similarity_threshold": 0.5
  },
  "messages": [
    {
      "role": "user",
      "content": "<string>"
    }
  ],
  "model": "<string>",
  "system_prompt": "<string>",
  "frequency_penalty": 2,
  "logit_bias": {},
  "max_tokens": 1,
  "presence_penalty": 0,
  "response_format": {},
  "seed": 123,
  "stop": "<string>",
  "stream": true,
  "temperature": 1,
  "top_p": 123,
  "tools": [
    {}
  ],
  "user": "<string>"
}'
{
  "choices": [
    {
      "index": 123,
      "message": {
        "role": "user",
        "content": "<string>"
      },
      "finish_reason": "<string>"
    }
  ],
  "created": 123,
  "model": "<string>",
  "provider_name": "<string>",
  "provider_id": "<string>",
  "document_chunks": [
    {
      "repository_id": 123,
      "document_id": 123,
      "chunk_id": 123,
      "document_name": "<string>",
      "similarity_score": 123,
      "content": "<string>"
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  },
  "trace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}

Authorizations

Authorization
string
header
required

Body

Response

200
application/json

The response is of type object.