Brevia (0.1.0)

Download OpenAPI specification:Download

Extensible API and framework to build your Retrieval Augmented Generation (RAG) and Information Extraction (IE) applications with LLMs

Collections

Operations with Collections.

Collections Index

GET /collections endpoint, information on available collections

query Parameters
Name (string) or Name (null) (Name)

Responses

Response samples

Content type
application/json
null

Create Collection

POST /collections endpoint

header Parameters
content-type
required
string (Content-Type)
Request Body schema: application/json
required
name
required
string (Name)
cmetadata
required
object (Cmetadata)

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "cmetadata": { }
}

Response samples

Content type
application/json
null

Read Collection

GET /collections/{uuid} endpoint

path Parameters
uuid
required
string (Uuid)

Responses

Response samples

Content type
application/json
null

Update Collection

PATCH /collections endpoint

path Parameters
uuid
required
string (Uuid)
header Parameters
content-type
required
string (Content-Type)
Request Body schema: application/json
required
name
required
string (Name)
cmetadata
required
object (Cmetadata)

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "cmetadata": { }
}

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Delete Collection

DELETE /collections endpoint

path Parameters
uuid
required
string (Uuid)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Index

Manage documents index

Index Document

Add single document to collection index

header Parameters
content-type
required
string (Content-Type)
Request Body schema: application/json
required
content
required
string (Content)
collection_id
required
string (Collection Id)
document_id
required
string (Document Id)
metadata
object (Metadata)
Default: {}

Responses

Request samples

Content type
application/json
{
  • "content": "string",
  • "collection_id": "string",
  • "document_id": "string",
  • "metadata": { }
}

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Upload And Index

Upload a PDF file and perform index on a collection

Request Body schema: multipart/form-data
required
file
required
string <binary> (File)
collection_id
required
string (Collection Id)
document_id
required
string (Document Id)
Metadata (string) or Metadata (null) (Metadata)
Options (string) or Options (null) (Options)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Parse Link And Index

Add a web page content to a collection index

Request Body schema: application/json
required
link
required
string (Link)
collection_id
required
string (Collection Id)
document_id
required
string (Document Id)
metadata
object (Metadata)
Default: {}
options
object (Options)
Default: {}

Responses

Request samples

Content type
application/json
{
  • "link": "string",
  • "collection_id": "string",
  • "document_id": "string",
  • "metadata": { },
  • "options": { }
}

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Remove Document

Remove document from collection index

