evals.js 2.0 KB

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