scorecard-ai 2.6.0 → 3.0.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,66 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.0 (2026-01-22)
4
+
5
+ Full Changelog: [v3.0.0-beta.0...v3.0.0](https://github.com/scorecard-ai/scorecard-node/compare/v3.0.0-beta.0...v3.0.0)
6
+
7
+ ### Features
8
+
9
+ * **mcp:** Add Anthropic Software Directory compliance updates ([#35](https://github.com/scorecard-ai/scorecard-node/issues/35)) ([6e48fc1](https://github.com/scorecard-ai/scorecard-node/commit/6e48fc112460d9f97311c5d5b0bdd711963f2011))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **mcp:** Update privacy policy links in README ([#36](https://github.com/scorecard-ai/scorecard-node/issues/36)) ([8203d63](https://github.com/scorecard-ai/scorecard-node/commit/8203d63164a726fdb4313d1bc6999018ae4b980e))
15
+
16
+
17
+ ### Chores
18
+
19
+ * **internal:** update `actions/checkout` version ([a32eb88](https://github.com/scorecard-ai/scorecard-node/commit/a32eb88d056a05bb45705ed5b6661df2e073355e))
20
+ * **internal:** upgrade babel, qs, js-yaml ([56c3381](https://github.com/scorecard-ai/scorecard-node/commit/56c338198655a49884ae0ff6059c41d841bbc732))
21
+ * **mcp:** add intent param to execute tool ([5a013b7](https://github.com/scorecard-ai/scorecard-node/commit/5a013b7a15fa4c8c9beba0bb6e597d2d57b83bdf))
22
+ * **mcp:** pass intent param to execute handler ([de0f20a](https://github.com/scorecard-ai/scorecard-node/commit/de0f20ad861d56f07b40994225db1086848a657e))
23
+ * **mcp:** upgrade dependencies ([c330ff5](https://github.com/scorecard-ai/scorecard-node/commit/c330ff546bcc5ab978b56d98eefa592c0d915a6e))
24
+
25
+ ## 3.0.0-beta.0 (2026-01-14)
26
+
27
+ Full Changelog: [v2.6.0...v3.0.0-beta.0](https://github.com/scorecard-ai/scorecard-node/compare/v2.6.0...v3.0.0-beta.0)
28
+
29
+ ### ⚠ BREAKING CHANGES
30
+
31
+ * **mcp:** remove deprecated tool schemes
32
+ * **mcp:** **Migration:** To migrate, simply modify the command used to invoke the MCP server. Currently, the only supported tool scheme is code mode. Now, starting the server with just `node /path/to/mcp/server` or `npx package-name` will invoke code tools: changing your command to one of these is likely all you will need to do.
33
+
34
+ ### Features
35
+
36
+ * Add telemetry wrappers around Anthropic and OpenAI SDKs ([#31](https://github.com/scorecard-ai/scorecard-node/issues/31)) ([bb4dfe5](https://github.com/scorecard-ai/scorecard-node/commit/bb4dfe590993bfb07d28a1db96622f86654366d6))
37
+ * **mcp:** Use Scorecard API key from MCP client when executing code tool ([741fbdd](https://github.com/scorecard-ai/scorecard-node/commit/741fbdd38c9becc69f4e7a6de845dcff556434df))
38
+
39
+
40
+ ### Bug Fixes
41
+
42
+ * **mcp:** correct code tool api output types ([c3983d7](https://github.com/scorecard-ai/scorecard-node/commit/c3983d734ccbe019061105f99ba6b2b8727e8b0f))
43
+ * **mcp:** fix env parsing ([22c7368](https://github.com/scorecard-ai/scorecard-node/commit/22c73681d18660d972a9836fe20926b5d402b534))
44
+ * **mcp:** fix options parsing ([c19c6e3](https://github.com/scorecard-ai/scorecard-node/commit/c19c6e3a2da944a83b55419acb2c72ae9a1e1f9d))
45
+ * **mcp:** pass base url to code tool ([2a855d6](https://github.com/scorecard-ai/scorecard-node/commit/2a855d651ec9260455d9b1172cf543f9a334c6b8))
46
+ * **mcp:** update code tool prompt ([cec30f5](https://github.com/scorecard-ai/scorecard-node/commit/cec30f5761b9af71a10bdbe0a5aacff277c4a04b))
47
+
48
+
49
+ ### Chores
50
+
51
+ * break long lines in snippets into multiline ([6eb4de7](https://github.com/scorecard-ai/scorecard-node/commit/6eb4de7c08e0f14041714c8fb93aba4b1ab8de1a))
52
+ * **internal:** codegen related update ([e1a1b97](https://github.com/scorecard-ai/scorecard-node/commit/e1a1b97a6516933282ba19368dfcd4abb6adecb6))
53
+ * **internal:** codegen related update ([5c31e8f](https://github.com/scorecard-ai/scorecard-node/commit/5c31e8f81cbc97a6ade6567e9342231b79333eb9))
54
+ * **internal:** codegen related update ([d638ee7](https://github.com/scorecard-ai/scorecard-node/commit/d638ee7d5c8d6c7a61e98f261a4aec42f57d1202))
55
+ * **internal:** codegen related update ([8a98749](https://github.com/scorecard-ai/scorecard-node/commit/8a987491b973353fb77457075e3dbbd5d462c8bc))
56
+ * **internal:** codegen related update ([32953e6](https://github.com/scorecard-ai/scorecard-node/commit/32953e6cf9066fb0952863950cd63575bf52435c))
57
+ * **mcp:** remove deprecated tool schemes ([7175afa](https://github.com/scorecard-ai/scorecard-node/commit/7175afa508ca459c54ade311ecb970b316c1cc87))
58
+
59
+
60
+ ### Documentation
61
+
62
+ * prominently feature MCP server setup in root SDK readmes ([2c59b3f](https://github.com/scorecard-ai/scorecard-node/commit/2c59b3f39f3d14b27b2f13f6183437446c25bb54))
63
+
3
64
  ## 2.6.0 (2025-12-11)
4
65
 
5
66
  Full Changelog: [v2.5.0...v2.6.0](https://github.com/scorecard-ai/scorecard-node/compare/v2.5.0...v2.6.0)
package/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2025 Scorecard
189
+ Copyright 2026 Scorecard
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -8,6 +8,15 @@ The REST API documentation can be found on [docs.scorecard.io](https://docs.scor
8
8
 
9
9
  It is generated with [Stainless](https://www.stainless.com/).
10
10
 
11
+ ## MCP Server
12
+
13
+ Use the Scorecard MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.
14
+
15
+ [![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=scorecard-ai-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsInNjb3JlY2FyZC1haS1tY3AiXX0)
16
+ [![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22scorecard-ai-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22scorecard-ai-mcp%22%5D%7D)
17
+
18
+ > Note: You may need to set environment variables in your MCP client.
19
+
11
20
  ## Installation
12
21
 
13
22
  ```sh
package/index.d.mts CHANGED
@@ -6,4 +6,5 @@ export { PagePromise } from "./core/pagination.mjs";
6
6
  export { ScorecardError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
7
7
  export { runAndEvaluate } from "./lib/runAndEvaluate.mjs";
8
8
  export { wrapAISDK } from "./lib/wrapAISDK.mjs";
9
+ export { wrap, wrapOpenAI, wrapAnthropic } from "./lib/wrapLLMs.mjs";
9
10
  //# sourceMappingURL=index.d.mts.map
package/index.d.mts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,SAAS,IAAI,OAAO,EAAE;OAExB,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE;OACjC,EAAE,WAAW,EAAE;OACf,EACL,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB;OAEM,EAAE,cAAc,EAAE;OAClB,EAAE,SAAS,EAAE"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,SAAS,IAAI,OAAO,EAAE;OAExB,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE;OACjC,EAAE,WAAW,EAAE;OACf,EACL,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB;OAEM,EAAE,cAAc,EAAE;OAClB,EAAE,SAAS,EAAE;OACb,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE"}
package/index.d.ts CHANGED
@@ -6,4 +6,5 @@ export { PagePromise } from "./core/pagination.js";
6
6
  export { ScorecardError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.js";
7
7
  export { runAndEvaluate } from "./lib/runAndEvaluate.js";
8
8
  export { wrapAISDK } from "./lib/wrapAISDK.js";
9
+ export { wrap, wrapOpenAI, wrapAnthropic } from "./lib/wrapLLMs.js";
9
10
  //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,SAAS,IAAI,OAAO,EAAE;OAExB,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE;OACjC,EAAE,WAAW,EAAE;OACf,EACL,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB;OAEM,EAAE,cAAc,EAAE;OAClB,EAAE,SAAS,EAAE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,SAAS,IAAI,OAAO,EAAE;OAExB,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE;OACjC,EAAE,WAAW,EAAE;OACf,EACL,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB;OAEM,EAAE,cAAc,EAAE;OAClB,EAAE,SAAS,EAAE;OACb,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE"}
package/index.js CHANGED
@@ -4,7 +4,7 @@ exports = module.exports = function (...args) {
4
4
  return new exports.default(...args)
5
5
  }
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.wrapAISDK = exports.runAndEvaluate = exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.ScorecardError = exports.PagePromise = exports.Scorecard = exports.APIPromise = exports.toFile = exports.default = void 0;
7
+ exports.wrapAnthropic = exports.wrapOpenAI = exports.wrap = exports.wrapAISDK = exports.runAndEvaluate = exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.ScorecardError = exports.PagePromise = exports.Scorecard = exports.APIPromise = exports.toFile = exports.default = void 0;
8
8
  var client_1 = require("./client.js");
9
9
  Object.defineProperty(exports, "default", { enumerable: true, get: function () { return client_1.Scorecard; } });
10
10
  var uploads_1 = require("./core/uploads.js");
@@ -33,4 +33,8 @@ var runAndEvaluate_1 = require("./lib/runAndEvaluate.js");
33
33
  Object.defineProperty(exports, "runAndEvaluate", { enumerable: true, get: function () { return runAndEvaluate_1.runAndEvaluate; } });
34
34
  var wrapAISDK_1 = require("./lib/wrapAISDK.js");
35
35
  Object.defineProperty(exports, "wrapAISDK", { enumerable: true, get: function () { return wrapAISDK_1.wrapAISDK; } });
36
+ var wrapLLMs_1 = require("./lib/wrapLLMs.js");
37
+ Object.defineProperty(exports, "wrap", { enumerable: true, get: function () { return wrapLLMs_1.wrap; } });
38
+ Object.defineProperty(exports, "wrapOpenAI", { enumerable: true, get: function () { return wrapLLMs_1.wrapOpenAI; } });
39
+ Object.defineProperty(exports, "wrapAnthropic", { enumerable: true, get: function () { return wrapLLMs_1.wrapAnthropic; } });
36
40
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sCAAgD;AAAvC,iGAAA,SAAS,OAAW;AAE7B,6CAAyD;AAA/B,iGAAA,MAAM,OAAA;AAChC,qDAAgD;AAAvC,yGAAA,UAAU,OAAA;AACnB,sCAAyD;AAAhD,mGAAA,SAAS,OAAA;AAClB,mDAAgD;AAAvC,yGAAA,WAAW,OAAA;AACpB,yCAcsB;AAbpB,uGAAA,cAAc,OAAA;AACd,iGAAA,QAAQ,OAAA;AACR,2GAAA,kBAAkB,OAAA;AAClB,kHAAA,yBAAyB,OAAA;AACzB,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,aAAa,OAAA;AACb,sGAAA,aAAa,OAAA;AACb,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,8GAAA,qBAAqB,OAAA;AACrB,iHAAA,wBAAwB,OAAA;AAG1B,0DAAsD;AAA7C,gHAAA,cAAc,OAAA;AACvB,gDAA4C;AAAnC,sGAAA,SAAS,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sCAAgD;AAAvC,iGAAA,SAAS,OAAW;AAE7B,6CAAyD;AAA/B,iGAAA,MAAM,OAAA;AAChC,qDAAgD;AAAvC,yGAAA,UAAU,OAAA;AACnB,sCAAyD;AAAhD,mGAAA,SAAS,OAAA;AAClB,mDAAgD;AAAvC,yGAAA,WAAW,OAAA;AACpB,yCAcsB;AAbpB,uGAAA,cAAc,OAAA;AACd,iGAAA,QAAQ,OAAA;AACR,2GAAA,kBAAkB,OAAA;AAClB,kHAAA,yBAAyB,OAAA;AACzB,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,aAAa,OAAA;AACb,sGAAA,aAAa,OAAA;AACb,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,8GAAA,qBAAqB,OAAA;AACrB,iHAAA,wBAAwB,OAAA;AAG1B,0DAAsD;AAA7C,gHAAA,cAAc,OAAA;AACvB,gDAA4C;AAAnC,sGAAA,SAAS,OAAA;AAClB,8CAAiE;AAAxD,gGAAA,IAAI,OAAA;AAAE,sGAAA,UAAU,OAAA;AAAE,yGAAA,aAAa,OAAA"}
package/index.mjs CHANGED
@@ -7,4 +7,5 @@ export { PagePromise } from "./core/pagination.mjs";
7
7
  export { ScorecardError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
8
8
  export { runAndEvaluate } from "./lib/runAndEvaluate.mjs";
9
9
  export { wrapAISDK } from "./lib/wrapAISDK.mjs";
10
+ export { wrap, wrapOpenAI, wrapAnthropic } from "./lib/wrapLLMs.mjs";
10
11
  //# sourceMappingURL=index.mjs.map
package/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,SAAS,IAAI,OAAO,EAAE;OAExB,EAAmB,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,SAAS,EAAsB;OACjC,EAAE,WAAW,EAAE;OACf,EACL,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB;OAEM,EAAE,cAAc,EAAE;OAClB,EAAE,SAAS,EAAE"}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,SAAS,IAAI,OAAO,EAAE;OAExB,EAAmB,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,SAAS,EAAsB;OACjC,EAAE,WAAW,EAAE;OACf,EACL,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB;OAEM,EAAE,cAAc,EAAE;OAClB,EAAE,SAAS,EAAE;OACb,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Configuration for wrapping LLM SDKs
3
+ */
4
+ interface WrapConfig {
5
+ /**
6
+ * ID of the Scorecard project that traces should be associated with.
7
+ * Defaults to SCORECARD_PROJECT_ID environment variable.
8
+ */
9
+ projectId?: string | undefined;
10
+ /**
11
+ * Scorecard API key for authentication.
12
+ * Defaults to SCORECARD_API_KEY environment variable.
13
+ */
14
+ apiKey?: string | undefined;
15
+ /**
16
+ * Service name for telemetry.
17
+ * Defaults to "llm-app".
18
+ */
19
+ serviceName?: string | undefined;
20
+ /**
21
+ * OTLP endpoint for trace export.
22
+ * Defaults to "https://tracing.scorecard.io/otel/v1/traces".
23
+ */
24
+ endpoint?: string | undefined;
25
+ /**
26
+ * Maximum batch size of spans to be exported in a single request.
27
+ * Lower values provide faster feedback but more network requests.
28
+ * Higher values are more efficient but delay span visibility.
29
+ * @default 1
30
+ */
31
+ maxExportBatchSize?: number | undefined;
32
+ }
33
+ /**
34
+ * Wrap any LLM SDK (OpenAI or Anthropic) to automatically trace all API calls
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * import { wrap } from '@scorecard/node';
39
+ * import OpenAI from 'openai';
40
+ * import Anthropic from '@anthropic-ai/sdk';
41
+ *
42
+ * // Works with OpenAI
43
+ * const openai = wrap(new OpenAI({ apiKey: '...' }), {
44
+ * apiKey: process.env.SCORECARD_API_KEY,
45
+ * projectId: '123'
46
+ * });
47
+ *
48
+ * // Works with Anthropic
49
+ * const claude = wrap(new Anthropic({ apiKey: '...' }), {
50
+ * apiKey: process.env.SCORECARD_API_KEY,
51
+ * projectId: '123'
52
+ * });
53
+ *
54
+ * // Use normally - traces are automatically sent to Scorecard
55
+ * const response = await openai.chat.completions.create({...});
56
+ * const response2 = await claude.messages.create({...});
57
+ * ```
58
+ */
59
+ export declare function wrap<T>(client: T, config?: WrapConfig): T;
60
+ export declare const wrapOpenAI: typeof wrap;
61
+ export declare const wrapAnthropic: typeof wrap;
62
+ export {};
63
+ //# sourceMappingURL=wrapLLMs.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrapLLMs.d.mts","sourceRoot":"","sources":["../src/lib/wrapLLMs.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,UAAU,UAAU;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE9B;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAmTD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAE,UAAe,GAAG,CAAC,CAkG7D;AAGD,eAAO,MAAM,UAAU,aAAO,CAAC;AAC/B,eAAO,MAAM,aAAa,aAAO,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Configuration for wrapping LLM SDKs
3
+ */
4
+ interface WrapConfig {
5
+ /**
6
+ * ID of the Scorecard project that traces should be associated with.
7
+ * Defaults to SCORECARD_PROJECT_ID environment variable.
8
+ */
9
+ projectId?: string | undefined;
10
+ /**
11
+ * Scorecard API key for authentication.
12
+ * Defaults to SCORECARD_API_KEY environment variable.
13
+ */
14
+ apiKey?: string | undefined;
15
+ /**
16
+ * Service name for telemetry.
17
+ * Defaults to "llm-app".
18
+ */
19
+ serviceName?: string | undefined;
20
+ /**
21
+ * OTLP endpoint for trace export.
22
+ * Defaults to "https://tracing.scorecard.io/otel/v1/traces".
23
+ */
24
+ endpoint?: string | undefined;
25
+ /**
26
+ * Maximum batch size of spans to be exported in a single request.
27
+ * Lower values provide faster feedback but more network requests.
28
+ * Higher values are more efficient but delay span visibility.
29
+ * @default 1
30
+ */
31
+ maxExportBatchSize?: number | undefined;
32
+ }
33
+ /**
34
+ * Wrap any LLM SDK (OpenAI or Anthropic) to automatically trace all API calls
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * import { wrap } from '@scorecard/node';
39
+ * import OpenAI from 'openai';
40
+ * import Anthropic from '@anthropic-ai/sdk';
41
+ *
42
+ * // Works with OpenAI
43
+ * const openai = wrap(new OpenAI({ apiKey: '...' }), {
44
+ * apiKey: process.env.SCORECARD_API_KEY,
45
+ * projectId: '123'
46
+ * });
47
+ *
48
+ * // Works with Anthropic
49
+ * const claude = wrap(new Anthropic({ apiKey: '...' }), {
50
+ * apiKey: process.env.SCORECARD_API_KEY,
51
+ * projectId: '123'
52
+ * });
53
+ *
54
+ * // Use normally - traces are automatically sent to Scorecard
55
+ * const response = await openai.chat.completions.create({...});
56
+ * const response2 = await claude.messages.create({...});
57
+ * ```
58
+ */
59
+ export declare function wrap<T>(client: T, config?: WrapConfig): T;
60
+ export declare const wrapOpenAI: typeof wrap;
61
+ export declare const wrapAnthropic: typeof wrap;
62
+ export {};
63
+ //# sourceMappingURL=wrapLLMs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrapLLMs.d.ts","sourceRoot":"","sources":["../src/lib/wrapLLMs.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,UAAU,UAAU;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE9B;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAmTD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAE,UAAe,GAAG,CAAC,CAkG7D;AAGD,eAAO,MAAM,UAAU,aAAO,CAAC;AAC/B,eAAO,MAAM,aAAa,aAAO,CAAC"}