Compute new clusters
Starts a background task to compute how the data in an embedded storage bucket is clustered. This helps identify common themes and patterns in the data.
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 bucketcurl --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": [
"body",
"name"
],
"msg": "Field required",
"type": "missing"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Prefix to filter whcih files in the buckets are included.
Array of files to filter which are included.
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.
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
Show child attributes
Show child attributes
Was this page helpful?
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 bucketcurl --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": [
"body",
"name"
],
"msg": "Field required",
"type": "missing"
}
]
}