@langchain/classic 1.0.7 → 1.0.8
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 +10 -0
- package/dist/agents/chat/outputParser.d.ts +2 -2
- package/dist/agents/chat/outputParser.d.ts.map +1 -1
- package/dist/agents/mrkl/outputParser.d.ts +1 -1
- package/dist/agents/mrkl/outputParser.d.ts.map +1 -1
- package/dist/agents/openai_tools/index.d.ts +2 -2
- package/dist/agents/openai_tools/index.d.ts.map +1 -1
- package/dist/agents/react/index.d.cts +2 -2
- package/dist/agents/react/index.d.cts.map +1 -1
- package/dist/agents/react/index.d.ts +2 -2
- package/dist/agents/react/index.d.ts.map +1 -1
- package/dist/agents/structured_chat/index.d.cts +2 -2
- package/dist/agents/structured_chat/index.d.cts.map +1 -1
- package/dist/agents/structured_chat/index.d.ts +2 -2
- package/dist/agents/structured_chat/index.d.ts.map +1 -1
- package/dist/agents/tool_calling/index.d.cts +2 -2
- package/dist/agents/tool_calling/index.d.cts.map +1 -1
- package/dist/agents/tool_calling/index.d.ts +2 -2
- package/dist/agents/tool_calling/index.d.ts.map +1 -1
- package/dist/chat_models/universal.cjs +3 -2
- package/dist/chat_models/universal.cjs.map +1 -1
- package/dist/chat_models/universal.js +3 -2
- package/dist/chat_models/universal.js.map +1 -1
- package/dist/evaluation/agents/trajectory.d.ts +2 -2
- package/dist/evaluation/agents/trajectory.d.ts.map +1 -1
- package/dist/evaluation/comparison/pairwise.d.ts +3 -3
- package/dist/evaluation/comparison/pairwise.d.ts.map +1 -1
- package/dist/evaluation/criteria/criteria.d.ts +3 -3
- package/dist/evaluation/criteria/criteria.d.ts.map +1 -1
- package/dist/experimental/prompts/custom_format.d.cts.map +1 -1
- package/dist/experimental/prompts/handlebars.d.cts.map +1 -1
- package/dist/hub/index.cjs +8 -1
- package/dist/hub/index.cjs.map +1 -1
- package/dist/hub/index.d.cts +9 -0
- package/dist/hub/index.d.cts.map +1 -1
- package/dist/hub/index.d.ts +9 -0
- package/dist/hub/index.d.ts.map +1 -1
- package/dist/hub/index.js +8 -1
- package/dist/hub/index.js.map +1 -1
- package/dist/hub/node.cjs +30 -3
- package/dist/hub/node.cjs.map +1 -1
- package/dist/hub/node.d.cts +9 -0
- package/dist/hub/node.d.cts.map +1 -1
- package/dist/hub/node.d.ts +9 -0
- package/dist/hub/node.d.ts.map +1 -1
- package/dist/hub/node.js +30 -3
- package/dist/hub/node.js.map +1 -1
- package/dist/load/index.cjs +3 -2
- package/dist/load/index.cjs.map +1 -1
- package/dist/load/index.d.cts +1 -1
- package/dist/load/index.d.cts.map +1 -1
- package/dist/load/index.d.ts +1 -1
- package/dist/load/index.d.ts.map +1 -1
- package/dist/load/index.js +3 -2
- package/dist/load/index.js.map +1 -1
- package/package.json +13 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlebars.d.cts","names":["InputValues","CustomFormatPromptTemplate","CustomFormatPromptTemplateInput","parseHandlebars","_langchain_core_prompts0","ParsedTemplateNode","interpolateHandlebars","HandlebarsPromptTemplateInput","RunInput","HandlebarsPromptTemplate","Record","Omit","Symbol"],"sources":["../../../src/experimental/prompts/handlebars.d.ts"],"sourcesContent":["import type { InputValues } from \"@langchain/core/utils/types\";\nimport { CustomFormatPromptTemplate, CustomFormatPromptTemplateInput } from \"./custom_format.js\";\nexport declare const parseHandlebars: (template: string) => import(\"@langchain/core/prompts\").ParsedTemplateNode[];\nexport declare const interpolateHandlebars: (template: string, values: InputValues) => string;\nexport type HandlebarsPromptTemplateInput<RunInput extends InputValues> = CustomFormatPromptTemplateInput<RunInput>;\nexport declare class HandlebarsPromptTemplate<RunInput extends InputValues = any> extends CustomFormatPromptTemplate<RunInput> {\n static lc_name(): string;\n /**\n * Load prompt template from a template\n */\n static fromTemplate<RunInput extends InputValues = Record<string, any>>(template: string, params?: Omit<HandlebarsPromptTemplateInput<RunInput>, \"template\" | \"inputVariables\" | \"customParser\" | \"templateValidator\" | \"renderer\">): CustomFormatPromptTemplate<RunInput extends Symbol ? never : RunInput, any>;\n}\n//# sourceMappingURL=handlebars.d.ts.map"],"mappings":";;;;;cAEqBG,uCAA6FC,wBAAAA,CAApBC,kBAAkB;cAC3FC,kDAAkDN;KAC3DO,+CAA+CP,eAAeE,gCAAgCM;AAFrFL,cAGAM,wBAH6FL,CAAAA,iBAGnDJ,WAH+BK,GAAkB,
|
|
1
|
+
{"version":3,"file":"handlebars.d.cts","names":["InputValues","CustomFormatPromptTemplate","CustomFormatPromptTemplateInput","parseHandlebars","_langchain_core_prompts0","ParsedTemplateNode","interpolateHandlebars","HandlebarsPromptTemplateInput","RunInput","HandlebarsPromptTemplate","Record","Omit","Symbol"],"sources":["../../../src/experimental/prompts/handlebars.d.ts"],"sourcesContent":["import type { InputValues } from \"@langchain/core/utils/types\";\nimport { CustomFormatPromptTemplate, CustomFormatPromptTemplateInput } from \"./custom_format.js\";\nexport declare const parseHandlebars: (template: string) => import(\"@langchain/core/prompts\").ParsedTemplateNode[];\nexport declare const interpolateHandlebars: (template: string, values: InputValues) => string;\nexport type HandlebarsPromptTemplateInput<RunInput extends InputValues> = CustomFormatPromptTemplateInput<RunInput>;\nexport declare class HandlebarsPromptTemplate<RunInput extends InputValues = any> extends CustomFormatPromptTemplate<RunInput> {\n static lc_name(): string;\n /**\n * Load prompt template from a template\n */\n static fromTemplate<RunInput extends InputValues = Record<string, any>>(template: string, params?: Omit<HandlebarsPromptTemplateInput<RunInput>, \"template\" | \"inputVariables\" | \"customParser\" | \"templateValidator\" | \"renderer\">): CustomFormatPromptTemplate<RunInput extends Symbol ? never : RunInput, any>;\n}\n//# sourceMappingURL=handlebars.d.ts.map"],"mappings":";;;;;cAEqBG,uCAA6FC,wBAAAA,CAApBC,kBAAkB;cAC3FC,kDAAkDN;KAC3DO,+CAA+CP,eAAeE,gCAAgCM;AAFrFL,cAGAM,wBAH6FL,CAAAA,iBAGnDJ,WAH+BK,GAAAA,GAAkB,CAAA,SAGtBJ,0BAHsB,CAGKO,QAHL,CAAA,CAAA;EAC3FF,OAAAA,OAAAA,CAAAA,CAAAA,EAAAA,MAAwE;EACjFC;;;EAA8DL,OAAAA,YAAAA,CAAAA,iBAMjCF,WANiCE,GAMnBQ,MANmBR,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,CAAAA,CAAAA,QAAAA,EAAAA,MAAAA,EAAAA,MAAAA,CAAAA,EAM6BS,IAN7BT,CAMkCK,6BANlCL,CAMgEM,QANhEN,CAAAA,EAAAA,UAAAA,GAAAA,gBAAAA,GAAAA,cAAAA,GAAAA,mBAAAA,GAAAA,UAAAA,CAAAA,CAAAA,EAMgKD,0BANhKC,CAM2LM,QAN3LN,SAM4MU,MAN5MV,GAAAA,KAAAA,GAM6NM,QAN7NN,EAAAA,GAAAA,CAAAA;AAA+B"}
|
package/dist/hub/index.cjs
CHANGED
|
@@ -16,12 +16,19 @@ const require_base = require('./base.cjs');
|
|
|
16
16
|
* for non-OpenAI models. If you are running in Node or another environment that supports dynamic imports,
|
|
17
17
|
* you may instead import this function from "langchain/hub/node" and pass "includeModel: true" instead
|
|
18
18
|
* of specifying this parameter.
|
|
19
|
+
* @param options.secrets A map of secrets to use when loading, e.g.
|
|
20
|
+
* {'OPENAI_API_KEY': 'sk-...'}`.
|
|
21
|
+
* If a secret is not found in the map, it will be loaded from the
|
|
22
|
+
* environment if `secrets_from_env` is `True`. Should only be needed when
|
|
23
|
+
* `includeModel` is `true`.
|
|
24
|
+
* @param options.secretsFromEnv Whether to load secrets from environment variables.
|
|
25
|
+
* Use with caution and only with trusted prompts.
|
|
19
26
|
* @returns
|
|
20
27
|
*/
|
|
21
28
|
async function pull(ownerRepoCommit, options) {
|
|
22
29
|
const promptObject = await require_base.basePull(ownerRepoCommit, options);
|
|
23
30
|
try {
|
|
24
|
-
const loadedPrompt = await require_load_index.load(JSON.stringify(promptObject.manifest),
|
|
31
|
+
const loadedPrompt = await require_load_index.load(JSON.stringify(promptObject.manifest), options?.secrets, require_base.generateOptionalImportMap(options?.modelClass), require_base.generateModelImportMap(options?.modelClass), options?.secretsFromEnv);
|
|
25
32
|
return require_base.bindOutputSchema(loadedPrompt);
|
|
26
33
|
} catch (e) {
|
|
27
34
|
if (options?.includeModel) throw new Error([
|
package/dist/hub/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["ownerRepoCommit: string","options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n modelClass?: new (...args: any[]) => BaseLanguageModel;\n }","basePull","load","generateOptionalImportMap","generateModelImportMap","bindOutputSchema","e: any"],"sources":["../../src/hub/index.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport type { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport { load } from \"../load/index.js\";\nimport {\n basePush,\n basePull,\n generateModelImportMap,\n generateOptionalImportMap,\n bindOutputSchema,\n} from \"./base.js\";\n\nexport { basePush as push };\n\n/**\n * Pull a prompt from the hub.\n *\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. For non-OpenAI models, you must also set \"modelClass\" to the\n * correct class of the model.\n * @param options.modelClass If includeModel is true, the class of the model to instantiate. Required\n * for non-OpenAI models. If you are running in Node or another environment that supports dynamic imports,\n * you may instead import this function from \"langchain/hub/node\" and pass \"includeModel: true\" instead\n * of specifying this parameter.\n * @returns\n */\nexport async function pull<T extends Runnable>(\n ownerRepoCommit: string,\n options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n modelClass?: new (...args: any[]) => BaseLanguageModel;\n }\n) {\n const promptObject = await basePull(ownerRepoCommit, options);\n try {\n const loadedPrompt = await load<T>(\n JSON.stringify(promptObject.manifest),\n
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["ownerRepoCommit: string","options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n modelClass?: new (...args: any[]) => BaseLanguageModel;\n secrets?: Record<string, string>;\n secretsFromEnv?: boolean;\n }","basePull","load","generateOptionalImportMap","generateModelImportMap","bindOutputSchema","e: any"],"sources":["../../src/hub/index.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport type { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport { load } from \"../load/index.js\";\nimport {\n basePush,\n basePull,\n generateModelImportMap,\n generateOptionalImportMap,\n bindOutputSchema,\n} from \"./base.js\";\n\nexport { basePush as push };\n\n/**\n * Pull a prompt from the hub.\n *\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. For non-OpenAI models, you must also set \"modelClass\" to the\n * correct class of the model.\n * @param options.modelClass If includeModel is true, the class of the model to instantiate. Required\n * for non-OpenAI models. If you are running in Node or another environment that supports dynamic imports,\n * you may instead import this function from \"langchain/hub/node\" and pass \"includeModel: true\" instead\n * of specifying this parameter.\n * @param options.secrets A map of secrets to use when loading, e.g.\n * {'OPENAI_API_KEY': 'sk-...'}`.\n * If a secret is not found in the map, it will be loaded from the\n * environment if `secrets_from_env` is `True`. Should only be needed when\n * `includeModel` is `true`.\n * @param options.secretsFromEnv Whether to load secrets from environment variables.\n * Use with caution and only with trusted prompts.\n * @returns\n */\nexport async function pull<T extends Runnable>(\n ownerRepoCommit: string,\n options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n modelClass?: new (...args: any[]) => BaseLanguageModel;\n secrets?: Record<string, string>;\n secretsFromEnv?: boolean;\n }\n) {\n const promptObject = await basePull(ownerRepoCommit, options);\n try {\n const loadedPrompt = await load<T>(\n JSON.stringify(promptObject.manifest),\n options?.secrets,\n generateOptionalImportMap(options?.modelClass),\n generateModelImportMap(options?.modelClass),\n options?.secretsFromEnv\n );\n return bindOutputSchema(loadedPrompt);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (e: any) {\n if (options?.includeModel) {\n throw new Error(\n [\n e.message,\n \"\",\n `To load prompts with an associated non-OpenAI model, you must use the \"langchain/hub/node\" entrypoint, or pass a \"modelClass\" parameter like this:`,\n \"\",\n \"```\",\n `import { pull } from \"langchain/hub\";`,\n `import { ChatAnthropic } from \"@langchain/anthropic\";`,\n \"\",\n `const prompt = await pull(\"my-prompt\", {`,\n ` includeModel: true,`,\n ` modelClass: ChatAnthropic,`,\n `});`,\n \"```\",\n ].join(\"\\n\")\n );\n } else {\n throw e;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,eAAsB,KACpBA,iBACAC,SASA;CACA,MAAM,eAAe,MAAMC,sBAAS,iBAAiB,QAAQ;AAC7D,KAAI;EACF,MAAM,eAAe,MAAMC,wBACzB,KAAK,UAAU,aAAa,SAAS,EACrC,SAAS,SACTC,uCAA0B,SAAS,WAAW,EAC9CC,oCAAuB,SAAS,WAAW,EAC3C,SAAS,eACV;AACD,SAAOC,8BAAiB,aAAa;CAEtC,SAAQC,GAAQ;AACf,MAAI,SAAS,aACX,OAAM,IAAI,MACR;GACE,EAAE;GACF;GACA,CAAC,kJAAkJ,CAAC;GACpJ;GACA;GACA,CAAC,qCAAqC,CAAC;GACvC,CAAC,qDAAqD,CAAC;GACvD;GACA,CAAC,wCAAwC,CAAC;GAC1C,CAAC,qBAAqB,CAAC;GACvB,CAAC,4BAA4B,CAAC;GAC9B,CAAC,GAAG,CAAC;GACL;EACD,EAAC,KAAK,KAAK;MAGd,OAAM;CAET;AACF"}
|
package/dist/hub/index.d.cts
CHANGED
|
@@ -18,6 +18,13 @@ import { BaseLanguageModel } from "@langchain/core/language_models/base";
|
|
|
18
18
|
* for non-OpenAI models. If you are running in Node or another environment that supports dynamic imports,
|
|
19
19
|
* you may instead import this function from "langchain/hub/node" and pass "includeModel: true" instead
|
|
20
20
|
* of specifying this parameter.
|
|
21
|
+
* @param options.secrets A map of secrets to use when loading, e.g.
|
|
22
|
+
* {'OPENAI_API_KEY': 'sk-...'}`.
|
|
23
|
+
* If a secret is not found in the map, it will be loaded from the
|
|
24
|
+
* environment if `secrets_from_env` is `True`. Should only be needed when
|
|
25
|
+
* `includeModel` is `true`.
|
|
26
|
+
* @param options.secretsFromEnv Whether to load secrets from environment variables.
|
|
27
|
+
* Use with caution and only with trusted prompts.
|
|
21
28
|
* @returns
|
|
22
29
|
*/
|
|
23
30
|
declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {
|
|
@@ -25,6 +32,8 @@ declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {
|
|
|
25
32
|
apiUrl?: string;
|
|
26
33
|
includeModel?: boolean;
|
|
27
34
|
modelClass?: new (...args: any[]) => BaseLanguageModel;
|
|
35
|
+
secrets?: Record<string, string>;
|
|
36
|
+
secretsFromEnv?: boolean;
|
|
28
37
|
}): Promise<T>;
|
|
29
38
|
//#endregion
|
|
30
39
|
export { pull, basePush as push };
|
package/dist/hub/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":["Runnable","BaseLanguageModel","basePush","push","pull","T","Promise"],"sources":["../../src/hub/index.d.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport type { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport { basePush } from \"./base.js\";\nexport { basePush as push };\n/**\n * Pull a prompt from the hub.\n *\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. For non-OpenAI models, you must also set \"modelClass\" to the\n * correct class of the model.\n * @param options.modelClass If includeModel is true, the class of the model to instantiate. Required\n * for non-OpenAI models. If you are running in Node or another environment that supports dynamic imports,\n * you may instead import this function from \"langchain/hub/node\" and pass \"includeModel: true\" instead\n * of specifying this parameter.\n * @returns\n */\nexport declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n modelClass?: new (...args: any[]) => BaseLanguageModel;\n}): Promise<T>;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":["Runnable","BaseLanguageModel","basePush","push","pull","T","Record","Promise"],"sources":["../../src/hub/index.d.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport type { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport { basePush } from \"./base.js\";\nexport { basePush as push };\n/**\n * Pull a prompt from the hub.\n *\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. For non-OpenAI models, you must also set \"modelClass\" to the\n * correct class of the model.\n * @param options.modelClass If includeModel is true, the class of the model to instantiate. Required\n * for non-OpenAI models. If you are running in Node or another environment that supports dynamic imports,\n * you may instead import this function from \"langchain/hub/node\" and pass \"includeModel: true\" instead\n * of specifying this parameter.\n * @param options.secrets A map of secrets to use when loading, e.g.\n * {'OPENAI_API_KEY': 'sk-...'}`.\n * If a secret is not found in the map, it will be loaded from the\n * environment if `secrets_from_env` is `True`. Should only be needed when\n * `includeModel` is `true`.\n * @param options.secretsFromEnv Whether to load secrets from environment variables.\n * Use with caution and only with trusted prompts.\n * @returns\n */\nexport declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n modelClass?: new (...args: any[]) => BaseLanguageModel;\n secrets?: Record<string, string>;\n secretsFromEnv?: boolean;\n}): Promise<T>;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;;;;;AA2BA;;;;;;AAOW;;;;;;;;;;;;;;;;iBAPaI,eAAeJ;;;;uCAIEC;YAC3BK;;IAEVC,QAAQF"}
|
package/dist/hub/index.d.ts
CHANGED
|
@@ -18,6 +18,13 @@ import { BaseLanguageModel } from "@langchain/core/language_models/base";
|
|
|
18
18
|
* for non-OpenAI models. If you are running in Node or another environment that supports dynamic imports,
|
|
19
19
|
* you may instead import this function from "langchain/hub/node" and pass "includeModel: true" instead
|
|
20
20
|
* of specifying this parameter.
|
|
21
|
+
* @param options.secrets A map of secrets to use when loading, e.g.
|
|
22
|
+
* {'OPENAI_API_KEY': 'sk-...'}`.
|
|
23
|
+
* If a secret is not found in the map, it will be loaded from the
|
|
24
|
+
* environment if `secrets_from_env` is `True`. Should only be needed when
|
|
25
|
+
* `includeModel` is `true`.
|
|
26
|
+
* @param options.secretsFromEnv Whether to load secrets from environment variables.
|
|
27
|
+
* Use with caution and only with trusted prompts.
|
|
21
28
|
* @returns
|
|
22
29
|
*/
|
|
23
30
|
declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {
|
|
@@ -25,6 +32,8 @@ declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {
|
|
|
25
32
|
apiUrl?: string;
|
|
26
33
|
includeModel?: boolean;
|
|
27
34
|
modelClass?: new (...args: any[]) => BaseLanguageModel;
|
|
35
|
+
secrets?: Record<string, string>;
|
|
36
|
+
secretsFromEnv?: boolean;
|
|
28
37
|
}): Promise<T>;
|
|
29
38
|
//#endregion
|
|
30
39
|
export { pull, basePush as push };
|
package/dist/hub/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["Runnable","BaseLanguageModel","basePush","push","pull","T","Promise"],"sources":["../../src/hub/index.d.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport type { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport { basePush } from \"./base.js\";\nexport { basePush as push };\n/**\n * Pull a prompt from the hub.\n *\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. For non-OpenAI models, you must also set \"modelClass\" to the\n * correct class of the model.\n * @param options.modelClass If includeModel is true, the class of the model to instantiate. Required\n * for non-OpenAI models. If you are running in Node or another environment that supports dynamic imports,\n * you may instead import this function from \"langchain/hub/node\" and pass \"includeModel: true\" instead\n * of specifying this parameter.\n * @returns\n */\nexport declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n modelClass?: new (...args: any[]) => BaseLanguageModel;\n}): Promise<T>;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["Runnable","BaseLanguageModel","basePush","push","pull","T","Record","Promise"],"sources":["../../src/hub/index.d.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport type { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport { basePush } from \"./base.js\";\nexport { basePush as push };\n/**\n * Pull a prompt from the hub.\n *\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. For non-OpenAI models, you must also set \"modelClass\" to the\n * correct class of the model.\n * @param options.modelClass If includeModel is true, the class of the model to instantiate. Required\n * for non-OpenAI models. If you are running in Node or another environment that supports dynamic imports,\n * you may instead import this function from \"langchain/hub/node\" and pass \"includeModel: true\" instead\n * of specifying this parameter.\n * @param options.secrets A map of secrets to use when loading, e.g.\n * {'OPENAI_API_KEY': 'sk-...'}`.\n * If a secret is not found in the map, it will be loaded from the\n * environment if `secrets_from_env` is `True`. Should only be needed when\n * `includeModel` is `true`.\n * @param options.secretsFromEnv Whether to load secrets from environment variables.\n * Use with caution and only with trusted prompts.\n * @returns\n */\nexport declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n modelClass?: new (...args: any[]) => BaseLanguageModel;\n secrets?: Record<string, string>;\n secretsFromEnv?: boolean;\n}): Promise<T>;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;;;;;AA2BA;;;;;;AAOW;;;;;;;;;;;;;;;;iBAPaI,eAAeJ;;;;uCAIEC;YAC3BK;;IAEVC,QAAQF"}
|
package/dist/hub/index.js
CHANGED
|
@@ -16,12 +16,19 @@ import { basePull, basePush, bindOutputSchema, generateModelImportMap, generateO
|
|
|
16
16
|
* for non-OpenAI models. If you are running in Node or another environment that supports dynamic imports,
|
|
17
17
|
* you may instead import this function from "langchain/hub/node" and pass "includeModel: true" instead
|
|
18
18
|
* of specifying this parameter.
|
|
19
|
+
* @param options.secrets A map of secrets to use when loading, e.g.
|
|
20
|
+
* {'OPENAI_API_KEY': 'sk-...'}`.
|
|
21
|
+
* If a secret is not found in the map, it will be loaded from the
|
|
22
|
+
* environment if `secrets_from_env` is `True`. Should only be needed when
|
|
23
|
+
* `includeModel` is `true`.
|
|
24
|
+
* @param options.secretsFromEnv Whether to load secrets from environment variables.
|
|
25
|
+
* Use with caution and only with trusted prompts.
|
|
19
26
|
* @returns
|
|
20
27
|
*/
|
|
21
28
|
async function pull(ownerRepoCommit, options) {
|
|
22
29
|
const promptObject = await basePull(ownerRepoCommit, options);
|
|
23
30
|
try {
|
|
24
|
-
const loadedPrompt = await load(JSON.stringify(promptObject.manifest),
|
|
31
|
+
const loadedPrompt = await load(JSON.stringify(promptObject.manifest), options?.secrets, generateOptionalImportMap(options?.modelClass), generateModelImportMap(options?.modelClass), options?.secretsFromEnv);
|
|
25
32
|
return bindOutputSchema(loadedPrompt);
|
|
26
33
|
} catch (e) {
|
|
27
34
|
if (options?.includeModel) throw new Error([
|
package/dist/hub/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ownerRepoCommit: string","options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n modelClass?: new (...args: any[]) => BaseLanguageModel;\n }","e: any"],"sources":["../../src/hub/index.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport type { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport { load } from \"../load/index.js\";\nimport {\n basePush,\n basePull,\n generateModelImportMap,\n generateOptionalImportMap,\n bindOutputSchema,\n} from \"./base.js\";\n\nexport { basePush as push };\n\n/**\n * Pull a prompt from the hub.\n *\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. For non-OpenAI models, you must also set \"modelClass\" to the\n * correct class of the model.\n * @param options.modelClass If includeModel is true, the class of the model to instantiate. Required\n * for non-OpenAI models. If you are running in Node or another environment that supports dynamic imports,\n * you may instead import this function from \"langchain/hub/node\" and pass \"includeModel: true\" instead\n * of specifying this parameter.\n * @returns\n */\nexport async function pull<T extends Runnable>(\n ownerRepoCommit: string,\n options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n modelClass?: new (...args: any[]) => BaseLanguageModel;\n }\n) {\n const promptObject = await basePull(ownerRepoCommit, options);\n try {\n const loadedPrompt = await load<T>(\n JSON.stringify(promptObject.manifest),\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["ownerRepoCommit: string","options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n modelClass?: new (...args: any[]) => BaseLanguageModel;\n secrets?: Record<string, string>;\n secretsFromEnv?: boolean;\n }","e: any"],"sources":["../../src/hub/index.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport type { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport { load } from \"../load/index.js\";\nimport {\n basePush,\n basePull,\n generateModelImportMap,\n generateOptionalImportMap,\n bindOutputSchema,\n} from \"./base.js\";\n\nexport { basePush as push };\n\n/**\n * Pull a prompt from the hub.\n *\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. For non-OpenAI models, you must also set \"modelClass\" to the\n * correct class of the model.\n * @param options.modelClass If includeModel is true, the class of the model to instantiate. Required\n * for non-OpenAI models. If you are running in Node or another environment that supports dynamic imports,\n * you may instead import this function from \"langchain/hub/node\" and pass \"includeModel: true\" instead\n * of specifying this parameter.\n * @param options.secrets A map of secrets to use when loading, e.g.\n * {'OPENAI_API_KEY': 'sk-...'}`.\n * If a secret is not found in the map, it will be loaded from the\n * environment if `secrets_from_env` is `True`. Should only be needed when\n * `includeModel` is `true`.\n * @param options.secretsFromEnv Whether to load secrets from environment variables.\n * Use with caution and only with trusted prompts.\n * @returns\n */\nexport async function pull<T extends Runnable>(\n ownerRepoCommit: string,\n options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n modelClass?: new (...args: any[]) => BaseLanguageModel;\n secrets?: Record<string, string>;\n secretsFromEnv?: boolean;\n }\n) {\n const promptObject = await basePull(ownerRepoCommit, options);\n try {\n const loadedPrompt = await load<T>(\n JSON.stringify(promptObject.manifest),\n options?.secrets,\n generateOptionalImportMap(options?.modelClass),\n generateModelImportMap(options?.modelClass),\n options?.secretsFromEnv\n );\n return bindOutputSchema(loadedPrompt);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (e: any) {\n if (options?.includeModel) {\n throw new Error(\n [\n e.message,\n \"\",\n `To load prompts with an associated non-OpenAI model, you must use the \"langchain/hub/node\" entrypoint, or pass a \"modelClass\" parameter like this:`,\n \"\",\n \"```\",\n `import { pull } from \"langchain/hub\";`,\n `import { ChatAnthropic } from \"@langchain/anthropic\";`,\n \"\",\n `const prompt = await pull(\"my-prompt\", {`,\n ` includeModel: true,`,\n ` modelClass: ChatAnthropic,`,\n `});`,\n \"```\",\n ].join(\"\\n\")\n );\n } else {\n throw e;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,eAAsB,KACpBA,iBACAC,SASA;CACA,MAAM,eAAe,MAAM,SAAS,iBAAiB,QAAQ;AAC7D,KAAI;EACF,MAAM,eAAe,MAAM,KACzB,KAAK,UAAU,aAAa,SAAS,EACrC,SAAS,SACT,0BAA0B,SAAS,WAAW,EAC9C,uBAAuB,SAAS,WAAW,EAC3C,SAAS,eACV;AACD,SAAO,iBAAiB,aAAa;CAEtC,SAAQC,GAAQ;AACf,MAAI,SAAS,aACX,OAAM,IAAI,MACR;GACE,EAAE;GACF;GACA,CAAC,kJAAkJ,CAAC;GACpJ;GACA;GACA,CAAC,qCAAqC,CAAC;GACvC,CAAC,qDAAqD,CAAC;GACvD;GACA,CAAC,wCAAwC,CAAC;GAC1C,CAAC,qBAAqB,CAAC;GACvB,CAAC,4BAA4B,CAAC;GAC9B,CAAC,GAAG,CAAC;GACL;EACD,EAAC,KAAK,KAAK;MAGd,OAAM;CAET;AACF"}
|
package/dist/hub/node.cjs
CHANGED
|
@@ -3,6 +3,25 @@ const require_load_index = require('../load/index.cjs');
|
|
|
3
3
|
const require_base = require('./base.cjs');
|
|
4
4
|
|
|
5
5
|
//#region src/hub/node.ts
|
|
6
|
+
function _idEquals(a, b) {
|
|
7
|
+
if (!Array.isArray(a) || !Array.isArray(b)) return false;
|
|
8
|
+
if (a.length !== b.length) return false;
|
|
9
|
+
for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
function isRunnableBinding(a) {
|
|
13
|
+
const wellKnownIds = [[
|
|
14
|
+
"langchain_core",
|
|
15
|
+
"runnables",
|
|
16
|
+
"RunnableBinding"
|
|
17
|
+
], [
|
|
18
|
+
"langchain",
|
|
19
|
+
"schema",
|
|
20
|
+
"runnable",
|
|
21
|
+
"RunnableBinding"
|
|
22
|
+
]];
|
|
23
|
+
return wellKnownIds.some((id) => _idEquals(a, id));
|
|
24
|
+
}
|
|
6
25
|
/**
|
|
7
26
|
* Pull a prompt from the hub.
|
|
8
27
|
* @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.
|
|
@@ -11,21 +30,29 @@ const require_base = require('./base.cjs');
|
|
|
11
30
|
* @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,
|
|
12
31
|
* if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will
|
|
13
32
|
* also invoke the instantiated model. You must have the appropriate LangChain integration package installed.
|
|
33
|
+
* @param options.secrets A map of secrets to use when loading, e.g.
|
|
34
|
+
* {'OPENAI_API_KEY': 'sk-...'}`.
|
|
35
|
+
* If a secret is not found in the map, it will be loaded from the
|
|
36
|
+
* environment if `secrets_from_env` is `True`. Should only be needed when
|
|
37
|
+
* `includeModel` is `true`.
|
|
38
|
+
* @param options.secretsFromEnv Whether to load secrets from environment variables.
|
|
39
|
+
* Use with caution and only with trusted prompts.
|
|
14
40
|
* @returns
|
|
15
41
|
*/
|
|
16
42
|
async function pull(ownerRepoCommit, options) {
|
|
17
43
|
const promptObject = await require_base.basePull(ownerRepoCommit, options);
|
|
18
44
|
let modelClass;
|
|
19
45
|
if (options?.includeModel) {
|
|
20
|
-
|
|
21
|
-
|
|
46
|
+
const chatModelObject = isRunnableBinding(promptObject.manifest.kwargs?.last?.id) ? promptObject.manifest.kwargs?.last?.kwargs?.bound : promptObject.manifest.kwargs?.last;
|
|
47
|
+
if (Array.isArray(chatModelObject?.id)) {
|
|
48
|
+
const modelName = chatModelObject?.id.at(-1);
|
|
22
49
|
if (modelName) {
|
|
23
50
|
modelClass = await require_chat_models_universal.getChatModelByClassName(modelName);
|
|
24
51
|
if (!modelClass) console.warn(`Received unknown model name from prompt hub: "${modelName}"`);
|
|
25
52
|
}
|
|
26
53
|
}
|
|
27
54
|
}
|
|
28
|
-
const loadedPrompt = await require_load_index.load(JSON.stringify(promptObject.manifest),
|
|
55
|
+
const loadedPrompt = await require_load_index.load(JSON.stringify(promptObject.manifest), options?.secrets, require_base.generateOptionalImportMap(modelClass), require_base.generateModelImportMap(modelClass), options?.secretsFromEnv);
|
|
29
56
|
return require_base.bindOutputSchema(loadedPrompt);
|
|
30
57
|
}
|
|
31
58
|
|
package/dist/hub/node.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.cjs","names":["ownerRepoCommit: string","options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n }","basePull","getChatModelByClassName","load","generateOptionalImportMap","generateModelImportMap","bindOutputSchema"],"sources":["../../src/hub/node.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport {\n basePull,\n generateModelImportMap,\n generateOptionalImportMap,\n bindOutputSchema,\n} from \"./base.js\";\nimport { load } from \"../load/index.js\";\nimport { getChatModelByClassName } from \"../chat_models/universal.js\";\n\n
|
|
1
|
+
{"version":3,"file":"node.cjs","names":["a: string[]","b: string[]","ownerRepoCommit: string","options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n secrets?: Record<string, string>;\n secretsFromEnv?: boolean;\n }","basePull","getChatModelByClassName","load","generateOptionalImportMap","generateModelImportMap","bindOutputSchema"],"sources":["../../src/hub/node.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport {\n basePull,\n generateModelImportMap,\n generateOptionalImportMap,\n bindOutputSchema,\n} from \"./base.js\";\nimport { load } from \"../load/index.js\";\nimport { getChatModelByClassName } from \"../chat_models/universal.js\";\n\nexport { basePush as push } from \"./base.js\";\n\nfunction _idEquals(a: string[], b: string[]): boolean {\n if (!Array.isArray(a) || !Array.isArray(b)) {\n return false;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction isRunnableBinding(a: string[]): boolean {\n const wellKnownIds = [\n [\"langchain_core\", \"runnables\", \"RunnableBinding\"],\n [\"langchain\", \"schema\", \"runnable\", \"RunnableBinding\"],\n ];\n return wellKnownIds.some((id) => _idEquals(a, id));\n}\n\n/**\n * Pull a prompt from the hub.\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. You must have the appropriate LangChain integration package installed.\n * @param options.secrets A map of secrets to use when loading, e.g.\n * {'OPENAI_API_KEY': 'sk-...'}`.\n * If a secret is not found in the map, it will be loaded from the\n * environment if `secrets_from_env` is `True`. Should only be needed when\n * `includeModel` is `true`.\n * @param options.secretsFromEnv Whether to load secrets from environment variables.\n * Use with caution and only with trusted prompts.\n * @returns\n */\nexport async function pull<T extends Runnable>(\n ownerRepoCommit: string,\n options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n secrets?: Record<string, string>;\n secretsFromEnv?: boolean;\n }\n) {\n const promptObject = await basePull(ownerRepoCommit, options);\n let modelClass;\n if (options?.includeModel) {\n const chatModelObject = isRunnableBinding(\n promptObject.manifest.kwargs?.last?.id\n )\n ? promptObject.manifest.kwargs?.last?.kwargs?.bound\n : promptObject.manifest.kwargs?.last;\n\n if (Array.isArray(chatModelObject?.id)) {\n const modelName = chatModelObject?.id.at(-1);\n\n if (modelName) {\n modelClass = await getChatModelByClassName(modelName);\n if (!modelClass) {\n console.warn(\n `Received unknown model name from prompt hub: \"${modelName}\"`\n );\n }\n }\n }\n }\n const loadedPrompt = await load<T>(\n JSON.stringify(promptObject.manifest),\n options?.secrets,\n generateOptionalImportMap(modelClass),\n generateModelImportMap(modelClass),\n options?.secretsFromEnv\n );\n return bindOutputSchema(loadedPrompt);\n}\n"],"mappings":";;;;;AAYA,SAAS,UAAUA,GAAaC,GAAsB;AACpD,KAAI,CAAC,MAAM,QAAQ,EAAE,IAAI,CAAC,MAAM,QAAQ,EAAE,CACxC,QAAO;AAET,KAAI,EAAE,WAAW,EAAE,OACjB,QAAO;AAET,MAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,IAC5B,KAAI,EAAE,OAAO,EAAE,GACb,QAAO;AAGX,QAAO;AACR;AAED,SAAS,kBAAkBD,GAAsB;CAC/C,MAAM,eAAe,CACnB;EAAC;EAAkB;EAAa;CAAkB,GAClD;EAAC;EAAa;EAAU;EAAY;CAAkB,CACvD;AACD,QAAO,aAAa,KAAK,CAAC,OAAO,UAAU,GAAG,GAAG,CAAC;AACnD;;;;;;;;;;;;;;;;;;AAmBD,eAAsB,KACpBE,iBACAC,SAOA;CACA,MAAM,eAAe,MAAMC,sBAAS,iBAAiB,QAAQ;CAC7D,IAAI;AACJ,KAAI,SAAS,cAAc;EACzB,MAAM,kBAAkB,kBACtB,aAAa,SAAS,QAAQ,MAAM,GACrC,GACG,aAAa,SAAS,QAAQ,MAAM,QAAQ,QAC5C,aAAa,SAAS,QAAQ;AAElC,MAAI,MAAM,QAAQ,iBAAiB,GAAG,EAAE;GACtC,MAAM,YAAY,iBAAiB,GAAG,GAAG,GAAG;AAE5C,OAAI,WAAW;IACb,aAAa,MAAMC,sDAAwB,UAAU;AACrD,QAAI,CAAC,YACH,QAAQ,KACN,CAAC,8CAA8C,EAAE,UAAU,CAAC,CAAC,CAC9D;GAEJ;EACF;CACF;CACD,MAAM,eAAe,MAAMC,wBACzB,KAAK,UAAU,aAAa,SAAS,EACrC,SAAS,SACTC,uCAA0B,WAAW,EACrCC,oCAAuB,WAAW,EAClC,SAAS,eACV;AACD,QAAOC,8BAAiB,aAAa;AACtC"}
|
package/dist/hub/node.d.cts
CHANGED
|
@@ -11,12 +11,21 @@ import { Runnable } from "@langchain/core/runnables";
|
|
|
11
11
|
* @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,
|
|
12
12
|
* if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will
|
|
13
13
|
* also invoke the instantiated model. You must have the appropriate LangChain integration package installed.
|
|
14
|
+
* @param options.secrets A map of secrets to use when loading, e.g.
|
|
15
|
+
* {'OPENAI_API_KEY': 'sk-...'}`.
|
|
16
|
+
* If a secret is not found in the map, it will be loaded from the
|
|
17
|
+
* environment if `secrets_from_env` is `True`. Should only be needed when
|
|
18
|
+
* `includeModel` is `true`.
|
|
19
|
+
* @param options.secretsFromEnv Whether to load secrets from environment variables.
|
|
20
|
+
* Use with caution and only with trusted prompts.
|
|
14
21
|
* @returns
|
|
15
22
|
*/
|
|
16
23
|
declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {
|
|
17
24
|
apiKey?: string;
|
|
18
25
|
apiUrl?: string;
|
|
19
26
|
includeModel?: boolean;
|
|
27
|
+
secrets?: Record<string, string>;
|
|
28
|
+
secretsFromEnv?: boolean;
|
|
20
29
|
}): Promise<T>;
|
|
21
30
|
//#endregion
|
|
22
31
|
export { pull, basePush as push };
|
package/dist/hub/node.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.cts","names":["Runnable","basePush","push","pull","T","Promise"],"sources":["../../src/hub/node.d.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nexport { basePush as push } from \"./base.js\";\n/**\n * Pull a prompt from the hub.\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. You must have the appropriate LangChain integration package installed.\n * @returns\n */\nexport declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n}): Promise<T>;\n//# sourceMappingURL=node.d.ts.map"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"node.d.cts","names":["Runnable","basePush","push","pull","T","Record","Promise"],"sources":["../../src/hub/node.d.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nexport { basePush as push } from \"./base.js\";\n/**\n * Pull a prompt from the hub.\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. You must have the appropriate LangChain integration package installed.\n * @param options.secrets A map of secrets to use when loading, e.g.\n * {'OPENAI_API_KEY': 'sk-...'}`.\n * If a secret is not found in the map, it will be loaded from the\n * environment if `secrets_from_env` is `True`. Should only be needed when\n * `includeModel` is `true`.\n * @param options.secretsFromEnv Whether to load secrets from environment variables.\n * Use with caution and only with trusted prompts.\n * @returns\n */\nexport declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n secrets?: Record<string, string>;\n secretsFromEnv?: boolean;\n}): Promise<T>;\n//# sourceMappingURL=node.d.ts.map"],"mappings":";;;;;;;AAmBA;;;;;AAMW;;;;;;;;;;iBANaG,eAAeH;;;;YAIzBK;;IAEVC,QAAQF"}
|
package/dist/hub/node.d.ts
CHANGED
|
@@ -11,12 +11,21 @@ import { Runnable } from "@langchain/core/runnables";
|
|
|
11
11
|
* @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,
|
|
12
12
|
* if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will
|
|
13
13
|
* also invoke the instantiated model. You must have the appropriate LangChain integration package installed.
|
|
14
|
+
* @param options.secrets A map of secrets to use when loading, e.g.
|
|
15
|
+
* {'OPENAI_API_KEY': 'sk-...'}`.
|
|
16
|
+
* If a secret is not found in the map, it will be loaded from the
|
|
17
|
+
* environment if `secrets_from_env` is `True`. Should only be needed when
|
|
18
|
+
* `includeModel` is `true`.
|
|
19
|
+
* @param options.secretsFromEnv Whether to load secrets from environment variables.
|
|
20
|
+
* Use with caution and only with trusted prompts.
|
|
14
21
|
* @returns
|
|
15
22
|
*/
|
|
16
23
|
declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {
|
|
17
24
|
apiKey?: string;
|
|
18
25
|
apiUrl?: string;
|
|
19
26
|
includeModel?: boolean;
|
|
27
|
+
secrets?: Record<string, string>;
|
|
28
|
+
secretsFromEnv?: boolean;
|
|
20
29
|
}): Promise<T>;
|
|
21
30
|
//#endregion
|
|
22
31
|
export { pull, basePush as push };
|
package/dist/hub/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","names":["Runnable","basePush","push","pull","T","Promise"],"sources":["../../src/hub/node.d.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nexport { basePush as push } from \"./base.js\";\n/**\n * Pull a prompt from the hub.\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. You must have the appropriate LangChain integration package installed.\n * @returns\n */\nexport declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n}): Promise<T>;\n//# sourceMappingURL=node.d.ts.map"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"node.d.ts","names":["Runnable","basePush","push","pull","T","Record","Promise"],"sources":["../../src/hub/node.d.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nexport { basePush as push } from \"./base.js\";\n/**\n * Pull a prompt from the hub.\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. You must have the appropriate LangChain integration package installed.\n * @param options.secrets A map of secrets to use when loading, e.g.\n * {'OPENAI_API_KEY': 'sk-...'}`.\n * If a secret is not found in the map, it will be loaded from the\n * environment if `secrets_from_env` is `True`. Should only be needed when\n * `includeModel` is `true`.\n * @param options.secretsFromEnv Whether to load secrets from environment variables.\n * Use with caution and only with trusted prompts.\n * @returns\n */\nexport declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n secrets?: Record<string, string>;\n secretsFromEnv?: boolean;\n}): Promise<T>;\n//# sourceMappingURL=node.d.ts.map"],"mappings":";;;;;;;AAmBA;;;;;AAMW;;;;;;;;;;iBANaG,eAAeH;;;;YAIzBK;;IAEVC,QAAQF"}
|
package/dist/hub/node.js
CHANGED
|
@@ -3,6 +3,25 @@ import { load } from "../load/index.js";
|
|
|
3
3
|
import { basePull, basePush, bindOutputSchema, generateModelImportMap, generateOptionalImportMap } from "./base.js";
|
|
4
4
|
|
|
5
5
|
//#region src/hub/node.ts
|
|
6
|
+
function _idEquals(a, b) {
|
|
7
|
+
if (!Array.isArray(a) || !Array.isArray(b)) return false;
|
|
8
|
+
if (a.length !== b.length) return false;
|
|
9
|
+
for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
function isRunnableBinding(a) {
|
|
13
|
+
const wellKnownIds = [[
|
|
14
|
+
"langchain_core",
|
|
15
|
+
"runnables",
|
|
16
|
+
"RunnableBinding"
|
|
17
|
+
], [
|
|
18
|
+
"langchain",
|
|
19
|
+
"schema",
|
|
20
|
+
"runnable",
|
|
21
|
+
"RunnableBinding"
|
|
22
|
+
]];
|
|
23
|
+
return wellKnownIds.some((id) => _idEquals(a, id));
|
|
24
|
+
}
|
|
6
25
|
/**
|
|
7
26
|
* Pull a prompt from the hub.
|
|
8
27
|
* @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.
|
|
@@ -11,21 +30,29 @@ import { basePull, basePush, bindOutputSchema, generateModelImportMap, generateO
|
|
|
11
30
|
* @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,
|
|
12
31
|
* if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will
|
|
13
32
|
* also invoke the instantiated model. You must have the appropriate LangChain integration package installed.
|
|
33
|
+
* @param options.secrets A map of secrets to use when loading, e.g.
|
|
34
|
+
* {'OPENAI_API_KEY': 'sk-...'}`.
|
|
35
|
+
* If a secret is not found in the map, it will be loaded from the
|
|
36
|
+
* environment if `secrets_from_env` is `True`. Should only be needed when
|
|
37
|
+
* `includeModel` is `true`.
|
|
38
|
+
* @param options.secretsFromEnv Whether to load secrets from environment variables.
|
|
39
|
+
* Use with caution and only with trusted prompts.
|
|
14
40
|
* @returns
|
|
15
41
|
*/
|
|
16
42
|
async function pull(ownerRepoCommit, options) {
|
|
17
43
|
const promptObject = await basePull(ownerRepoCommit, options);
|
|
18
44
|
let modelClass;
|
|
19
45
|
if (options?.includeModel) {
|
|
20
|
-
|
|
21
|
-
|
|
46
|
+
const chatModelObject = isRunnableBinding(promptObject.manifest.kwargs?.last?.id) ? promptObject.manifest.kwargs?.last?.kwargs?.bound : promptObject.manifest.kwargs?.last;
|
|
47
|
+
if (Array.isArray(chatModelObject?.id)) {
|
|
48
|
+
const modelName = chatModelObject?.id.at(-1);
|
|
22
49
|
if (modelName) {
|
|
23
50
|
modelClass = await getChatModelByClassName(modelName);
|
|
24
51
|
if (!modelClass) console.warn(`Received unknown model name from prompt hub: "${modelName}"`);
|
|
25
52
|
}
|
|
26
53
|
}
|
|
27
54
|
}
|
|
28
|
-
const loadedPrompt = await load(JSON.stringify(promptObject.manifest),
|
|
55
|
+
const loadedPrompt = await load(JSON.stringify(promptObject.manifest), options?.secrets, generateOptionalImportMap(modelClass), generateModelImportMap(modelClass), options?.secretsFromEnv);
|
|
29
56
|
return bindOutputSchema(loadedPrompt);
|
|
30
57
|
}
|
|
31
58
|
|
package/dist/hub/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","names":["ownerRepoCommit: string","options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n }"],"sources":["../../src/hub/node.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport {\n basePull,\n generateModelImportMap,\n generateOptionalImportMap,\n bindOutputSchema,\n} from \"./base.js\";\nimport { load } from \"../load/index.js\";\nimport { getChatModelByClassName } from \"../chat_models/universal.js\";\n\n
|
|
1
|
+
{"version":3,"file":"node.js","names":["a: string[]","b: string[]","ownerRepoCommit: string","options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n secrets?: Record<string, string>;\n secretsFromEnv?: boolean;\n }"],"sources":["../../src/hub/node.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport {\n basePull,\n generateModelImportMap,\n generateOptionalImportMap,\n bindOutputSchema,\n} from \"./base.js\";\nimport { load } from \"../load/index.js\";\nimport { getChatModelByClassName } from \"../chat_models/universal.js\";\n\nexport { basePush as push } from \"./base.js\";\n\nfunction _idEquals(a: string[], b: string[]): boolean {\n if (!Array.isArray(a) || !Array.isArray(b)) {\n return false;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction isRunnableBinding(a: string[]): boolean {\n const wellKnownIds = [\n [\"langchain_core\", \"runnables\", \"RunnableBinding\"],\n [\"langchain\", \"schema\", \"runnable\", \"RunnableBinding\"],\n ];\n return wellKnownIds.some((id) => _idEquals(a, id));\n}\n\n/**\n * Pull a prompt from the hub.\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. You must have the appropriate LangChain integration package installed.\n * @param options.secrets A map of secrets to use when loading, e.g.\n * {'OPENAI_API_KEY': 'sk-...'}`.\n * If a secret is not found in the map, it will be loaded from the\n * environment if `secrets_from_env` is `True`. Should only be needed when\n * `includeModel` is `true`.\n * @param options.secretsFromEnv Whether to load secrets from environment variables.\n * Use with caution and only with trusted prompts.\n * @returns\n */\nexport async function pull<T extends Runnable>(\n ownerRepoCommit: string,\n options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n secrets?: Record<string, string>;\n secretsFromEnv?: boolean;\n }\n) {\n const promptObject = await basePull(ownerRepoCommit, options);\n let modelClass;\n if (options?.includeModel) {\n const chatModelObject = isRunnableBinding(\n promptObject.manifest.kwargs?.last?.id\n )\n ? promptObject.manifest.kwargs?.last?.kwargs?.bound\n : promptObject.manifest.kwargs?.last;\n\n if (Array.isArray(chatModelObject?.id)) {\n const modelName = chatModelObject?.id.at(-1);\n\n if (modelName) {\n modelClass = await getChatModelByClassName(modelName);\n if (!modelClass) {\n console.warn(\n `Received unknown model name from prompt hub: \"${modelName}\"`\n );\n }\n }\n }\n }\n const loadedPrompt = await load<T>(\n JSON.stringify(promptObject.manifest),\n options?.secrets,\n generateOptionalImportMap(modelClass),\n generateModelImportMap(modelClass),\n options?.secretsFromEnv\n );\n return bindOutputSchema(loadedPrompt);\n}\n"],"mappings":";;;;;AAYA,SAAS,UAAUA,GAAaC,GAAsB;AACpD,KAAI,CAAC,MAAM,QAAQ,EAAE,IAAI,CAAC,MAAM,QAAQ,EAAE,CACxC,QAAO;AAET,KAAI,EAAE,WAAW,EAAE,OACjB,QAAO;AAET,MAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,IAC5B,KAAI,EAAE,OAAO,EAAE,GACb,QAAO;AAGX,QAAO;AACR;AAED,SAAS,kBAAkBD,GAAsB;CAC/C,MAAM,eAAe,CACnB;EAAC;EAAkB;EAAa;CAAkB,GAClD;EAAC;EAAa;EAAU;EAAY;CAAkB,CACvD;AACD,QAAO,aAAa,KAAK,CAAC,OAAO,UAAU,GAAG,GAAG,CAAC;AACnD;;;;;;;;;;;;;;;;;;AAmBD,eAAsB,KACpBE,iBACAC,SAOA;CACA,MAAM,eAAe,MAAM,SAAS,iBAAiB,QAAQ;CAC7D,IAAI;AACJ,KAAI,SAAS,cAAc;EACzB,MAAM,kBAAkB,kBACtB,aAAa,SAAS,QAAQ,MAAM,GACrC,GACG,aAAa,SAAS,QAAQ,MAAM,QAAQ,QAC5C,aAAa,SAAS,QAAQ;AAElC,MAAI,MAAM,QAAQ,iBAAiB,GAAG,EAAE;GACtC,MAAM,YAAY,iBAAiB,GAAG,GAAG,GAAG;AAE5C,OAAI,WAAW;IACb,aAAa,MAAM,wBAAwB,UAAU;AACrD,QAAI,CAAC,YACH,QAAQ,KACN,CAAC,8CAA8C,EAAE,UAAU,CAAC,CAAC,CAC9D;GAEJ;EACF;CACF;CACD,MAAM,eAAe,MAAM,KACzB,KAAK,UAAU,aAAa,SAAS,EACrC,SAAS,SACT,0BAA0B,WAAW,EACrC,uBAAuB,WAAW,EAClC,SAAS,eACV;AACD,QAAO,iBAAiB,aAAa;AACtC"}
|
package/dist/load/index.cjs
CHANGED
|
@@ -13,7 +13,7 @@ const __langchain_core_load = require_rolldown_runtime.__toESM(require("@langcha
|
|
|
13
13
|
* @param optionalImportsMap
|
|
14
14
|
* @returns A loaded instance of a LangChain module.
|
|
15
15
|
*/
|
|
16
|
-
async function load(text, secretsMap = {}, optionalImportsMap = {}, additionalImportsMap = {}) {
|
|
16
|
+
async function load(text, secretsMap = {}, optionalImportsMap = {}, additionalImportsMap = {}, secretsFromEnv) {
|
|
17
17
|
return (0, __langchain_core_load.load)(text, {
|
|
18
18
|
secretsMap,
|
|
19
19
|
optionalImportsMap,
|
|
@@ -21,7 +21,8 @@ async function load(text, secretsMap = {}, optionalImportsMap = {}, additionalIm
|
|
|
21
21
|
importMap: {
|
|
22
22
|
...require_import_map.import_map_exports,
|
|
23
23
|
...additionalImportsMap
|
|
24
|
-
}
|
|
24
|
+
},
|
|
25
|
+
secretsFromEnv
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
|
package/dist/load/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["text: string","secretsMap: Record<string, any>","optionalImportsMap: OptionalImportMap & Record<string, any>","additionalImportsMap: Record<string, any>","importMap"],"sources":["../../src/load/index.ts"],"sourcesContent":["import { load as coreLoad } from \"@langchain/core/load\";\nimport { optionalImportEntrypoints } from \"./import_constants.js\";\nimport * as importMap from \"./import_map.js\";\nimport { OptionalImportMap } from \"./import_type.js\";\n\n/**\n * Load a LangChain module from a serialized text representation.\n * NOTE: This functionality is currently in beta.\n * Loaded classes may change independently of semver.\n * @param text Serialized text representation of the module.\n * @param secretsMap\n * @param optionalImportsMap\n * @returns A loaded instance of a LangChain module.\n */\nexport async function load<T>(\n text: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n secretsMap: Record<string, any> = {},\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n optionalImportsMap: OptionalImportMap & Record<string, any> = {},\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n additionalImportsMap: Record<string, any> = {}\n): Promise<T> {\n return coreLoad(text, {\n secretsMap,\n optionalImportsMap,\n optionalImportEntrypoints,\n importMap: { ...importMap, ...additionalImportsMap },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,eAAsB,KACpBA,MAEAC,aAAkC,CAAE,GAEpCC,qBAA8D,CAAE,GAEhEC,uBAA4C,CAAE,
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["text: string","secretsMap: Record<string, any>","optionalImportsMap: OptionalImportMap & Record<string, any>","additionalImportsMap: Record<string, any>","secretsFromEnv?: boolean","importMap"],"sources":["../../src/load/index.ts"],"sourcesContent":["import { load as coreLoad } from \"@langchain/core/load\";\nimport { optionalImportEntrypoints } from \"./import_constants.js\";\nimport * as importMap from \"./import_map.js\";\nimport { OptionalImportMap } from \"./import_type.js\";\n\n/**\n * Load a LangChain module from a serialized text representation.\n * NOTE: This functionality is currently in beta.\n * Loaded classes may change independently of semver.\n * @param text Serialized text representation of the module.\n * @param secretsMap\n * @param optionalImportsMap\n * @returns A loaded instance of a LangChain module.\n */\nexport async function load<T>(\n text: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n secretsMap: Record<string, any> = {},\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n optionalImportsMap: OptionalImportMap & Record<string, any> = {},\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n additionalImportsMap: Record<string, any> = {},\n secretsFromEnv?: boolean\n): Promise<T> {\n return coreLoad(text, {\n secretsMap,\n optionalImportsMap,\n optionalImportEntrypoints,\n importMap: { ...importMap, ...additionalImportsMap },\n secretsFromEnv,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,eAAsB,KACpBA,MAEAC,aAAkC,CAAE,GAEpCC,qBAA8D,CAAE,GAEhEC,uBAA4C,CAAE,GAC9CC,gBACY;AACZ,wCAAgB,MAAM;EACpB;EACA;EACA;EACA,WAAW;GAAE,GAAGC;GAAW,GAAG;EAAsB;EACpD;CACD,EAAC;AACH"}
|
package/dist/load/index.d.cts
CHANGED
|
@@ -11,7 +11,7 @@ import { OptionalImportMap } from "./import_type.cjs";
|
|
|
11
11
|
* @param optionalImportsMap
|
|
12
12
|
* @returns A loaded instance of a LangChain module.
|
|
13
13
|
*/
|
|
14
|
-
declare function load<T>(text: string, secretsMap?: Record<string, any>, optionalImportsMap?: OptionalImportMap & Record<string, any>, additionalImportsMap?: Record<string, any
|
|
14
|
+
declare function load<T>(text: string, secretsMap?: Record<string, any>, optionalImportsMap?: OptionalImportMap & Record<string, any>, additionalImportsMap?: Record<string, any>, secretsFromEnv?: boolean): Promise<T>;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { load };
|
|
17
17
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":["OptionalImportMap","load","T","Record","Promise"],"sources":["../../src/load/index.d.ts"],"sourcesContent":["import { OptionalImportMap } from \"./import_type.js\";\n/**\n * Load a LangChain module from a serialized text representation.\n * NOTE: This functionality is currently in beta.\n * Loaded classes may change independently of semver.\n * @param text Serialized text representation of the module.\n * @param secretsMap\n * @param optionalImportsMap\n * @returns A loaded instance of a LangChain module.\n */\nexport declare function load<T>(text: string, secretsMap?: Record<string, any>, optionalImportsMap?: OptionalImportMap & Record<string, any>, additionalImportsMap?: Record<string, any
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":["OptionalImportMap","load","T","Record","Promise"],"sources":["../../src/load/index.d.ts"],"sourcesContent":["import { OptionalImportMap } from \"./import_type.js\";\n/**\n * Load a LangChain module from a serialized text representation.\n * NOTE: This functionality is currently in beta.\n * Loaded classes may change independently of semver.\n * @param text Serialized text representation of the module.\n * @param secretsMap\n * @param optionalImportsMap\n * @returns A loaded instance of a LangChain module.\n */\nexport declare function load<T>(text: string, secretsMap?: Record<string, any>, optionalImportsMap?: OptionalImportMap & Record<string, any>, additionalImportsMap?: Record<string, any>, secretsFromEnv?: boolean): Promise<T>;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;;;;AAUA;;;;;;;AAA4N,iBAApMC,IAAoM,CAAA,CAAA,CAAA,CAAA,IAAA,EAAA,MAAA,EAAA,UAAA,CAAA,EAAjKE,MAAiK,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,kBAAA,CAAA,EAAvHH,iBAAuH,GAAnGG,MAAmG,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,oBAAA,CAAA,EAAvDA,MAAuD,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,cAAA,CAAA,EAAA,OAAA,CAAA,EAAPC,OAAO,CAACF,CAAD,CAAA"}
|
package/dist/load/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { OptionalImportMap } from "./import_type.js";
|
|
|
11
11
|
* @param optionalImportsMap
|
|
12
12
|
* @returns A loaded instance of a LangChain module.
|
|
13
13
|
*/
|
|
14
|
-
declare function load<T>(text: string, secretsMap?: Record<string, any>, optionalImportsMap?: OptionalImportMap & Record<string, any>, additionalImportsMap?: Record<string, any
|
|
14
|
+
declare function load<T>(text: string, secretsMap?: Record<string, any>, optionalImportsMap?: OptionalImportMap & Record<string, any>, additionalImportsMap?: Record<string, any>, secretsFromEnv?: boolean): Promise<T>;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { load };
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/load/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["OptionalImportMap","load","T","Record","Promise"],"sources":["../../src/load/index.d.ts"],"sourcesContent":["import { OptionalImportMap } from \"./import_type.js\";\n/**\n * Load a LangChain module from a serialized text representation.\n * NOTE: This functionality is currently in beta.\n * Loaded classes may change independently of semver.\n * @param text Serialized text representation of the module.\n * @param secretsMap\n * @param optionalImportsMap\n * @returns A loaded instance of a LangChain module.\n */\nexport declare function load<T>(text: string, secretsMap?: Record<string, any>, optionalImportsMap?: OptionalImportMap & Record<string, any>, additionalImportsMap?: Record<string, any
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["OptionalImportMap","load","T","Record","Promise"],"sources":["../../src/load/index.d.ts"],"sourcesContent":["import { OptionalImportMap } from \"./import_type.js\";\n/**\n * Load a LangChain module from a serialized text representation.\n * NOTE: This functionality is currently in beta.\n * Loaded classes may change independently of semver.\n * @param text Serialized text representation of the module.\n * @param secretsMap\n * @param optionalImportsMap\n * @returns A loaded instance of a LangChain module.\n */\nexport declare function load<T>(text: string, secretsMap?: Record<string, any>, optionalImportsMap?: OptionalImportMap & Record<string, any>, additionalImportsMap?: Record<string, any>, secretsFromEnv?: boolean): Promise<T>;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;;;;AAUA;;;;;;;AAA4N,iBAApMC,IAAoM,CAAA,CAAA,CAAA,CAAA,IAAA,EAAA,MAAA,EAAA,UAAA,CAAA,EAAjKE,MAAiK,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,kBAAA,CAAA,EAAvHH,iBAAuH,GAAnGG,MAAmG,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,oBAAA,CAAA,EAAvDA,MAAuD,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,cAAA,CAAA,EAAA,OAAA,CAAA,EAAPC,OAAO,CAACF,CAAD,CAAA"}
|
package/dist/load/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { load as load$1 } from "@langchain/core/load";
|
|
|
12
12
|
* @param optionalImportsMap
|
|
13
13
|
* @returns A loaded instance of a LangChain module.
|
|
14
14
|
*/
|
|
15
|
-
async function load(text, secretsMap = {}, optionalImportsMap = {}, additionalImportsMap = {}) {
|
|
15
|
+
async function load(text, secretsMap = {}, optionalImportsMap = {}, additionalImportsMap = {}, secretsFromEnv) {
|
|
16
16
|
return load$1(text, {
|
|
17
17
|
secretsMap,
|
|
18
18
|
optionalImportsMap,
|
|
@@ -20,7 +20,8 @@ async function load(text, secretsMap = {}, optionalImportsMap = {}, additionalIm
|
|
|
20
20
|
importMap: {
|
|
21
21
|
...import_map_exports,
|
|
22
22
|
...additionalImportsMap
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
|
+
secretsFromEnv
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
27
|
|
package/dist/load/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["text: string","secretsMap: Record<string, any>","optionalImportsMap: OptionalImportMap & Record<string, any>","additionalImportsMap: Record<string, any>","coreLoad","importMap"],"sources":["../../src/load/index.ts"],"sourcesContent":["import { load as coreLoad } from \"@langchain/core/load\";\nimport { optionalImportEntrypoints } from \"./import_constants.js\";\nimport * as importMap from \"./import_map.js\";\nimport { OptionalImportMap } from \"./import_type.js\";\n\n/**\n * Load a LangChain module from a serialized text representation.\n * NOTE: This functionality is currently in beta.\n * Loaded classes may change independently of semver.\n * @param text Serialized text representation of the module.\n * @param secretsMap\n * @param optionalImportsMap\n * @returns A loaded instance of a LangChain module.\n */\nexport async function load<T>(\n text: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n secretsMap: Record<string, any> = {},\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n optionalImportsMap: OptionalImportMap & Record<string, any> = {},\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n additionalImportsMap: Record<string, any> = {}\n): Promise<T> {\n return coreLoad(text, {\n secretsMap,\n optionalImportsMap,\n optionalImportEntrypoints,\n importMap: { ...importMap, ...additionalImportsMap },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,eAAsB,KACpBA,MAEAC,aAAkC,CAAE,GAEpCC,qBAA8D,CAAE,GAEhEC,uBAA4C,CAAE,
|
|
1
|
+
{"version":3,"file":"index.js","names":["text: string","secretsMap: Record<string, any>","optionalImportsMap: OptionalImportMap & Record<string, any>","additionalImportsMap: Record<string, any>","secretsFromEnv?: boolean","coreLoad","importMap"],"sources":["../../src/load/index.ts"],"sourcesContent":["import { load as coreLoad } from \"@langchain/core/load\";\nimport { optionalImportEntrypoints } from \"./import_constants.js\";\nimport * as importMap from \"./import_map.js\";\nimport { OptionalImportMap } from \"./import_type.js\";\n\n/**\n * Load a LangChain module from a serialized text representation.\n * NOTE: This functionality is currently in beta.\n * Loaded classes may change independently of semver.\n * @param text Serialized text representation of the module.\n * @param secretsMap\n * @param optionalImportsMap\n * @returns A loaded instance of a LangChain module.\n */\nexport async function load<T>(\n text: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n secretsMap: Record<string, any> = {},\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n optionalImportsMap: OptionalImportMap & Record<string, any> = {},\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n additionalImportsMap: Record<string, any> = {},\n secretsFromEnv?: boolean\n): Promise<T> {\n return coreLoad(text, {\n secretsMap,\n optionalImportsMap,\n optionalImportEntrypoints,\n importMap: { ...importMap, ...additionalImportsMap },\n secretsFromEnv,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,eAAsB,KACpBA,MAEAC,aAAkC,CAAE,GAEpCC,qBAA8D,CAAE,GAEhEC,uBAA4C,CAAE,GAC9CC,gBACY;AACZ,QAAOC,OAAS,MAAM;EACpB;EACA;EACA;EACA,WAAW;GAAE,GAAGC;GAAW,GAAG;EAAsB;EACpD;CACD,EAAC;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/classic",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Old abstractions form LangChain.js",
|
|
5
5
|
"author": "LangChain",
|
|
6
6
|
"license": "MIT",
|
|
@@ -171,22 +171,22 @@
|
|
|
171
171
|
"voy-search": "0.6.2",
|
|
172
172
|
"weaviate-client": "^3.8.0",
|
|
173
173
|
"zod-to-json-schema": "^3.24.6",
|
|
174
|
-
"@langchain/anthropic": "1.3.
|
|
175
|
-
"@langchain/aws": "1.1.
|
|
174
|
+
"@langchain/anthropic": "1.3.4",
|
|
175
|
+
"@langchain/aws": "1.1.1",
|
|
176
176
|
"@langchain/azure-cosmosdb": "1.1.0",
|
|
177
177
|
"@langchain/azure-dynamic-sessions": "1.0.1",
|
|
178
178
|
"@langchain/baidu-qianfan": "1.0.1",
|
|
179
179
|
"@langchain/cloudflare": "1.0.1",
|
|
180
180
|
"@langchain/cohere": "1.0.1",
|
|
181
|
-
"@langchain/core": "1.1.
|
|
182
|
-
"@langchain/deepseek": "1.0.
|
|
181
|
+
"@langchain/core": "1.1.9",
|
|
182
|
+
"@langchain/deepseek": "1.0.4",
|
|
183
183
|
"@langchain/eslint": "0.1.1",
|
|
184
184
|
"@langchain/exa": "1.0.1",
|
|
185
|
-
"@langchain/google-cloud-sql-pg": "1.0.
|
|
186
|
-
"@langchain/google-common": "2.1.
|
|
187
|
-
"@langchain/google-genai": "2.1.
|
|
188
|
-
"@langchain/google-vertexai": "2.1.
|
|
189
|
-
"@langchain/google-vertexai-web": "2.1.
|
|
185
|
+
"@langchain/google-cloud-sql-pg": "1.0.10",
|
|
186
|
+
"@langchain/google-common": "2.1.4",
|
|
187
|
+
"@langchain/google-genai": "2.1.4",
|
|
188
|
+
"@langchain/google-vertexai": "2.1.4",
|
|
189
|
+
"@langchain/google-vertexai-web": "2.1.4",
|
|
190
190
|
"@langchain/groq": "1.0.2",
|
|
191
191
|
"@langchain/mistralai": "1.0.2",
|
|
192
192
|
"@langchain/mongodb": "1.1.0",
|
|
@@ -198,10 +198,10 @@
|
|
|
198
198
|
"@langchain/tavily": "1.2.0",
|
|
199
199
|
"@langchain/textsplitters": "1.0.1",
|
|
200
200
|
"@langchain/weaviate": "1.0.1",
|
|
201
|
-
"@langchain/xai": "1.1.
|
|
201
|
+
"@langchain/xai": "1.1.1",
|
|
202
202
|
"@langchain/yandex": "1.0.1",
|
|
203
203
|
"@langchain/tsconfig": "0.0.1",
|
|
204
|
-
"langchain": "1.2.
|
|
204
|
+
"langchain": "1.2.4"
|
|
205
205
|
},
|
|
206
206
|
"peerDependencies": {
|
|
207
207
|
"@langchain/core": "^1.0.0",
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
"uuid": "^10.0.0",
|
|
229
229
|
"yaml": "^2.2.1",
|
|
230
230
|
"zod": "^3.25.76 || ^4",
|
|
231
|
-
"@langchain/openai": "1.2.
|
|
231
|
+
"@langchain/openai": "1.2.1",
|
|
232
232
|
"@langchain/textsplitters": "1.0.1"
|
|
233
233
|
},
|
|
234
234
|
"optionalDependencies": {
|