@@ -2,18 +2,6 @@ import { backOff } from "exponential-backoff";
2
2
3
3
import { fetchWithTimeout , extname , FileLoader , LoadValues } from "./index.js" ;
4
4
5
- const LANGCHAIN_HUB_DEFAULT_REF =
6
- ( typeof process !== "undefined"
7
- ? // eslint-disable-next-line no-process-env
8
- process . env . LANGCHAIN_HUB_DEFAULT_REF
9
- : undefined ) ?? "master" ;
10
- const LANGCHAIN_HUB_URL_BASE =
11
- ( typeof process !== "undefined"
12
- ? // eslint-disable-next-line no-process-env
13
- process . env . LANGCHAIN_HUB_URL_BASE
14
- : undefined ) ??
15
- "https://raw.githubusercontent.com/hwchase17/langchain-hub/" ;
16
-
17
5
const HUB_PATH_REGEX = / l c ( @ [ ^ : ] + ) ? : \/ \/ ( .* ) / ;
18
6
19
7
const URL_PATH_SEPARATOR = "/" ;
@@ -25,6 +13,18 @@ export const loadFromHub = async <T>(
25
13
validSuffixes : Set < string > ,
26
14
values : LoadValues = { }
27
15
) : Promise < T | undefined > => {
16
+ const LANGCHAIN_HUB_DEFAULT_REF =
17
+ ( typeof process !== "undefined"
18
+ ? // eslint-disable-next-line no-process-env
19
+ process . env . LANGCHAIN_HUB_DEFAULT_REF
20
+ : undefined ) ?? "master" ;
21
+ const LANGCHAIN_HUB_URL_BASE =
22
+ ( typeof process !== "undefined"
23
+ ? // eslint-disable-next-line no-process-env
24
+ process . env . LANGCHAIN_HUB_URL_BASE
25
+ : undefined ) ??
26
+ "https://raw.githubusercontent.com/hwchase17/langchain-hub/" ;
27
+
28
28
const match = uri . match ( HUB_PATH_REGEX ) ;
29
29
if ( ! match ) {
30
30
return undefined ;
0 commit comments