path Parameters
collection_id
required
string (Collection Id)
document_id
required
string (Document Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Read Document

Read single document from collection index

path Parameters
collection_id
required
string (Collection Id)
document_id
required
string (Document Id)

Responses

Response samples

Content type
application/json
null

Index Docs

Read collection documents with metadata filter

path Parameters
collection_id
required
string (Collection Id)
query Parameters
page
integer (Page)
Default: 1
page_size
integer (Page Size)
Default: 50

Responses

Response samples

Content type
application/json
null

Index Docs Metadata

Read collection documents metadata

path Parameters
collection_id
required
string (Collection Id)

Responses

Response samples

Content type
application/json
null

Search Documents

/search endpoint: Search the first {docs_num} relevant documents for a question

Specify distance_strategy: EUCLIDEAN = EmbeddingStore.embedding.l2_distance (default) COSINE = EmbeddingStore.embedding.cosine_distance MAX_INNER_PRODUCT = EmbeddingStore.embedding.max_inner_product

header Parameters
content-type
required
string (Content-Type)
Request Body schema: application/json
required
query
required
string (Query)
collection
required
string (Collection)
Docs Num (integer) or Docs Num (null) (Docs Num)
distance_strategy_name
string (Distance Strategy Name)
Default: "cosine"
Filter (object) or Filter (null) (Filter)

Responses

Request samples

Content type
application/json
{
  • "query": "string",
  • "collection": "string",
  • "docs_num": 0,
  • "distance_strategy_name": "cosine",
  • "filter": {
    }
}

Response samples

Content type
application/json
null

Chat

Chat on documents collections, retrieve chat history

Read Chat History

/chat_history endpoint, read stored chat history

query Parameters
Min Date (string) or Min Date (null) (Min Date)
Max Date (string) or Max Date (null) (Max Date)
Collection (string) or Collection (null) (Collection)
Session Id (string) or Session Id (null) (Session Id)
page
integer (Page)
Default: 1
page_size
integer (Page Size)
Default: 50

Responses

Response samples

Content type
application/json
null

Read Chat History Sessions

/chat_history sessions endpoint, read stored chat history sessions

query Parameters
Min Date (string) or Min Date (null) (Min Date)
Max Date (string) or Max Date (null) (Max Date)
Collection (string) or Collection (null) (Collection)
Session Id (string) or Session Id (null) (Session Id)
page
integer (Page)
Default: 1
page_size
integer (Page Size)
Default: 50

Responses

Response samples

Content type
application/json
null

Evluate Chat History

/evaluate endpoint, save chat history item user evaluation

header Parameters
content-type
required
string (Content-Type)
Request Body schema: application/json
required
uuid
required
string (Uuid)
user_evaluation
required
boolean (User Evaluation)
User Feedback (string) or User Feedback (null) (User Feedback)
Metadata (object) or Metadata (null) (Metadata)

Responses

Request samples

Content type
application/json
{
  • "uuid": "string",
  • "user_evaluation": true,
  • "user_feedback": "string",
  • "metadata": { }
}

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Chat Action

/chat endpoint, ask chatbot about a collection of documents

header Parameters
X-Chat-Session (string) or X-Chat-Session (null) (X-Chat-Session)
content-type
required
string (Content-Type)
Request Body schema: application/json
required
Docs Num (integer) or Docs Num (null) (Docs Num)
streaming
boolean (Streaming)
Default: false
Distance Strategy Name (string) or Distance Strategy Name (null) (Distance Strategy Name)
Filter (object) or Filter (null) (Filter)
source_docs
boolean (Source Docs)
Default: false
multiquery
boolean (Multiquery)
Default: false
question
required
string (Question)
collection
required
string (Collection)
chat_history
Array of any (Chat History)
Default: []
Chat Lang (string) or Chat Lang (null) (Chat Lang)
token_data
boolean (Token Data)
Default: false

Responses

Request samples

Content type
application/json
{
  • "docs_num": 0,
  • "streaming": false,
  • "distance_strategy_name": "string",
  • "filter": {
    },
  • "source_docs": false,
  • "multiquery": false,
  • "question": "string",
  • "collection": "string",
  • "chat_history": [ ],
  • "chat_lang": "string",
  • "token_data": false
}

Response samples

Content type
application/json
null

Chat Action Deprecated

/chat endpoint, ask chatbot about a collection of documents

header Parameters
X-Chat-Session (string) or X-Chat-Session (null) (X-Chat-Session)
content-type
required
string (Content-Type)
Request Body schema: application/json
required
Docs Num (integer) or Docs Num (null) (Docs Num)
streaming
boolean (Streaming)
Default: false
Distance Strategy Name (string) or Distance Strategy Name (null) (Distance Strategy Name)
Filter (object) or Filter (null) (Filter)
source_docs
boolean (Source Docs)
Default: false
multiquery
boolean (Multiquery)
Default: false
question
required
string (Question)
collection
required
string (Collection)
chat_history
Array of any (Chat History)
Default: []
Chat Lang (string) or Chat Lang (null) (Chat Lang)
token_data
boolean (Token Data)
Default: false

Responses

Request samples

Content type
application/json
{
  • "docs_num": 0,
  • "streaming": false,
  • "distance_strategy_name": "string",
  • "filter": {
    },
  • "source_docs": false,
  • "multiquery": false,
  • "question": "string",
  • "collection": "string",
  • "chat_history": [ ],
  • "chat_lang": "string",
  • "token_data": false
}

Response samples

Content type
application/json
null

Analysis

Document analisys, summarization, audio transcription

Summarize Text

/summarize endpoint: Summarize text and return a summary with algorithm selection and custom prompt options.

Args: summarize (SummarizeBody): An object representing the request data It contains the following parameters: text (str): The text to be summarized chain_type: The main langchain summarization chain type should be one of "stuff", "map_reduce", and "refine". if not providerd stuff is used by default initial_prompt: Optional custom prompt to be used in the selected langchain chain type to replace the main chain prompt defaults iteration_prompt: Optional custom prompts to be used in the selected langchain chain type to replace the second chain promopt defaults token_data (bool): A boolean indicating whether to include token-level data in the summary

Returns: JSON object representing the summary of the provided text

Raises: - HTTPException with status code 400 if the 'text' field is empty

With this endpoint, you can choose the summarization algorithm from those available in the Langchain library and customize the prompts according on the chosen algorithm

header Parameters
content-type
required
string (Content-Type)
Request Body schema: application/json
required
text
required
string (Text)
Chain Type (string) or Chain Type (null) (Chain Type)
Initial Prompt (object) or Initial Prompt (null) (Initial Prompt)
Iteration Prompt (object) or Iteration Prompt (null) (Iteration Prompt)
token_data
boolean (Token Data)
Default: false

Responses

Request samples

Content type
application/json
{
  • "text": "string",
  • "chain_type": "string",
  • "initial_prompt": { },
  • "iteration_prompt": { },
  • "token_data": false
}

Response samples

Content type
application/json
null

Upload Summarize

Upload a PDF file and perform summarization with algorithm selection and custom prompt options.

Args: background_tasks (BackgroundTasks): A background task manager for handling asynchronous tasks chain_type (str, optional): The main Langchain summarization chain type Should be one of "stuff", "map_reduce", or "refine" If not provided, 'stuff' is used by default initial_prompt (str, optional): Optional custom prompt as json string to be used in the selected Langchain chain type to replace the main chain prompt defaults iteration_prompt (str, optional): Optional custom prompt as json string to be used in the selected Langchain chain type to replace the second chain prompt defaults file (UploadFile | None): An uploaded PDF file to be summarized file_content (str, optional): Content of the PDF file provided as a base64-encoded string token_data (bool, optional): A boolean indicating whether to include token-level data in the summary payload (str, optional): Optional payload in JSON format to use in the async job service to add custom options and custom fields

Returns: A JSON object representing the job UUID for the asynchronous summarization task

Raises: HTTPException with status code 400 if either 'file' or 'file_content' form field is missing

With this endpoint, you can upload a PDF file for summarization, select a summarization algorithm from those available in the Langchain library, and customize the prompts according to your chosen algorithm

Request Body schema: multipart/form-data
chain_type
string (Chain Type)
Default: ""
initial_prompt
string (Initial Prompt)
Default: ""
iteration_prompt
string (Iteration Prompt)
Default: ""
File (string) or File (null) (File)
file_content
string (File Content)
Default: ""
token_data
boolean (Token Data)
Default: false
payload
string (Payload)
Default: "{}"

Responses

Response samples

Content type
application/json
null

Upload Analyze

Upload a file and perform some analysis using a service class

Request Body schema: multipart/form-data
required
file
required
string <binary> (File)
service
required
string (Service)
payload
string (Payload)
Default: "{}"

Responses

Response samples

Content type
application/json
null

Audio Transcriptions

/transcribe endpoint, audio file transcription

Request Body schema: multipart/form-data
required
file
required
string <binary> (File)
language
required
string (Language)

Responses

Response samples

Content type
application/json
null

Read Analysis Job

Read details of a single analisys Job via its UUID

path Parameters
uuid
required
string (Uuid)

Responses

Response samples

Content type
application/json
null

Status

API status

Api Status

/status endpoint, safety check

query Parameters
Token (string) or Token (null) (Token)
header Parameters
Authorization (string) or Authorization (null) (Authorization)

Responses

Response samples

Content type
application/json
null

Api Status

/status endpoint, safety check

query Parameters
Token (string) or Token (null) (Token)
header Parameters
Authorization (string) or Authorization (null) (Authorization)

Responses

Response samples

Content type
application/json
null

Index Metadata Document

Update metadata of a single document in a collection

header Parameters
content-type
required
string (Content-Type)
Request Body schema: application/json
required
collection_id
required
string (Collection Id)
document_id
required
string (Document Id)
metadata
object (Metadata)
Default: {}

Responses

Request samples

Content type
application/json
{
  • "collection_id": "string",
  • "document_id": "string",
  • "metadata": { }
}

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Completion Action

/completion endpoint, send a text with a custom prompt and get a completion

header Parameters
content-type
required
string (Content-Type)
Request Body schema: application/json
required
Prompt (object) or Prompt (null) (Prompt)
text
required
string (Text)
token_data
boolean (Token Data)
Default: false

Responses

Request samples

Content type
application/json
{
  • "prompt": { },
  • "text": "string",
  • "token_data": false
}

Response samples

Content type
application/json
null

Config

Get Config

/config endpoint, read Brevia configuration

Responses

Response samples

Content type
application/json
null

Get Config

/config endpoint, read Brevia configuration

Responses

Response samples

Content type
application/json
null

Save Config

POST /config endpoint, save Brevia configuration

header Parameters
content-type
required
string (Content-Type)
Request Body schema: application/json
required
object (Config)

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
null

Get Config Schema

/config/schema endpoint, read Brevia configuration settings keys

Responses

Response samples

Content type
application/json
null

Get Config Schema

/config/schema endpoint, read Brevia configuration settings keys

Responses

Response samples

Content type
application/json
null

Reset Config

POST /config/reset endpoint, reset to default a list of settings

header Parameters
content-type
required
string (Content-Type)
Request Body schema: application/json
required
Array
string

Responses

Request samples

Content type
application/json
[
  • "string"
]

Response samples

Content type
application/json
null