UNPKG

notdiamond

Version:

The official TypeScript library for the Notdiamond API

63 lines 2.09 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../core/resource.mjs"; import { path } from "../internal/utils/path.mjs"; export class Preferences extends APIResource { /** * Create a new preference ID for personalized LLM routing. * * A preference ID enables personalized routing by tracking your feedback and * learning your preferences over time. Once created, you can: * * 1. Use it in model_select() calls to get personalized routing decisions * 2. Train a custom router specific to your use case * * **Workflow:** * * 1. Create a preference ID (this endpoint) * 2. Use the preference_id in POST /v2/modelRouter/modelSelect requests * 3. Optionally train a custom router via POST /v2/pzn/trainCustomRouter * * **Benefits:** * * - Personalized routing for your specific use case * - Ability to train custom routers on your evaluation data * * **Note:** If you don't provide a preference_id in model_select() calls, the * default router will be used. * * @example * ```ts * const preference = await client.preferences.create(); * ``` */ create(body, options) { return this._client.post('/v2/preferences/userPreferenceCreate', { body, ...options }); } /** * Update User Preference * * @example * ```ts * const preference = await client.preferences.update({ * preference_id: 'preference_id', * }); * ``` */ update(body, options) { return this._client.put('/v2/preferences/userPreferenceUpdate', { body, ...options }); } /** * Delete User Preference * * @example * ```ts * const preference = await client.preferences.delete( * 'preference_id', * ); * ``` */ delete(preferenceID, options) { return this._client.delete(path `/v2/preferences/userPreferenceDelete/${preferenceID}`, options); } } //# sourceMappingURL=preferences.mjs.map