evals.mjs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  2. import { APIResource } from "../../resource.mjs";
  3. import { isRequestOptions } from "../../core.mjs";
  4. import * as RunsAPI from "./runs/runs.mjs";
  5. import { RunListResponsesPage, Runs, } from "./runs/runs.mjs";
  6. import { CursorPage } from "../../pagination.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(`/evals/${evalId}`, options);
  28. }
  29. /**
  30. * Update certain properties of an evaluation.
  31. */
  32. update(evalId, body, options) {
  33. return this._client.post(`/evals/${evalId}`, { body, ...options });
  34. }
  35. list(query = {}, options) {
  36. if (isRequestOptions(query)) {
  37. return this.list({}, query);
  38. }
  39. return this._client.getAPIList('/evals', EvalListResponsesPage, { query, ...options });
  40. }
  41. /**
  42. * Delete an evaluation.
  43. */
  44. del(evalId, options) {
  45. return this._client.delete(`/evals/${evalId}`, options);
  46. }
  47. }
  48. export class EvalListResponsesPage extends CursorPage {
  49. }
  50. Evals.EvalListResponsesPage = EvalListResponsesPage;
  51. Evals.Runs = Runs;
  52. Evals.RunListResponsesPage = RunListResponsesPage;
  53. //# sourceMappingURL=evals.mjs.map