Public Endpoints

Inference

Generate text using an available LLM (Large Language Model).

SecurityBearerAuth
Request
Request Body schema: application/json
required
text
required
Array of strings (Text)
model
string (ModelNamespace)
Default: "mistralai/Mistral-7B-Instruct-v0.1"

Provide a namespace to our supported models.

Enum: "meta-llama/Llama-2-13b-chat-hf" "mistralai/Mistral-7B-Instruct-v0.1" "Trelis/Llama-2-7b-chat-hf-function-calling-v2" "openai/gpt-3.5-turbo" "openai/gpt-3.5-turbo-16k" "openai/gpt-4" "openai/gpt-4-32k"
bucket
string (Bucket)
openai_api_key
string (Openai Api Key)
max_tokens
integer (Max Tokens)
Default: 128
temperature
number (Temperature)
Default: 0.9
Responses
200

Successful Response

Response Schema: application/json
required
object (InferenceResponse)
answer
required
Array of strings (Answer)
422

Validation Error

Response Schema: application/json
Array of objects (Detail)
Array
required
Array of strings or integers (Location)
msg
required
string (Message)
type
required
string (Error Type)
post/ai/generate
Request samples
application/json
{
  • "text": [
    • "Hello, World!"
    ]
}
Response samples
application/json
{
  • "data": {
    • "answer": [
      • "string"
      ]
    }
}

Inference Stream

Generate text using an available LLM (Large Language Model) with streaming of tokens as they are generated. This allows for a faster response time and a better user experience overall as the user does not have to wait for the full output to complete before receiving a response.

SecurityBearerAuth
Request
Request Body schema: application/json
required
text
required
Array of strings (Text)
model
string (ModelNamespace)
Default: "mistralai/Mistral-7B-Instruct-v0.1"

Provide a namespace to our supported models.

Enum: "meta-llama/Llama-2-13b-chat-hf" "mistralai/Mistral-7B-Instruct-v0.1" "Trelis/Llama-2-7b-chat-hf-function-calling-v2" "openai/gpt-3.5-turbo" "openai/gpt-3.5-turbo-16k" "openai/gpt-4" "openai/gpt-4-32k"
bucket
string (Bucket)
openai_api_key
string (Openai Api Key)
max_tokens
integer (Max Tokens)
Default: 128
temperature
number (Temperature)
Default: 0.9
Responses
200

Successful Response

Response Schema: text/event-stream
required
object (InferenceStreamResponse)
token
string
422

Validation Error

Response Schema: application/json
Array of objects (Detail)
Array
required
Array of strings or integers (Location)
msg
required
string (Message)
type
required
string (Error Type)
post/ai/generate_stream
Request samples
application/json
{
  • "text": [
    • "Hello, World!"
    ]
}
Response samples
application/json
{
  • "detail": [
    • {
      • "loc": [
        • "string"
        ],
      • "msg": "string",
      • "type": "string"
      }
    ]
}

Summary

Summarize a bucket or a file.

SecurityBearerAuth
Request
Request Body schema: application/json
required
bucket
required
string (Bucket)
filename
string (Filename)
Responses
200

Successful Response

Response Schema: application/json
required
object (SummaryResponse)
summary
required
string (Summary)
422

Validation Error

Response Schema: application/json
Array of objects (Detail)
Array
required
Array of strings or integers (Location)
msg
required
string (Message)
type
required
string (Error Type)
post/ai/summarize
Request samples
application/json
{
  • "bucket": "string",
  • "filename": "string"
}
Response samples
application/json
{
  • "data": {
    • "summary": "string"
    }
}

Embedding Buckets

Get all embedding buckets for a user.

SecurityBearerAuth
Responses
200

Successful Response

Response Schema: application/json
required
object (UserEmbeddedBuckets)
buckets
required
Array of strings (Buckets)
422

Validation Error

Response Schema: application/json
Array of objects (Detail)
Array
required
Array of strings or integers (Location)
msg
required
string (Message)
type
required
string (Error Type)
get/ai/embeddings/buckets
Request samples
Response samples
application/json
{
  • "data": {
    • "buckets": [
      • "string"
      ]
    }
}

Embedding

Perform embedding on a Telnyx Storage Bucket using the a embedding model. The current supported file types are:

  • PDF
  • HTML
  • txt/unstructured text files
  • json
  • csv
  • audio / video (mp3, mp4, mpeg, mpga, m4a, wav, or webm ) - Max of 20mb file size.

Any files not matching the above types will be attempted to be embedded as unstructured text.

This process can be slow, so it runs in the background and the user can check the status of the task using the endpoint /embedding/{task_id}.

You can also specify a custom loader param. Currently the only supported loader value is intercom which loads Intercom article jsons as specified by the Intercom article API This loader will split each article into paragraphs and save additional parameters relevant to Intercom docs, such as article_url and heading. These values will be returned by the /v2/ai/embeddings/similarity-search endpoint in the loader_metadata field.

