@langchain/langgraph-sdk 0.0.27 → 0.0.29
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/dist/client.cjs +2 -1
- package/dist/client.js +2 -1
- package/dist/utils/async_caller.cjs +1 -0
- package/dist/utils/async_caller.js +1 -0
- package/dist/utils/env.cjs +16 -0
- package/dist/utils/env.d.ts +1 -0
- package/dist/utils/env.js +12 -0
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -5,6 +5,7 @@ const async_caller_js_1 = require("./utils/async_caller.cjs");
|
|
|
5
5
|
const index_js_1 = require("./utils/eventsource-parser/index.cjs");
|
|
6
6
|
const stream_js_1 = require("./utils/stream.cjs");
|
|
7
7
|
const signals_js_1 = require("./utils/signals.cjs");
|
|
8
|
+
const env_js_1 = require("./utils/env.cjs");
|
|
8
9
|
/**
|
|
9
10
|
* Get the API key from the environment.
|
|
10
11
|
* Precedence:
|
|
@@ -22,7 +23,7 @@ function getApiKey(apiKey) {
|
|
|
22
23
|
}
|
|
23
24
|
const prefixes = ["LANGGRAPH", "LANGSMITH", "LANGCHAIN"];
|
|
24
25
|
for (const prefix of prefixes) {
|
|
25
|
-
const envKey =
|
|
26
|
+
const envKey = (0, env_js_1.getEnvironmentVariable)(`${prefix}_API_KEY`);
|
|
26
27
|
if (envKey) {
|
|
27
28
|
// Remove surrounding quotes
|
|
28
29
|
return envKey.trim().replace(/^["']|["']$/g, "");
|
package/dist/client.js
CHANGED
|
@@ -2,6 +2,7 @@ import { AsyncCaller } from "./utils/async_caller.js";
|
|
|
2
2
|
import { createParser, } from "./utils/eventsource-parser/index.js";
|
|
3
3
|
import { IterableReadableStream } from "./utils/stream.js";
|
|
4
4
|
import { mergeSignals } from "./utils/signals.js";
|
|
5
|
+
import { getEnvironmentVariable } from "./utils/env.js";
|
|
5
6
|
/**
|
|
6
7
|
* Get the API key from the environment.
|
|
7
8
|
* Precedence:
|
|
@@ -19,7 +20,7 @@ export function getApiKey(apiKey) {
|
|
|
19
20
|
}
|
|
20
21
|
const prefixes = ["LANGGRAPH", "LANGSMITH", "LANGCHAIN"];
|
|
21
22
|
for (const prefix of prefixes) {
|
|
22
|
-
const envKey =
|
|
23
|
+
const envKey = getEnvironmentVariable(`${prefix}_API_KEY`);
|
|
23
24
|
if (envKey) {
|
|
24
25
|
// Remove surrounding quotes
|
|
25
26
|
return envKey.trim().replace(/^["']|["']$/g, "");
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEnvironmentVariable = void 0;
|
|
4
|
+
function getEnvironmentVariable(name) {
|
|
5
|
+
// Certain setups (Deno, frontend) will throw an error if you try to access environment variables
|
|
6
|
+
try {
|
|
7
|
+
return typeof process !== "undefined"
|
|
8
|
+
? // eslint-disable-next-line no-process-env
|
|
9
|
+
process.env?.[name]
|
|
10
|
+
: undefined;
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.getEnvironmentVariable = getEnvironmentVariable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getEnvironmentVariable(name: string): string | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function getEnvironmentVariable(name) {
|
|
2
|
+
// Certain setups (Deno, frontend) will throw an error if you try to access environment variables
|
|
3
|
+
try {
|
|
4
|
+
return typeof process !== "undefined"
|
|
5
|
+
? // eslint-disable-next-line no-process-env
|
|
6
|
+
process.env?.[name]
|
|
7
|
+
: undefined;
|
|
8
|
+
}
|
|
9
|
+
catch (e) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
}
|