evals.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. "use strict";
  2. // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  3. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  4. if (k2 === undefined) k2 = k;
  5. var desc = Object.getOwnPropertyDescriptor(m, k);
  6. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  7. desc = { enumerable: true, get: function() { return m[k]; } };
  8. }
  9. Object.defineProperty(o, k2, desc);
  10. }) : (function(o, m, k, k2) {
  11. if (k2 === undefined) k2 = k;
  12. o[k2] = m[k];
  13. }));
  14. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  15. Object.defineProperty(o, "default", { enumerable: true, value: v });
  16. }) : function(o, v) {
  17. o["default"] = v;
  18. });
  19. var __importStar = (this && this.__importStar) || function (mod) {
  20. if (mod && mod.__esModule) return mod;
  21. var result = {};
  22. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  23. __setModuleDefault(result, mod);
  24. return result;
  25. };
  26. Object.defineProperty(exports, "__esModule", { value: true });
  27. exports.EvalListResponsesPage = exports.Evals = void 0;
  28. const resource_1 = require("../../resource.js");
  29. const core_1 = require("../../core.js");
  30. const RunsAPI = __importStar(require("./runs/runs.js"));
  31. const runs_1 = require("./runs/runs.js");
  32. const pagination_1 = require("../../pagination.js");
  33. class Evals extends resource_1.APIResource {
  34. constructor() {
  35. super(...arguments);
  36. this.runs = new RunsAPI.Runs(this._client);
  37. }
  38. /**
  39. * Create the structure of an evaluation that can be used to test a model's
  40. * performance. An evaluation is a set of testing criteria and the config for a
  41. * data source, which dictates the schema of the data used in the evaluation. After
  42. * creating an evaluation, you can run it on different models and model parameters.
  43. * We support several types of graders and datasources. For more information, see
  44. * the [Evals guide](https://platform.openai.com/docs/guides/evals).
  45. */
  46. create(body, options) {
  47. return this._client.post('/evals', { body, ...options });
  48. }
  49. /**
  50. * Get an evaluation by ID.
  51. */
  52. retrieve(evalId, options) {
  53. return this._client.get(`/evals/${evalId}`, options);
  54. }
  55. /**
  56. * Update certain properties of an evaluation.
  57. */
  58. update(evalId, body, options) {
  59. return this._client.post(`/evals/${evalId}`, { body, ...options });
  60. }
  61. list(query = {}, options) {
  62. if ((0, core_1.isRequestOptions)(query)) {
  63. return this.list({}, query);
  64. }
  65. return this._client.getAPIList('/evals', EvalListResponsesPage, { query, ...options });
  66. }
  67. /**
  68. * Delete an evaluation.
  69. */
  70. del(evalId, options) {
  71. return this._client.delete(`/evals/${evalId}`, options);
  72. }
  73. }
  74. exports.Evals = Evals;
  75. class EvalListResponsesPage extends pagination_1.CursorPage {
  76. }
  77. exports.EvalListResponsesPage = EvalListResponsesPage;
  78. Evals.EvalListResponsesPage = EvalListResponsesPage;
  79. Evals.Runs = runs_1.Runs;
  80. Evals.RunListResponsesPage = runs_1.RunListResponsesPage;
  81. //# sourceMappingURL=evals.js.map