evals.mjs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  2. import { APIResource } from "../../core/resource.mjs";
  3. import * as RunsAPI from "./runs/runs.mjs";
  4. import { Runs, } from "./runs/runs.mjs";
  5. import { CursorPage } from "../../core/pagination.mjs";
  6. import { path } from "../../internal/utils/path.mjs";
  7. export class Evals extends APIResource {
  8. constructor() {
  9. super(...arguments);
  10. this.runs = new RunsAPI.Runs(this._client);
  11. }
  12. /**
  13. * Create the structure of an evaluation that can be used to test a model's
  14. * performance. An evaluation is a set of testing criteria and the config for a
  15. * data source, which dictates the schema of the data used in the evaluation. After
  16. * creating an evaluation, you can run it on different models and model parameters.
  17. * We support several types of graders and datasources. For more information, see
  18. * the [Evals guide](https://platform.openai.com/docs/guides/evals).
  19. */
  20. create(body, options) {
  21. return this._client.post('/evals', { body, ...options });
  22. }
  23. /**
  24. * Get an evaluation by ID.
  25. */
  26. retrieve(evalID, options) {
  27. return this._client.get(path `/evals/${evalID}`, options);
  28. }
  29. /**
  30. * Update certain properties of an evaluation.
  31. */
  32. update(evalID, body, options) {
  33. return this._client.post(path `/evals/${evalID}`, { body, ...options });
  34. }
  35. /**
  36. * List evaluations for a project.
  37. */
  38. list(query = {}, options) {
  39. return this._client.getAPIList('/evals', (CursorPage), { query, ...options });
  40. }
  41. /**
  42. * Delete an evaluation.
  43. */
  44. delete(evalID, options) {
  45. return this._client.delete(path `/evals/${evalID}`, options);
  46. }
  47. }
  48. Evals.Runs = Runs;
  49. //# sourceMappingURL=evals.mjs.map