Skip to main content
POST
/
ai
/
clusters
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});

const response = await client.ai.clusters.compute({ bucket: 'bucket' });

console.log(response.data);
import os
from telnyx import Telnyx

client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.ai.clusters.compute(
bucket="bucket",
)
print(response.data)
package main

import (
"context"
"fmt"

"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)

func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.AI.Clusters.Compute(context.TODO(), telnyx.AIClusterComputeParams{
Bucket: "bucket",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;

import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.ai.clusters.ClusterComputeParams;
import com.telnyx.sdk.models.ai.clusters.ClusterComputeResponse;

public final class Main {
private Main() {}

public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();

ClusterComputeParams params = ClusterComputeParams.builder()
.bucket("bucket")
.build();
ClusterComputeResponse response = client.ai().clusters().compute(params);
}
}
require "telnyx"

telnyx = Telnyx::Client.new(api_key: "My API Key")

response = telnyx.ai.clusters.compute(bucket: "bucket")

puts(response)
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;

$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');

try {
$response = $client->ai->clusters->compute(
bucket: 'bucket',
files: ['string'],
minClusterSize: 0,
minSubclusterSize: 0,
prefix: 'prefix',
);

var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}
telnyx ai:clusters compute \
--api-key 'My API Key' \
--bucket bucket
curl --request POST \
--url https://api.telnyx.com/v2/ai/clusters \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"bucket": "<string>",
"prefix": "<string>",
"files": [
"<string>"
],
"min_cluster_size": 25,
"min_subcluster_size": 5
}
'
{
  "data": {
    "task_id": "<string>"
  }
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
bucket
string
required

The embedded storage bucket to compute the clusters from. The bucket must already be embedded.

prefix
string

Prefix to filter whcih files in the buckets are included.

files
string[]

Array of files to filter which are included.

min_cluster_size
integer
default:25

Smallest number of related text chunks to qualify as a cluster. Top-level clusters should be thought of as identifying broad themes in your data.

min_subcluster_size
integer
default:5

Smallest number of related text chunks to qualify as a sub-cluster. Sub-clusters should be thought of as identifying more specific topics within a broader theme.

Response

Successful Response

data
TextClusteringResponse · object
required