Перейти к содержимому

Generate Document

POST
/v1/documents/generate
curl --request POST \
--url https://api.cloud.agentums.ru/v1/documents/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "kind": "doc", "prompt": "example", "title": "", "to": "docx" }'

Сгенерировать документ по запросу (docx по умолчанию, либо pdf).

Ставит Celery-задачу docgen.run; результат появится НОВЫМ объектом-файлом, когда обработается (опрос /documents/status). Неизвестный формат → docx.

Media typeapplication/json
DocGenRequest

Запрос на генерацию документа. kind — тип по смыслу (letter/report/contract/memo/doc); to — формат результата (docx по умолчанию или pdf); title — заголовок (опц.).

object
kind
Kind
string
default: doc <= 20 characters
prompt
required
Prompt
string
>= 1 characters <= 4000 characters
title
Title
string
"" <= 255 characters
to
To
string
default: docx <= 8 characters

Successful Response

Media typeapplication/json
DocGenAccepted

Генерация принята: результат появится НОВЫМ объектом (Celery). task_id — для опроса /documents/status.

object
status
Status
string
default: accepted
task_id
Any of:
string
to
To
string
default: docx
Example
{
"status": "accepted",
"to": "docx"
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
ctx
Context
object
input
Input
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{
"detail": [
{
"ctx": {},
"input": "example",
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}