Check out our upcoming events and meetups! View events →
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 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.embeddings.similaritySearch({
bucket_name: 'bucket_name',
query: 'query',
});
console.log(response.data);{
"data": [
{
"document_chunk": "<string>",
"distance": 123,
"metadata": {
"source": "<string>",
"checksum": "<string>",
"embedding": "<string>",
"filename": "<string>",
"certainty": 123,
"loader_metadata": {}
}
}
]
}Documentation Index
Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
Use this file to discover all available pages before exploring further.
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Successful Response
Show child attributes
Was this page helpful?
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.embeddings.similaritySearch({
bucket_name: 'bucket_name',
query: 'query',
});
console.log(response.data);{
"data": [
{
"document_chunk": "<string>",
"distance": 123,
"metadata": {
"source": "<string>",
"checksum": "<string>",
"embedding": "<string>",
"filename": "<string>",
"certainty": 123,
"loader_metadata": {}
}
}
]
}