Prism Endpoint:
AI Matching
Usage
Description
This endpoint evaluates the relationship between a target text and multiple candidates using vector embeddings, returning an ordered list with precise similarity scores. Perfect for intelligent search, categorization, or recommendation engines.
Method & Path
Use https://prism.optical-labs.ca/text/ai-matching to access this endpoint. The method must be POST and the header should contain your secret API key, as shown below:
Body Fields
| Field Name | Type | Description |
|---|---|---|
| target | String (required) | Text with a length between 1 and 500 characters |
| candidates | Array (required) | 1 to 500 strings, each with a length between 1 and 500 characters |
| strictness | Integer (optional) | Level of matching strictness from 0 to 10 |
Valid Response
Each successful request to this endpoint costs 2 to 35 credits, depending on the number of candidates. The price formula is 2 + ( candidates.length / 15 ). Your usage and remaining credits are always returned in the meta object of the response.
Interactive Preview
Because of the high-compute nature of this endpoint, the interactive preview is not available.
Examples
Basic Request
The simplest request you can make, using only the target and candidates fields:
The endpoint reorders the candidates from highest to lowest match. The response also includes the full configuration used for the request, including default values for any undefined parameters:
High Strictness
Using a high strictness can be very practical when searching for near-perfect matches:
The candidates are ordered by a hidden raw match score, so the order always stays the same regardless of the strictness level used, even when multiple confidence scores are 0:
Low Strictness
Using a low strictness is most useful for recommendation engines, where you want to find related concepts rather than exact matches:
The confidence scores are now a lot higher because they are all somewhat related to the target: