Skip to content

Commit

Permalink
Remove node-fetch, add instructions for node 16
Browse files Browse the repository at this point in the history
  • Loading branch information
nfcampos committed Feb 23, 2023
1 parent beccbd7 commit 5b919ce
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 44 deletions.
5 changes: 5 additions & 0 deletions docs/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ To get started, install LangChain with the following command:
npm i langchain
```

If you are running this on Node.js 16, either:

- run your application with `NODE_OPTIONS='--experimental-fetch' node ...`, or
- install `node-fetch` and follow the instructions [here](https://github.com/node-fetch/node-fetch#providing-global-access)

## Picking up a LLM

Using LangChain will usually require integrations with one or more model providers, data stores, apis, etc.
Expand Down
1 change: 0 additions & 1 deletion langchain/agents/tools/IFTTTWebhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ service, and you're ready to start receiving data and triggering actions 🎉
- Copy the IFTTT key value from there. The URL is of the form
https://maker.ifttt.com/use/YOUR_IFTTT_KEY. Grab the YOUR_IFTTT_KEY value.
*/
import fetch from "node-fetch";
import { Tool } from "./base";

export class IFTTTWebhook extends Tool {
Expand Down
1 change: 0 additions & 1 deletion langchain/agents/tools/bingserpapi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import fetch from "node-fetch";
import { Tool } from "./base";

class BingSerpAPI extends Tool {
Expand Down
1 change: 0 additions & 1 deletion langchain/agents/tools/dadjokeapi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import fetch from "node-fetch";
import { Tool } from "./base";

class DadJokeAPI extends Tool {
Expand Down
1 change: 0 additions & 1 deletion langchain/llms/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {
} from "openai";
import type { IncomingMessage } from "http";
import fetchAdapter from "@vespaiach/axios-fetch-adapter";
import fetch from "node-fetch";
import { createParser } from "eventsource-parser";
import { backOff } from "exponential-backoff";
import { chunkArray } from "../util";
Expand Down
2 changes: 0 additions & 2 deletions langchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
"@dqbd/tiktoken": "^0.2.1",
"@jest/globals": "^29.4.2",
"@tsconfig/recommended": "^1.0.2",
"@types/node-fetch": "2",
"@types/uuid": "^9",
"@typescript-eslint/eslint-plugin": "^5.51.0",
"@typescript-eslint/parser": "^5.51.0",
Expand Down Expand Up @@ -150,7 +149,6 @@
"exponential-backoff": "^3.1.0",
"expr-eval": "^2.0.2",
"gpt-3-encoder": "^1.1.4",
"node-fetch": "2",
"p-queue": "6",
"uuid": "^9.0.0",
"yaml": "^2.2.1"
Expand Down
1 change: 0 additions & 1 deletion langchain/util/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import path from "path";
import fetch, { RequestInit } from "node-fetch";
import fs from "fs";
import * as yaml from "yaml";

Expand Down
37 changes: 0 additions & 37 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3288,16 +3288,6 @@ __metadata:
languageName: node
linkType: hard

"@types/node-fetch@npm:2":
version: 2.6.2
resolution: "@types/node-fetch@npm:2.6.2"
dependencies:
"@types/node": "*"
form-data: ^3.0.0
checksum: 6f73b1470000d303d25a6fb92875ea837a216656cb7474f66cdd67bb014aa81a5a11e7ac9c21fe19bee9ecb2ef87c1962bceeaec31386119d1ac86e4c30ad7a6
languageName: node
linkType: hard

"@types/node@npm:*":
version: 18.13.0
resolution: "@types/node@npm:18.13.0"
Expand Down Expand Up @@ -7156,17 +7146,6 @@ __metadata:
languageName: node
linkType: hard

"form-data@npm:^3.0.0":
version: 3.0.1
resolution: "form-data@npm:3.0.1"
dependencies:
asynckit: ^0.4.0
combined-stream: ^1.0.8
mime-types: ^2.1.12
checksum: b019e8d35c8afc14a2bd8a7a92fa4f525a4726b6d5a9740e8d2623c30e308fbb58dc8469f90415a856698933c8479b01646a9dff33c87cc4e76d72aedbbf860d
languageName: node
linkType: hard

"form-data@npm:^4.0.0":
version: 4.0.0
resolution: "form-data@npm:4.0.0"
Expand Down Expand Up @@ -9467,7 +9446,6 @@ __metadata:
"@dqbd/tiktoken": ^0.2.1
"@jest/globals": ^29.4.2
"@tsconfig/recommended": ^1.0.2
"@types/node-fetch": 2
"@types/uuid": ^9
"@typescript-eslint/eslint-plugin": ^5.51.0
"@typescript-eslint/parser": ^5.51.0
Expand All @@ -9491,7 +9469,6 @@ __metadata:
husky: ^8.0.3
jest: ^29.4.2
lint-staged: ^13.1.1
node-fetch: 2
openai: ^3.1.0
p-queue: 6
pinecone-client: ^1.0.1
Expand Down Expand Up @@ -10304,20 +10281,6 @@ __metadata:
languageName: node
linkType: hard

"node-fetch@npm:2":
version: 2.6.9
resolution: "node-fetch@npm:2.6.9"
dependencies:
whatwg-url: ^5.0.0
peerDependencies:
encoding: ^0.1.0
peerDependenciesMeta:
encoding:
optional: true
checksum: acb04f9ce7224965b2b59e71b33c639794d8991efd73855b0b250921382b38331ffc9d61bce502571f6cc6e11a8905ca9b1b6d4aeb586ab093e2756a1fd190d0
languageName: node
linkType: hard

"node-fetch@npm:2.6.7":
version: 2.6.7
resolution: "node-fetch@npm:2.6.7"
Expand Down

0 comments on commit 5b919ce

Please sign in to comment.