runs.mjs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 OutputItemsAPI from "./output-items.mjs";
  5. import { OutputItemListResponsesPage, OutputItems, } from "./output-items.mjs";
  6. import { CursorPage } from "../../../pagination.mjs";
  7. export class Runs extends APIResource {
  8. constructor() {
  9. super(...arguments);
  10. this.outputItems = new OutputItemsAPI.OutputItems(this._client);
  11. }
  12. /**
  13. * Kicks off a new run for a given evaluation, specifying the data source, and what
  14. * model configuration to use to test. The datasource will be validated against the
  15. * schema specified in the config of the evaluation.
  16. */
  17. create(evalId, body, options) {
  18. return this._client.post(`/evals/${evalId}/runs`, { body, ...options });
  19. }
  20. /**
  21. * Get an evaluation run by ID.
  22. */
  23. retrieve(evalId, runId, options) {
  24. return this._client.get(`/evals/${evalId}/runs/${runId}`, options);
  25. }
  26. list(evalId, query = {}, options) {
  27. if (isRequestOptions(query)) {
  28. return this.list(evalId, {}, query);
  29. }
  30. return this._client.getAPIList(`/evals/${evalId}/runs`, RunListResponsesPage, { query, ...options });
  31. }
  32. /**
  33. * Delete an eval run.
  34. */
  35. del(evalId, runId, options) {
  36. return this._client.delete(`/evals/${evalId}/runs/${runId}`, options);
  37. }
  38. /**
  39. * Cancel an ongoing evaluation run.
  40. */
  41. cancel(evalId, runId, options) {
  42. return this._client.post(`/evals/${evalId}/runs/${runId}`, options);
  43. }
  44. }
  45. export class RunListResponsesPage extends CursorPage {
  46. }
  47. Runs.RunListResponsesPage = RunListResponsesPage;
  48. Runs.OutputItems = OutputItems;
  49. Runs.OutputItemListResponsesPage = OutputItemListResponsesPage;
  50. //# sourceMappingURL=runs.mjs.map