UNPKG

@squidcloud/client

Version:

A typescript implementation of the Squid client

99 lines (98 loc) 4.03 kB
import { MmEntity, MmEntityMatch, MmFindMatchesOptions, MmListEntitiesOptions, MmMatchMaker } from '../../internal-common/src/public-types/ai-matchmaking.public-types'; /** * Client for the AI Matchmaking service. This service allows you to create matchmakers and insert entities into them. * The service will then find matches for the entities. * @category AI */ export declare class AiMatchMakingClient { private readonly rpcManager; /** * Creates a new matchmaker with the given metadata. * * @param matchMaker - Object describing the matchmaker including ID, description (used as AI instructions), and categories. * @returns A MatchMaker instance to perform entity-level operations. */ createMatchMaker(matchMaker: MmMatchMaker): Promise<MatchMaker>; /** * Retrieves an existing matchmaker by its ID. * * @param matchMakerId - ID of the matchmaker to retrieve. * @returns A MatchMaker instance if found, otherwise undefined. */ getMatchMaker(matchMakerId: string): Promise<MatchMaker | undefined>; /** * Lists all existing matchmakers. */ listMatchMakers(): Promise<Array<MmMatchMaker>>; } /** * Represents a matchmaker. You can insert entities into the matchmaker and find matches for them. * * A matchmaker has one or more categories. When inserting an entity, it is assigned to a category. * When finding matches, you can specify which categories to use for source and target. * * The matchmaker description is used as a prompt or instruction to the AI to guide the matchmaking behavior. * @category AI */ export declare class MatchMaker { private readonly matchMaker; private readonly rpcManager; readonly id: string; /** * Adds a new entity to the matchmaker, replacing existing entity with the same ID if it exists. * * @param entity - The entity to insert. */ insertEntity(entity: MmEntity): Promise<void>; /** * Inserts multiple entities into the matchmaker. Replaces existing entities with matching IDs. * * @param entities - Array of entities to insert. */ insertManyEntities(entities: Array<MmEntity>): Promise<void>; /** * Deletes the matchmaker and all its associated data. */ delete(): Promise<void>; /** * Deletes a specific entity from the matchmaker. * * @param entityId - The ID of the entity to delete. */ deleteEntity(entityId: string): Promise<void>; /** * Finds matches for an entity already inserted into the matchmaker. * * @param entityId - ID of the entity to match. * @param options - Optional filters and controls for matching. * @returns Array of entity matches. */ findMatches(entityId: string, options?: MmFindMatchesOptions): Promise<Array<MmEntityMatch>>; /** * Finds matches for an entity not yet inserted into the matchmaker. * * @param entity - The entity object (excluding ID and metadata). * @param options - Optional filters and controls for matching. * @returns Array of entity matches. */ findMatchesForEntity(entity: Omit<MmEntity, 'metadata' | 'id'>, options?: MmFindMatchesOptions): Promise<Array<MmEntityMatch>>; /** * Lists entities currently in the matchmaker that belong to the specified category. * * @param categoryId - The category to filter entities by. * @param options - Pagination and filtering options. * @returns Array of entities in the category. */ listEntities(categoryId: string, options?: MmListEntitiesOptions): Promise<Array<MmEntity>>; /** * Retrieves a single entity from the matchmaker by its ID. * * @param entityId - ID of the entity to retrieve. * @returns The entity if found, or undefined. */ getEntity(entityId: string): Promise<MmEntity | undefined>; /** * Returns the matchmaker metadata including description, categories, and ID. */ getMatchMakerDetails(): MmMatchMaker; }