scorecard-ai 0.5.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/api/resources/prompt/client/Client.js +5 -5
  2. package/api/resources/run/client/Client.js +3 -3
  3. package/api/resources/run/client/requests/RunCreateParams.d.ts +1 -0
  4. package/api/resources/runMetric/client/Client.js +1 -1
  5. package/api/resources/score/client/Client.js +2 -2
  6. package/api/resources/score/client/requests/ScoreCreateParams.d.ts +3 -0
  7. package/api/resources/score/client/requests/ScoreUpdateParams.d.ts +3 -0
  8. package/api/resources/testcase/client/Client.js +3 -3
  9. package/api/resources/testcase/client/requests/TestcaseCreateParams.d.ts +2 -0
  10. package/api/resources/testrecord/client/Client.js +2 -2
  11. package/api/resources/testrecord/client/requests/TestrecordCreateParams.d.ts +7 -0
  12. package/api/resources/testset/client/Client.js +5 -5
  13. package/api/resources/testset/client/requests/TestsetCreateParams.d.ts +2 -0
  14. package/api/resources/traces/client/Client.js +1 -1
  15. package/api/types/Grade.d.ts +11 -0
  16. package/api/types/PaginatedTestcaseResponse.d.ts +2 -0
  17. package/api/types/Prompt.d.ts +2 -0
  18. package/api/types/Run.d.ts +14 -0
  19. package/api/types/TestCase.d.ts +4 -0
  20. package/api/types/Testrecord.d.ts +12 -0
  21. package/api/types/Testset.d.ts +11 -0
  22. package/dist/api/resources/prompt/client/Client.js +5 -5
  23. package/dist/api/resources/run/client/Client.js +3 -3
  24. package/dist/api/resources/run/client/requests/RunCreateParams.d.ts +1 -0
  25. package/dist/api/resources/runMetric/client/Client.js +1 -1
  26. package/dist/api/resources/score/client/Client.js +2 -2
  27. package/dist/api/resources/score/client/requests/ScoreCreateParams.d.ts +3 -0
  28. package/dist/api/resources/score/client/requests/ScoreUpdateParams.d.ts +3 -0
  29. package/dist/api/resources/testcase/client/Client.js +3 -3
  30. package/dist/api/resources/testcase/client/requests/TestcaseCreateParams.d.ts +2 -0
  31. package/dist/api/resources/testrecord/client/Client.js +2 -2
  32. package/dist/api/resources/testrecord/client/requests/TestrecordCreateParams.d.ts +7 -0
  33. package/dist/api/resources/testset/client/Client.js +5 -5
  34. package/dist/api/resources/testset/client/requests/TestsetCreateParams.d.ts +2 -0
  35. package/dist/api/resources/traces/client/Client.js +1 -1
  36. package/dist/api/types/Grade.d.ts +11 -0
  37. package/dist/api/types/PaginatedTestcaseResponse.d.ts +2 -0
  38. package/dist/api/types/Prompt.d.ts +2 -0
  39. package/dist/api/types/Run.d.ts +14 -0
  40. package/dist/api/types/TestCase.d.ts +4 -0
  41. package/dist/api/types/Testrecord.d.ts +12 -0
  42. package/dist/api/types/Testset.d.ts +11 -0
  43. package/dist/telemetry.d.ts +0 -5
  44. package/dist/telemetry.js +25 -7
  45. package/dist/wrapper/ScorecardClient.d.ts +2 -10
  46. package/dist/wrapper/ScorecardClient.js +10 -9
  47. package/package.json +6 -1
  48. package/telemetry.d.ts +0 -5
  49. package/telemetry.js +25 -7
  50. package/wrapper/ScorecardClient.d.ts +2 -10
  51. package/wrapper/ScorecardClient.js +10 -9
@@ -33,18 +33,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
35
  exports.ScorecardClient = void 0;
36
+ const api_1 = require("@opentelemetry/api");
36
37
  const Client_1 = require("../Client");
38
+ const core_1 = require("../core");
37
39
  const errors = __importStar(require("../errors"));
38
40
  class ScorecardClient extends Client_1.ScorecardClient {
39
- constructor(options = {}) {
40
- var _a;
41
- const apiKey = (_a = options.apiKey) !== null && _a !== void 0 ? _a : process.env["SCORECARD_API_KEY"];
42
- if (apiKey !== undefined) {
43
- super(Object.assign(Object.assign({}, options), { apiKey }));
44
- }
45
- throw new errors.ScorecardError({
46
- message: "Please pass in your Scorecard API Key or export SCORECARD_API_KEY in your environment.",
47
- });
41
+ constructor(options) {
42
+ const fetcher = (args) => {
43
+ var _a;
44
+ args.headers = (_a = args.headers) !== null && _a !== void 0 ? _a : {};
45
+ api_1.propagation.inject(api_1.context.active(), args.headers);
46
+ return (0, core_1.fetcher)(args);
47
+ };
48
+ super(Object.assign(Object.assign({}, options), { fetcher }));
48
49
  }
49
50
  /**
50
51
  * Runs all tests within a testset