All URIs are relative to https://api.telnyx.com/v2
Method | HTTP request | Description |
---|---|---|
embeddingBucketFilesPublicEmbeddingBucketsBucketNameDelete | DELETE /ai/embeddings/buckets/{bucket_name} | Disable AI for an Embedded Bucket |
getBucketName | GET /ai/embeddings/buckets/{bucket_name} | Get file-level embedding statuses for a bucket |
getEmbeddingBuckets | GET /ai/embeddings/buckets | List embedded buckets |
getEmbeddingTask | GET /ai/embeddings/{task_id} | Get an embedding task's status |
postEmbedding | POST /ai/embeddings | Embed documents |
postEmbeddingSimilaritySearch | POST /ai/embeddings/similarity-search | Search for documents |
embeddingBucketFilesPublicEmbeddingBucketsBucketNameDelete(bucketName)
Disable AI for an Embedded Bucket
Deletes an entire bucket's embeddings and disables the bucket for AI-use, returning it to normal storage pricing.
// Import classes:
import com.telnyx.sdk.ApiClient;
import com.telnyx.sdk.ApiException;
import com.telnyx.sdk.Configuration;
import com.telnyx.sdk.auth.*;
import com.telnyx.sdk.model.*;
import com.telnyx.sdk.api.EmbeddingsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.telnyx.com/v2");
// Configure HTTP bearer authorization: bearerAuth
HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
bearerAuth.setBearerToken("BEARER TOKEN");
EmbeddingsApi apiInstance = new EmbeddingsApi(defaultClient);
String bucketName = "bucketName_example"; // String |
try {
apiInstance.embeddingBucketFilesPublicEmbeddingBucketsBucketNameDelete(bucketName);
} catch (ApiException e) {
System.err.println("Exception when calling EmbeddingsApi#embeddingBucketFilesPublicEmbeddingBucketsBucketNameDelete");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
bucketName | String |
null (empty response body)
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Bucket Embeddings Deleted Successfully | - |
404 | Bucket Not Found | - |
422 | Validation Error | - |
EmbeddingsBucketFilesData getBucketName(bucketName)
Get file-level embedding statuses for a bucket
Get all embedded files for a given user bucket, including their processing status.
// Import classes:
import com.telnyx.sdk.ApiClient;
import com.telnyx.sdk.ApiException;
import com.telnyx.sdk.Configuration;
import com.telnyx.sdk.auth.*;
import com.telnyx.sdk.model.*;
import com.telnyx.sdk.api.EmbeddingsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.telnyx.com/v2");
// Configure HTTP bearer authorization: bearerAuth
HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
bearerAuth.setBearerToken("BEARER TOKEN");
EmbeddingsApi apiInstance = new EmbeddingsApi(defaultClient);
String bucketName = "bucketName_example"; // String |
try {
EmbeddingsBucketFilesData result = apiInstance.getBucketName(bucketName);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling EmbeddingsApi#getBucketName");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
bucketName | String |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successful Response | - |
422 | Validation Error | - |
UserEmbeddedBucketsData getEmbeddingBuckets()
List embedded buckets
Get all embedding buckets for a user.
// Import classes:
import com.telnyx.sdk.ApiClient;
import com.telnyx.sdk.ApiException;
import com.telnyx.sdk.Configuration;
import com.telnyx.sdk.auth.*;
import com.telnyx.sdk.model.*;
import com.telnyx.sdk.api.EmbeddingsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.telnyx.com/v2");
// Configure HTTP bearer authorization: bearerAuth
HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
bearerAuth.setBearerToken("BEARER TOKEN");
EmbeddingsApi apiInstance = new EmbeddingsApi(defaultClient);
try {
UserEmbeddedBucketsData result = apiInstance.getEmbeddingBuckets();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling EmbeddingsApi#getEmbeddingBuckets");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successful Response | - |
422 | Validation Error | - |
TaskStatusResponse getEmbeddingTask(taskId)
Get an embedding task's status
Check the status of a current embedding task. Will be one of the following:
queued
- Task is waiting to be picked up by a workerprocessing
- The embedding task is runningsuccess
- Task completed successfully and the bucket is embeddedfailure
- Task failed and no files were embedded successfullypartial_success
- Some files were embedded successfully, but at least one failed
// Import classes:
import com.telnyx.sdk.ApiClient;
import com.telnyx.sdk.ApiException;
import com.telnyx.sdk.Configuration;
import com.telnyx.sdk.auth.*;
import com.telnyx.sdk.model.*;
import com.telnyx.sdk.api.EmbeddingsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.telnyx.com/v2");
// Configure HTTP bearer authorization: bearerAuth
HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
bearerAuth.setBearerToken("BEARER TOKEN");
EmbeddingsApi apiInstance = new EmbeddingsApi(defaultClient);
String taskId = "taskId_example"; // String |
try {
TaskStatusResponse result = apiInstance.getEmbeddingTask(taskId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling EmbeddingsApi#getEmbeddingTask");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
taskId | String |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successful Response | - |
422 | Validation Error | - |
EmbeddingResponse postEmbedding(embeddingBucketRequest)
Embed documents
Perform embedding on a Telnyx Storage Bucket using the a embedding model. The current supported file types are:
- HTML
- txt/unstructured text files
- json
- csv
- audio / video (mp3, mp4, mpeg, mpga, m4a, wav, or webm ) - Max of 100mb 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 /ai/embeddings/{task_id}
.
Important Note: When you update documents in a Telnyx Storage bucket, their associated embeddings are automatically kept up to date. If you add or update a file, it is automatically embedded. If you delete a file, the embeddings are deleted for that particular file.
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.
// Import classes:
import com.telnyx.sdk.ApiClient;
import com.telnyx.sdk.ApiException;
import com.telnyx.sdk.Configuration;
import com.telnyx.sdk.auth.*;
import com.telnyx.sdk.model.*;
import com.telnyx.sdk.api.EmbeddingsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.telnyx.com/v2");
// Configure HTTP bearer authorization: bearerAuth
HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
bearerAuth.setBearerToken("BEARER TOKEN");
EmbeddingsApi apiInstance = new EmbeddingsApi(defaultClient);
EmbeddingBucketRequest embeddingBucketRequest = new EmbeddingBucketRequest(); // EmbeddingBucketRequest |
try {
EmbeddingResponse result = apiInstance.postEmbedding(embeddingBucketRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling EmbeddingsApi#postEmbedding");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
embeddingBucketRequest | EmbeddingBucketRequest |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successful Response | - |
422 | Validation Error | - |
EmbeddingSimilaritySearchResponse postEmbeddingSimilaritySearch(embeddingSimilaritySearchRequest)
Search for documents
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.
// Import classes:
import com.telnyx.sdk.ApiClient;
import com.telnyx.sdk.ApiException;
import com.telnyx.sdk.Configuration;
import com.telnyx.sdk.auth.*;
import com.telnyx.sdk.model.*;
import com.telnyx.sdk.api.EmbeddingsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.telnyx.com/v2");
// Configure HTTP bearer authorization: bearerAuth
HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
bearerAuth.setBearerToken("BEARER TOKEN");
EmbeddingsApi apiInstance = new EmbeddingsApi(defaultClient);
EmbeddingSimilaritySearchRequest embeddingSimilaritySearchRequest = new EmbeddingSimilaritySearchRequest(); // EmbeddingSimilaritySearchRequest |
try {
EmbeddingSimilaritySearchResponse result = apiInstance.postEmbeddingSimilaritySearch(embeddingSimilaritySearchRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling EmbeddingsApi#postEmbeddingSimilaritySearch");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
embeddingSimilaritySearchRequest | EmbeddingSimilaritySearchRequest |
EmbeddingSimilaritySearchResponse
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successful Response | - |
422 | Validation Error | - |