Lets you run a similarity search query on a dataset.
Requires the dataset to be indexed. Please see the indexDataset method to set up indexing.
similarExamples(
inputs: KVMap,
datasetId: string,
limit: number,
filter: __type = {}
): Promise<ExampleSearch[]>| Name | Type | Description |
|---|---|---|
inputs* | KVMap | The input on which to run the similarity search. Must have the same schema as the dataset. |
datasetId* | string | The dataset to search for similar examples. |
limit* | number | The maximum number of examples to return. Will return the top |
filter | __type | Default: {}A filter string to apply to the search. Only examples will be returned that match the filter string. Some examples of filters
|
dataset_id = "123e4567-e89b-12d3-a456-426614174000"
inputs = {"text": "How many people live in Berlin?"}
limit = 5
examples = await client.similarExamples(inputs, dataset_id, limit)