Skip to main content
POST
/
completions
Python
from qaip import Qaip

client = Qaip(
    api_key="My API Key",
)
response = client.completion(
    messages=[{
        "content": "content",
        "role": "user",
    }],
)
print(response.choices)
{
  "created": 1677649420,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop",
      "citations": [
        {
          "url": "<string>",
          "text": "<string>",
          "file_type": "html",
          "page_number": 0
        }
      ]
    }
  ]
}

Authorizations

x-api-key
string
header
required

API key for authentication

Body

application/json
messages
object[]
required

The messages to generate completion for

stream
boolean
default:false

Whether to stream the response. If true, the response is sent as a stream using the 'text/plain' content type.

citation
boolean
default:true

Whether to include citations in the response

tags
string[]

target tag names to be obtained

tag_ids
string[]

target tag IDs to be obtained

source_types
enum<string>[]

The type of the source

Available options:
crawl,
local_file,
google_drive,
github,
notion
file_types
enum<string>[]

The type of the source file

Available options:
html,
pdf,
ppt,
pptx,
pptm,
doc,
docx,
docm,
xls,
xlsx,
xlsm,
md,
txt,
notion_page
date_from
integer

Start date for content search (Unix timestamp in seconds)

Required range: x >= 1735639200
date_to
integer

End date for content search (Unix timestamp in seconds)

Required range: x >= 1735639200
domains
string[]

Array of domains to search within (supports partial matching)

Response

Successful completion. If the 'stream' parameter is false, the response is returned as application/json. If the 'stream' parameter is true, the response is returned as a stream of plain text (text/plain), where each chunk is a plain text line containing a JSON object.

created
integer
required

The Unix timestamp (in seconds) of when the completion was created

Example:

1677649420

choices
object[]
required

The completion choices generated by the model