@anthropic-ai/sdk 0.3.1 → 0.4.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.
@@ -8,12 +8,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.Client = exports.AI_PROMPT = exports.HUMAN_PROMPT = void 0;
13
16
  const fetch_event_source_1 = require("@fortaine/fetch-event-source");
17
+ const cross_fetch_1 = __importDefault(require("cross-fetch"));
14
18
  exports.HUMAN_PROMPT = "\n\nHuman:";
15
19
  exports.AI_PROMPT = "\n\nAssistant:";
16
- const CLIENT_ID = "anthropic-typescript/0.3.1";
20
+ const CLIENT_ID = "anthropic-typescript/0.4.0";
17
21
  const DEFAULT_API_URL = "https://api.anthropic.com";
18
22
  var Event;
19
23
  (function (Event) {
@@ -27,7 +31,7 @@ class Client {
27
31
  }
28
32
  complete(params) {
29
33
  return __awaiter(this, void 0, void 0, function* () {
30
- const response = yield fetch(`${this.apiUrl}/v1/complete`, {
34
+ const response = yield (0, cross_fetch_1.default)(`${this.apiUrl}/v1/complete`, {
31
35
  method: "POST",
32
36
  headers: {
33
37
  Accept: "application/json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anthropic-ai/sdk",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Library for accessing the Anthropic API",
5
5
  "repository": "https://github.com/anthropics/anthropic-sdk-typescript",
6
6
  "license": "MIT",
@@ -18,7 +18,8 @@
18
18
  "example:basic_sync": "tsc --build && node ./build/examples/basic_sync.js"
19
19
  },
20
20
  "dependencies": {
21
- "@fortaine/fetch-event-source": "^3.0.6"
21
+ "@fortaine/fetch-event-source": "^3.0.6",
22
+ "cross-fetch": "^3.1.5"
22
23
  },
23
24
  "devDependencies": {
24
25
  "@types/node": "^18.11.18",