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

The tenant id to use for the request. If not provided, the default tenant will be used.

Path Parameters

namespaceId
string
required
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
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
I