SecurityBearerAuth
Request
Request Body schema: application/json
required
bucket_name
required
string (Bucket Name)
document_chunk_size
integer (Document Chunk Size)
Default: 1024
document_chunk_overlap_size
integer (Document Chunk Overlap Size)
Default: 512
embedding_model
string (SupportedEmbeddingModels)
Default: "thenlper/gte-large"

An enumeration.

Enum: "thenlper/gte-large" "intfloat/multilingual-e5-large" "sentence-transformers/all-mpnet-base-v2"
Responses
200

Successful Response

Response Schema: application/json
required
object
task_id
string <uuid> (Task ID)
task_name
string (Task Name)
status
string (Status)
created_at
string (Created At)
finished_at
string or null (Finished At)
user_id
string <uuid> (User ID)
422

Validation Error

Response Schema: application/json
Array of objects (Detail)
Array
required
Array of strings or integers (Location)
msg
required
string (Message)
type
required
string (Error Type)
post/ai/embeddings
Request samples
application/json
{
  • "bucket_name": "string",
  • "document_chunk_size": 1024,
  • "document_chunk_overlap_size": 512,
  • "embedding_model": "thenlper/gte-large"
}
Response samples
application/json
{
  • "data": {
    • "task_id": "736fde4d-9029-4915-8189-01353d6982cb",
    • "task_name": "string",
    • "status": "string",
    • "created_at": "string",
    • "finished_at": "string",
    • "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
    }
}

Embedding Task

Check the status of a current embedding task. Will be one of the following:

  • queued - Task is waiting to be picked up by a worker
  • processing - The embedding task is running
  • success - Task completed successfully and the bucket is embedded
  • failure - Task failed and no files were embedded successfully
  • partial_success - Some files were embedded successfully, but at least one failed
SecurityBearerAuth
Request
path Parameters
task_id
required
string (Task Id)
Responses
200

Successful Response

Response Schema: application/json
required
object
task_id
string <uuid> (Task ID)
task_name
string (Task Name)
status
string (Status)
created_at
string (Created At)
finished_at
string (Finished At)
422

Validation Error

Response Schema: application/json
Array of objects (Detail)
Array
required
Array of strings or integers (Location)
msg
required
string (Message)
type
required
string (Error Type)
get/ai/embeddings/{task_id}
Request samples
Response samples
application/json
{
  • "data": {
    • "task_id": "736fde4d-9029-4915-8189-01353d6982cb",
    • "task_name": "string",
    • "status": "string",
    • "created_at": "string",
    • "finished_at": "string"
    }
}

Embedding Bucket Files

Get all embedded files for a given user bucket, including their processing status.

SecurityBearerAuth
Request
path Parameters
bucket_name
required
string (Bucket Name)
Responses
200

Successful Response

Response Schema: application/json
required
Array of objects (Data)
Array
filename
required
string (Filename)
status
required
string (Status)
created_at
required
string <date-time> (Created At)
updated_at
string <date-time> (Updated At)
last_embedded_at
string <date-time> (Last Embedded At)
error_reason
string (Error Reason)
422

Validation Error

Response Schema: application/json
Array of objects (Detail)
Array
required
Array of strings or integers (Location)
msg
required
string (Message)
type
required
string (Error Type)
get/ai/embeddings/buckets/{bucket_name}
Request samples
Response samples
application/json
{
  • "data": [
    • {
      • "filename": "string",
      • "status": "string",
      • "created_at": "2019-08-24T14:15:22Z",
      • "updated_at": "2019-08-24T14:15:22Z",
      • "last_embedded_at": "2019-08-24T14:15:22Z",
      • "error_reason": "string"
      }
    ]
}

Similarity Search

Perform a similarity search on a Telnyx Storage Bucket, returning the most similar num_docs document chunks to the query.

Currently the only available distance metric is cosine similarity which will return a distance between 0 and 1. The lower the distance, the more similar the returned document chunks are to the query. A certainty will also be returned, which is a value between 0 and 1 where the higher the certainty, the more similar the document. You can read more about Weaviate distance metrics here: Weaviate Docs

If a bucket was embedded using a custom loader, such as intercom, the additional metadata will be returned in the loader_metadata field.

SecurityBearerAuth
Request
Request Body schema: application/json
required
bucket_name
required
string (Bucket Name)
query
required
string (Query)
num_of_docs
integer (Num Of Docs)
Default: 3
Responses
200

Successful Response

Response Schema: application/json
required
Array of objects (Data)
Array
document_chunk
required
string (Document Chunk)
distance
required
number (Distance)
required
object (EmbeddingMetadata)
422

Validation Error

Response Schema: application/json
Array of objects (Detail)
Array
required
Array of strings or integers (Location)
msg
required
string (Message)
type
required
string (Error Type)
post/ai/embeddings/similarity-search
Request samples
application/json
{
  • "bucket_name": "string",
  • "query": "string",
  • "num_of_docs": 3
}
Response samples
application/json
{
  • "data": [
    • {
      • "document_chunk": "string",
      • "distance": 0,
      • "metadata": {
        • "source": "string",
        • "checksum": "string",
        • "embedding": "string",
        • "filename": "string",
        • "certainty": 0,
        • "loader_metadata": { }
        }
      }
    ]
}