Skip to main content
POST
/
v1
/
namespace
/
{namespaceId}
/
search
TypeScript
import { Agentset } from "agentset";

const agentset = new Agentset({ apiKey: 'agentset_xxx' });
const ns = agentset.namespace('ns_xxx');

const results = await ns.search("What is machine learning?", {
  topK: 20,
  rerank: true,
  rerankLimit: 10,
});
console.log(results);
{
  "success": true,
  "data": [
    {
      "id": "<string>",
      "score": 0.5,
      "text": "<string>",
      "relationships": {},
      "metadata": {
        "file_directory": "<string>",
        "filename": "<string>",
        "filetype": "<string>",
        "link_texts": [
          "<any>"
        ],
        "link_urls": [
          "<any>"
        ],
        "languages": [
          "<any>"
        ],
        "sequence_number": 123
      }
    }
  ]
}

Authorizations

Authorization
string
header
required

Default authentication mechanism

Headers

x-tenant-id
string

Optional tenant id to use for the request. If not provided, the namespace will be used directly. Must be alphanumeric and up to 64 characters.

Path Parameters

namespaceId
string
required

The id of the namespace (prefixed with ns_)

Examples:

"ns_123"

Body

application/json
query
string
required

The query to search for.

topK
number
default:10

The number of results to fetch from the vector store. Defaults to 10.

Required range: 1 <= x <= 100
rerank
boolean
default:true

Whether to rerank the results. Defaults to true.

rerankLimit
number

The number of results to return after reranking. Defaults to topK.

Required range: 1 <= x <= 100
rerankModel
enum<string>
default:cohere:rerank-v3.5

The reranking model to use.

Available options:
cohere:rerank-v3.5,
cohere:rerank-english-v3.0,
cohere:rerank-multilingual-v3.0,
zeroentropy:zerank-1,
zeroentropy:zerank-1-small
filter
object

A filter to apply to the results.

minScore
number

The minimum score to return.

Required range: 0 <= x <= 1
includeRelationships
boolean
default:false

Whether to include relationships in the results. Defaults to false.

includeMetadata
boolean
default:true

Whether to include metadata in the results. Defaults to true.

keywordFilter
string
mode
enum<string>
default:semantic
Available options:
semantic,
keyword

Response

The retrieved namespace

success
boolean
required
data
object[]
required