@langchain/classic 1.0.7 → 1.0.9
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 +18 -0
- package/dist/agents/agent.cjs.map +1 -1
- package/dist/agents/agent.js.map +1 -1
- package/dist/agents/chat/outputParser.d.cts +2 -2
- package/dist/agents/chat/outputParser.d.cts.map +1 -1
- package/dist/agents/chat/outputParser.d.ts +2 -2
- package/dist/agents/chat/outputParser.d.ts.map +1 -1
- package/dist/agents/helpers.cjs.map +1 -1
- package/dist/agents/helpers.js.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_functions/index.cjs.map +1 -1
- package/dist/agents/openai_functions/index.js.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/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.ts +2 -2
- package/dist/agents/tool_calling/index.d.ts.map +1 -1
- package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.d.cts +1 -1
- package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.d.cts.map +1 -1
- package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.d.ts +1 -1
- package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.d.ts.map +1 -1
- package/dist/agents/toolkits/conversational_retrieval/tool.d.cts +1 -1
- package/dist/agents/toolkits/conversational_retrieval/tool.d.cts.map +1 -1
- package/dist/agents/toolkits/conversational_retrieval/tool.d.ts +1 -1
- package/dist/agents/toolkits/conversational_retrieval/tool.d.ts.map +1 -1
- package/dist/agents/types.cjs.map +1 -1
- package/dist/agents/types.js.map +1 -1
- package/dist/chains/base.cjs.map +1 -1
- package/dist/chains/base.js.map +1 -1
- package/dist/chains/combine_docs_chain.cjs.map +1 -1
- package/dist/chains/combine_docs_chain.js.map +1 -1
- package/dist/chains/llm_chain.cjs.map +1 -1
- package/dist/chains/llm_chain.js.map +1 -1
- package/dist/chains/openai_functions/base.cjs.map +1 -1
- package/dist/chains/openai_functions/base.js.map +1 -1
- package/dist/chains/openai_functions/openapi.cjs.map +1 -1
- package/dist/chains/openai_functions/openapi.js.map +1 -1
- package/dist/chains/query_constructor/index.cjs.map +1 -1
- package/dist/chains/query_constructor/index.js.map +1 -1
- package/dist/chains/query_constructor/parser.cjs.map +1 -1
- package/dist/chains/query_constructor/parser.js.map +1 -1
- package/dist/chains/router/multi_prompt.cjs.map +1 -1
- package/dist/chains/router/multi_prompt.js.map +1 -1
- package/dist/chains/transform.cjs.map +1 -1
- package/dist/chains/transform.js.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/document_loaders/fs/json.cjs.map +1 -1
- package/dist/document_loaders/fs/json.js.map +1 -1
- package/dist/embeddings/cache_backed.cjs.map +1 -1
- package/dist/embeddings/cache_backed.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/base.cjs.map +1 -1
- package/dist/evaluation/base.js.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/autogpt/prompt.d.cts +2 -2
- package/dist/experimental/autogpt/prompt.d.cts.map +1 -1
- package/dist/experimental/autogpt/prompt.d.ts +2 -2
- package/dist/experimental/autogpt/prompt.d.ts.map +1 -1
- package/dist/experimental/masking/regex_masking_transformer.cjs.map +1 -1
- package/dist/experimental/masking/regex_masking_transformer.js.map +1 -1
- package/dist/experimental/openai_assistant/index.cjs.map +1 -1
- package/dist/experimental/openai_assistant/index.js.map +1 -1
- package/dist/experimental/plan_and_execute/agent_executor.cjs.map +1 -1
- package/dist/experimental/plan_and_execute/agent_executor.js.map +1 -1
- package/dist/experimental/prompts/custom_format.cjs.map +1 -1
- package/dist/experimental/prompts/custom_format.d.cts.map +1 -1
- package/dist/experimental/prompts/custom_format.js.map +1 -1
- package/dist/experimental/prompts/handlebars.cjs.map +1 -1
- package/dist/experimental/prompts/handlebars.d.cts.map +1 -1
- package/dist/experimental/prompts/handlebars.js.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/import_constants.cjs +24 -24
- package/dist/load/import_constants.cjs.map +1 -1
- package/dist/load/import_constants.js +24 -24
- package/dist/load/import_constants.js.map +1 -1
- package/dist/load/import_map.cjs +44 -44
- package/dist/load/import_map.cjs.map +1 -1
- package/dist/load/import_map.js +52 -52
- package/dist/load/import_map.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/dist/output_parsers/openai_functions.cjs.map +1 -1
- package/dist/output_parsers/openai_functions.js.map +1 -1
- package/dist/output_parsers/regex.cjs.map +1 -1
- package/dist/output_parsers/regex.js.map +1 -1
- package/dist/output_parsers/router.cjs.map +1 -1
- package/dist/output_parsers/router.js.map +1 -1
- package/dist/output_parsers/structured.cjs.map +1 -1
- package/dist/output_parsers/structured.js.map +1 -1
- package/dist/retrievers/document_compressors/index.cjs.map +1 -1
- package/dist/retrievers/document_compressors/index.js.map +1 -1
- package/dist/retrievers/hyde.cjs +1 -1
- package/dist/retrievers/hyde.cjs.map +1 -1
- package/dist/retrievers/hyde.js +1 -1
- package/dist/retrievers/hyde.js.map +1 -1
- package/dist/retrievers/matryoshka_retriever.cjs +1 -1
- package/dist/retrievers/matryoshka_retriever.cjs.map +1 -1
- package/dist/retrievers/matryoshka_retriever.js +1 -1
- package/dist/retrievers/matryoshka_retriever.js.map +1 -1
- package/dist/retrievers/score_threshold.cjs.map +1 -1
- package/dist/retrievers/score_threshold.js.map +1 -1
- package/dist/retrievers/self_query/index.cjs +1 -1
- package/dist/retrievers/self_query/index.d.ts +1 -1
- package/dist/retrievers/self_query/index.js +1 -1
- package/dist/smith/config.cjs.map +1 -1
- package/dist/smith/config.js.map +1 -1
- package/dist/smith/runner_utils.cjs.map +1 -1
- package/dist/smith/runner_utils.js.map +1 -1
- package/dist/tools/retriever.d.cts +1 -1
- package/dist/tools/retriever.d.cts.map +1 -1
- package/dist/tools/retriever.d.ts +1 -1
- package/dist/tools/retriever.d.ts.map +1 -1
- package/dist/util/sql_utils.cjs.map +1 -1
- package/dist/util/sql_utils.js.map +1 -1
- package/dist/vectorstores/memory.cjs +1 -1
- package/dist/vectorstores/memory.js +1 -1
- package/package.json +17 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom_format.js","names":["input: CustomFormatPromptTemplateInput<RunInput>","totalInputVariables: string[]","template: string","values: TypedPromptInputValues<RunInput>"],"sources":["../../../src/experimental/prompts/custom_format.ts"],"sourcesContent":["import type { InputValues } from \"@langchain/core/utils/types\";\nimport {\n type ParsedFStringNode,\n PromptTemplate,\n type PromptTemplateInput,\n TypedPromptInputValues,\n} from \"@langchain/core/prompts\";\n\nexport type CustomFormatPromptTemplateInput<RunInput extends InputValues> =\n Omit<PromptTemplateInput<RunInput, string>, \"templateFormat\"> & {\n customParser: (template: string) => ParsedFStringNode[];\n templateValidator?: (template: string, inputVariables: string[]) => boolean;\n renderer: (template: string, values: InputValues) => string;\n };\n\nexport class CustomFormatPromptTemplate<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RunInput extends InputValues = any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n PartialVariableName extends string = any
|
|
1
|
+
{"version":3,"file":"custom_format.js","names":["input: CustomFormatPromptTemplateInput<RunInput>","totalInputVariables: string[]","template: string","values: TypedPromptInputValues<RunInput>"],"sources":["../../../src/experimental/prompts/custom_format.ts"],"sourcesContent":["import type { InputValues } from \"@langchain/core/utils/types\";\nimport {\n type ParsedFStringNode,\n PromptTemplate,\n type PromptTemplateInput,\n TypedPromptInputValues,\n} from \"@langchain/core/prompts\";\n\nexport type CustomFormatPromptTemplateInput<RunInput extends InputValues> =\n Omit<PromptTemplateInput<RunInput, string>, \"templateFormat\"> & {\n customParser: (template: string) => ParsedFStringNode[];\n templateValidator?: (template: string, inputVariables: string[]) => boolean;\n renderer: (template: string, values: InputValues) => string;\n };\n\nexport class CustomFormatPromptTemplate<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RunInput extends InputValues = any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n PartialVariableName extends string = any,\n> extends PromptTemplate<RunInput, PartialVariableName> {\n static lc_name() {\n return \"CustomPromptTemplate\";\n }\n\n lc_serializable = false;\n\n templateValidator?: (template: string, inputVariables: string[]) => boolean;\n\n renderer: (template: string, values: InputValues) => string;\n\n constructor(input: CustomFormatPromptTemplateInput<RunInput>) {\n super(input);\n Object.assign(this, input);\n\n if (this.validateTemplate && this.templateValidator !== undefined) {\n let totalInputVariables: string[] = this.inputVariables;\n if (this.partialVariables) {\n totalInputVariables = totalInputVariables.concat(\n Object.keys(this.partialVariables)\n );\n }\n if (typeof this.template === \"string\") {\n this.templateValidator(this.template, totalInputVariables);\n } else {\n throw new Error(\n `Must pass in string as template. Received: ${this.template}`\n );\n }\n }\n }\n\n /**\n * Load prompt template from a template\n */\n static fromTemplate<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RunInput extends InputValues = Record<string, any>,\n >(\n template: string,\n {\n customParser,\n ...rest\n }: Omit<\n CustomFormatPromptTemplateInput<RunInput>,\n \"template\" | \"inputVariables\"\n >\n ) {\n const names = new Set<string>();\n const nodes = customParser(template);\n for (const node of nodes) {\n if (node.type === \"variable\") {\n names.add(node.name);\n }\n }\n return new this<RunInput extends Symbol ? never : RunInput>({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n inputVariables: [...names] as any[],\n template,\n customParser,\n ...rest,\n });\n }\n\n /**\n * Formats the prompt template with the provided values.\n * @param values The values to be used to format the prompt template.\n * @returns A promise that resolves to a string which is the formatted prompt.\n */\n async format(values: TypedPromptInputValues<RunInput>): Promise<string> {\n const allValues = await this.mergePartialAndUserVariables(values);\n if (typeof this.template === \"string\") {\n return this.renderer(this.template, allValues);\n } else {\n throw new Error(\n `Must pass in string as template. Received: ${this.template}`\n );\n }\n }\n}\n"],"mappings":";;;;;;AAeA,IAAa,6BAAb,cAKU,eAA8C;CACtD,OAAO,UAAU;AACf,SAAO;CACR;CAED,kBAAkB;CAElB;CAEA;CAEA,YAAYA,OAAkD;EAC5D,MAAM,MAAM;EACZ,OAAO,OAAO,MAAM,MAAM;AAE1B,MAAI,KAAK,oBAAoB,KAAK,sBAAsB,QAAW;GACjE,IAAIC,sBAAgC,KAAK;AACzC,OAAI,KAAK,kBACP,sBAAsB,oBAAoB,OACxC,OAAO,KAAK,KAAK,iBAAiB,CACnC;AAEH,OAAI,OAAO,KAAK,aAAa,UAC3B,KAAK,kBAAkB,KAAK,UAAU,oBAAoB;OAE1D,OAAM,IAAI,MACR,CAAC,2CAA2C,EAAE,KAAK,UAAU;EAGlE;CACF;;;;CAKD,OAAO,aAILC,UACA,EACE,aACA,GAAG,MAIJ,EACD;EACA,MAAM,wBAAQ,IAAI;EAClB,MAAM,QAAQ,aAAa,SAAS;AACpC,OAAK,MAAM,QAAQ,MACjB,KAAI,KAAK,SAAS,YAChB,MAAM,IAAI,KAAK,KAAK;AAGxB,SAAO,IAAI,KAAiD;GAE1D,gBAAgB,CAAC,GAAG,KAAM;GAC1B;GACA;GACA,GAAG;EACJ;CACF;;;;;;CAOD,MAAM,OAAOC,QAA2D;EACtE,MAAM,YAAY,MAAM,KAAK,6BAA6B,OAAO;AACjE,MAAI,OAAO,KAAK,aAAa,SAC3B,QAAO,KAAK,SAAS,KAAK,UAAU,UAAU;MAE9C,OAAM,IAAI,MACR,CAAC,2CAA2C,EAAE,KAAK,UAAU;CAGlE;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlebars.cjs","names":["template: string","parsed: ParsedFStringNode[]","nodes: { type: string }[]","Handlebars","name: string","values: InputValues","CustomFormatPromptTemplate","params?: Omit<\n HandlebarsPromptTemplateInput<RunInput>,\n | \"template\"\n | \"inputVariables\"\n | \"customParser\"\n | \"templateValidator\"\n | \"renderer\"\n >"],"sources":["../../../src/experimental/prompts/handlebars.ts"],"sourcesContent":["import Handlebars from \"handlebars\";\nimport { type ParsedFStringNode } from \"@langchain/core/prompts\";\nimport type { InputValues } from \"@langchain/core/utils/types\";\nimport {\n CustomFormatPromptTemplate,\n CustomFormatPromptTemplateInput,\n} from \"./custom_format.js\";\n\nexport const parseHandlebars = (template: string): ParsedFStringNode[] => {\n const parsed: ParsedFStringNode[] = [];\n const nodes: { type: string }[] = [...Handlebars.parse(template).body];\n while (nodes.length) {\n const node = nodes.pop()!;\n if (node.type === \"ContentStatement\") {\n // @ts-expect-error - handlebars' hbs.AST.ContentStatement isn't exported\n const text = node.value;\n parsed.push({ type: \"literal\", text });\n } else if (node.type === \"MustacheStatement\") {\n // @ts-expect-error - handlebars' hbs.AST.MustacheStatement isn't exported\n const name: string = node.path.parts[0];\n // @ts-expect-error - handlebars' hbs.AST.MustacheStatement isn't exported\n const { original } = node.path as { original: string };\n if (\n !!name &&\n !original.startsWith(\"this.\") &&\n !original.startsWith(\"@\")\n ) {\n parsed.push({ type: \"variable\", name });\n }\n } else if (node.type === \"PathExpression\") {\n // @ts-expect-error - handlebars' hbs.AST.PathExpression isn't exported\n const name: string = node.parts[0];\n // @ts-expect-error - handlebars' hbs.AST.PathExpression isn't exported\n const { original } = node;\n if (\n !!name &&\n !original.startsWith(\"this.\") &&\n !original.startsWith(\"@\")\n ) {\n parsed.push({ type: \"variable\", name });\n }\n } else if (node.type === \"BlockStatement\") {\n // @ts-expect-error - handlebars' hbs.AST.BlockStatement isn't exported\n nodes.push(...node.params, ...node.program.body);\n }\n }\n\n return parsed;\n};\n\nexport const interpolateHandlebars = (\n template: string,\n values: InputValues\n) => {\n const compiled = Handlebars.compile(template, { noEscape: true });\n return compiled(values);\n};\n\nexport type HandlebarsPromptTemplateInput<RunInput extends InputValues> =\n CustomFormatPromptTemplateInput<RunInput>;\n\nexport class HandlebarsPromptTemplate<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RunInput extends InputValues = any
|
|
1
|
+
{"version":3,"file":"handlebars.cjs","names":["template: string","parsed: ParsedFStringNode[]","nodes: { type: string }[]","Handlebars","name: string","values: InputValues","CustomFormatPromptTemplate","params?: Omit<\n HandlebarsPromptTemplateInput<RunInput>,\n | \"template\"\n | \"inputVariables\"\n | \"customParser\"\n | \"templateValidator\"\n | \"renderer\"\n >"],"sources":["../../../src/experimental/prompts/handlebars.ts"],"sourcesContent":["import Handlebars from \"handlebars\";\nimport { type ParsedFStringNode } from \"@langchain/core/prompts\";\nimport type { InputValues } from \"@langchain/core/utils/types\";\nimport {\n CustomFormatPromptTemplate,\n CustomFormatPromptTemplateInput,\n} from \"./custom_format.js\";\n\nexport const parseHandlebars = (template: string): ParsedFStringNode[] => {\n const parsed: ParsedFStringNode[] = [];\n const nodes: { type: string }[] = [...Handlebars.parse(template).body];\n while (nodes.length) {\n const node = nodes.pop()!;\n if (node.type === \"ContentStatement\") {\n // @ts-expect-error - handlebars' hbs.AST.ContentStatement isn't exported\n const text = node.value;\n parsed.push({ type: \"literal\", text });\n } else if (node.type === \"MustacheStatement\") {\n // @ts-expect-error - handlebars' hbs.AST.MustacheStatement isn't exported\n const name: string = node.path.parts[0];\n // @ts-expect-error - handlebars' hbs.AST.MustacheStatement isn't exported\n const { original } = node.path as { original: string };\n if (\n !!name &&\n !original.startsWith(\"this.\") &&\n !original.startsWith(\"@\")\n ) {\n parsed.push({ type: \"variable\", name });\n }\n } else if (node.type === \"PathExpression\") {\n // @ts-expect-error - handlebars' hbs.AST.PathExpression isn't exported\n const name: string = node.parts[0];\n // @ts-expect-error - handlebars' hbs.AST.PathExpression isn't exported\n const { original } = node;\n if (\n !!name &&\n !original.startsWith(\"this.\") &&\n !original.startsWith(\"@\")\n ) {\n parsed.push({ type: \"variable\", name });\n }\n } else if (node.type === \"BlockStatement\") {\n // @ts-expect-error - handlebars' hbs.AST.BlockStatement isn't exported\n nodes.push(...node.params, ...node.program.body);\n }\n }\n\n return parsed;\n};\n\nexport const interpolateHandlebars = (\n template: string,\n values: InputValues\n) => {\n const compiled = Handlebars.compile(template, { noEscape: true });\n return compiled(values);\n};\n\nexport type HandlebarsPromptTemplateInput<RunInput extends InputValues> =\n CustomFormatPromptTemplateInput<RunInput>;\n\nexport class HandlebarsPromptTemplate<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RunInput extends InputValues = any,\n> extends CustomFormatPromptTemplate<RunInput> {\n static lc_name() {\n return \"HandlebarsPromptTemplate\";\n }\n\n /**\n * Load prompt template from a template\n */\n static fromTemplate<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RunInput extends InputValues = Record<string, any>,\n >(\n template: string,\n params?: Omit<\n HandlebarsPromptTemplateInput<RunInput>,\n | \"template\"\n | \"inputVariables\"\n | \"customParser\"\n | \"templateValidator\"\n | \"renderer\"\n >\n ) {\n return super.fromTemplate<RunInput>(template, {\n ...params,\n validateTemplate: false,\n customParser: parseHandlebars,\n renderer: interpolateHandlebars,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AAQA,MAAa,kBAAkB,CAACA,aAA0C;CACxE,MAAMC,SAA8B,CAAE;CACtC,MAAMC,QAA4B,CAAC,GAAGC,mBAAW,MAAM,SAAS,CAAC,IAAK;AACtE,QAAO,MAAM,QAAQ;EACnB,MAAM,OAAO,MAAM,KAAK;AACxB,MAAI,KAAK,SAAS,oBAAoB;GAEpC,MAAM,OAAO,KAAK;GAClB,OAAO,KAAK;IAAE,MAAM;IAAW;GAAM,EAAC;EACvC,WAAU,KAAK,SAAS,qBAAqB;GAE5C,MAAMC,OAAe,KAAK,KAAK,MAAM;GAErC,MAAM,EAAE,UAAU,GAAG,KAAK;AAC1B,OACE,CAAC,CAAC,QACF,CAAC,SAAS,WAAW,QAAQ,IAC7B,CAAC,SAAS,WAAW,IAAI,EAEzB,OAAO,KAAK;IAAE,MAAM;IAAY;GAAM,EAAC;EAE1C,WAAU,KAAK,SAAS,kBAAkB;GAEzC,MAAMA,OAAe,KAAK,MAAM;GAEhC,MAAM,EAAE,UAAU,GAAG;AACrB,OACE,CAAC,CAAC,QACF,CAAC,SAAS,WAAW,QAAQ,IAC7B,CAAC,SAAS,WAAW,IAAI,EAEzB,OAAO,KAAK;IAAE,MAAM;IAAY;GAAM,EAAC;EAE1C,WAAU,KAAK,SAAS,kBAEvB,MAAM,KAAK,GAAG,KAAK,QAAQ,GAAG,KAAK,QAAQ,KAAK;CAEnD;AAED,QAAO;AACR;AAED,MAAa,wBAAwB,CACnCJ,UACAK,WACG;CACH,MAAM,WAAWF,mBAAW,QAAQ,UAAU,EAAE,UAAU,KAAM,EAAC;AACjE,QAAO,SAAS,OAAO;AACxB;AAKD,IAAa,2BAAb,cAGUG,sEAAqC;CAC7C,OAAO,UAAU;AACf,SAAO;CACR;;;;CAKD,OAAO,aAILN,UACAO,QAQA;AACA,SAAO,MAAM,aAAuB,UAAU;GAC5C,GAAG;GACH,kBAAkB;GAClB,cAAc;GACd,UAAU;EACX,EAAC;CACH;AACF"}
|
|
@@ -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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlebars.js","names":["template: string","parsed: ParsedFStringNode[]","nodes: { type: string }[]","name: string","values: InputValues","params?: Omit<\n HandlebarsPromptTemplateInput<RunInput>,\n | \"template\"\n | \"inputVariables\"\n | \"customParser\"\n | \"templateValidator\"\n | \"renderer\"\n >"],"sources":["../../../src/experimental/prompts/handlebars.ts"],"sourcesContent":["import Handlebars from \"handlebars\";\nimport { type ParsedFStringNode } from \"@langchain/core/prompts\";\nimport type { InputValues } from \"@langchain/core/utils/types\";\nimport {\n CustomFormatPromptTemplate,\n CustomFormatPromptTemplateInput,\n} from \"./custom_format.js\";\n\nexport const parseHandlebars = (template: string): ParsedFStringNode[] => {\n const parsed: ParsedFStringNode[] = [];\n const nodes: { type: string }[] = [...Handlebars.parse(template).body];\n while (nodes.length) {\n const node = nodes.pop()!;\n if (node.type === \"ContentStatement\") {\n // @ts-expect-error - handlebars' hbs.AST.ContentStatement isn't exported\n const text = node.value;\n parsed.push({ type: \"literal\", text });\n } else if (node.type === \"MustacheStatement\") {\n // @ts-expect-error - handlebars' hbs.AST.MustacheStatement isn't exported\n const name: string = node.path.parts[0];\n // @ts-expect-error - handlebars' hbs.AST.MustacheStatement isn't exported\n const { original } = node.path as { original: string };\n if (\n !!name &&\n !original.startsWith(\"this.\") &&\n !original.startsWith(\"@\")\n ) {\n parsed.push({ type: \"variable\", name });\n }\n } else if (node.type === \"PathExpression\") {\n // @ts-expect-error - handlebars' hbs.AST.PathExpression isn't exported\n const name: string = node.parts[0];\n // @ts-expect-error - handlebars' hbs.AST.PathExpression isn't exported\n const { original } = node;\n if (\n !!name &&\n !original.startsWith(\"this.\") &&\n !original.startsWith(\"@\")\n ) {\n parsed.push({ type: \"variable\", name });\n }\n } else if (node.type === \"BlockStatement\") {\n // @ts-expect-error - handlebars' hbs.AST.BlockStatement isn't exported\n nodes.push(...node.params, ...node.program.body);\n }\n }\n\n return parsed;\n};\n\nexport const interpolateHandlebars = (\n template: string,\n values: InputValues\n) => {\n const compiled = Handlebars.compile(template, { noEscape: true });\n return compiled(values);\n};\n\nexport type HandlebarsPromptTemplateInput<RunInput extends InputValues> =\n CustomFormatPromptTemplateInput<RunInput>;\n\nexport class HandlebarsPromptTemplate<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RunInput extends InputValues = any
|
|
1
|
+
{"version":3,"file":"handlebars.js","names":["template: string","parsed: ParsedFStringNode[]","nodes: { type: string }[]","name: string","values: InputValues","params?: Omit<\n HandlebarsPromptTemplateInput<RunInput>,\n | \"template\"\n | \"inputVariables\"\n | \"customParser\"\n | \"templateValidator\"\n | \"renderer\"\n >"],"sources":["../../../src/experimental/prompts/handlebars.ts"],"sourcesContent":["import Handlebars from \"handlebars\";\nimport { type ParsedFStringNode } from \"@langchain/core/prompts\";\nimport type { InputValues } from \"@langchain/core/utils/types\";\nimport {\n CustomFormatPromptTemplate,\n CustomFormatPromptTemplateInput,\n} from \"./custom_format.js\";\n\nexport const parseHandlebars = (template: string): ParsedFStringNode[] => {\n const parsed: ParsedFStringNode[] = [];\n const nodes: { type: string }[] = [...Handlebars.parse(template).body];\n while (nodes.length) {\n const node = nodes.pop()!;\n if (node.type === \"ContentStatement\") {\n // @ts-expect-error - handlebars' hbs.AST.ContentStatement isn't exported\n const text = node.value;\n parsed.push({ type: \"literal\", text });\n } else if (node.type === \"MustacheStatement\") {\n // @ts-expect-error - handlebars' hbs.AST.MustacheStatement isn't exported\n const name: string = node.path.parts[0];\n // @ts-expect-error - handlebars' hbs.AST.MustacheStatement isn't exported\n const { original } = node.path as { original: string };\n if (\n !!name &&\n !original.startsWith(\"this.\") &&\n !original.startsWith(\"@\")\n ) {\n parsed.push({ type: \"variable\", name });\n }\n } else if (node.type === \"PathExpression\") {\n // @ts-expect-error - handlebars' hbs.AST.PathExpression isn't exported\n const name: string = node.parts[0];\n // @ts-expect-error - handlebars' hbs.AST.PathExpression isn't exported\n const { original } = node;\n if (\n !!name &&\n !original.startsWith(\"this.\") &&\n !original.startsWith(\"@\")\n ) {\n parsed.push({ type: \"variable\", name });\n }\n } else if (node.type === \"BlockStatement\") {\n // @ts-expect-error - handlebars' hbs.AST.BlockStatement isn't exported\n nodes.push(...node.params, ...node.program.body);\n }\n }\n\n return parsed;\n};\n\nexport const interpolateHandlebars = (\n template: string,\n values: InputValues\n) => {\n const compiled = Handlebars.compile(template, { noEscape: true });\n return compiled(values);\n};\n\nexport type HandlebarsPromptTemplateInput<RunInput extends InputValues> =\n CustomFormatPromptTemplateInput<RunInput>;\n\nexport class HandlebarsPromptTemplate<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RunInput extends InputValues = any,\n> extends CustomFormatPromptTemplate<RunInput> {\n static lc_name() {\n return \"HandlebarsPromptTemplate\";\n }\n\n /**\n * Load prompt template from a template\n */\n static fromTemplate<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RunInput extends InputValues = Record<string, any>,\n >(\n template: string,\n params?: Omit<\n HandlebarsPromptTemplateInput<RunInput>,\n | \"template\"\n | \"inputVariables\"\n | \"customParser\"\n | \"templateValidator\"\n | \"renderer\"\n >\n ) {\n return super.fromTemplate<RunInput>(template, {\n ...params,\n validateTemplate: false,\n customParser: parseHandlebars,\n renderer: interpolateHandlebars,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AAQA,MAAa,kBAAkB,CAACA,aAA0C;CACxE,MAAMC,SAA8B,CAAE;CACtC,MAAMC,QAA4B,CAAC,GAAG,WAAW,MAAM,SAAS,CAAC,IAAK;AACtE,QAAO,MAAM,QAAQ;EACnB,MAAM,OAAO,MAAM,KAAK;AACxB,MAAI,KAAK,SAAS,oBAAoB;GAEpC,MAAM,OAAO,KAAK;GAClB,OAAO,KAAK;IAAE,MAAM;IAAW;GAAM,EAAC;EACvC,WAAU,KAAK,SAAS,qBAAqB;GAE5C,MAAMC,OAAe,KAAK,KAAK,MAAM;GAErC,MAAM,EAAE,UAAU,GAAG,KAAK;AAC1B,OACE,CAAC,CAAC,QACF,CAAC,SAAS,WAAW,QAAQ,IAC7B,CAAC,SAAS,WAAW,IAAI,EAEzB,OAAO,KAAK;IAAE,MAAM;IAAY;GAAM,EAAC;EAE1C,WAAU,KAAK,SAAS,kBAAkB;GAEzC,MAAMA,OAAe,KAAK,MAAM;GAEhC,MAAM,EAAE,UAAU,GAAG;AACrB,OACE,CAAC,CAAC,QACF,CAAC,SAAS,WAAW,QAAQ,IAC7B,CAAC,SAAS,WAAW,IAAI,EAEzB,OAAO,KAAK;IAAE,MAAM;IAAY;GAAM,EAAC;EAE1C,WAAU,KAAK,SAAS,kBAEvB,MAAM,KAAK,GAAG,KAAK,QAAQ,GAAG,KAAK,QAAQ,KAAK;CAEnD;AAED,QAAO;AACR;AAED,MAAa,wBAAwB,CACnCH,UACAI,WACG;CACH,MAAM,WAAW,WAAW,QAAQ,UAAU,EAAE,UAAU,KAAM,EAAC;AACjE,QAAO,SAAS,OAAO;AACxB;AAKD,IAAa,2BAAb,cAGU,2BAAqC;CAC7C,OAAO,UAAU;AACf,SAAO;CACR;;;;CAKD,OAAO,aAILJ,UACAK,QAQA;AACA,SAAO,MAAM,aAAuB,UAAU;GAC5C,GAAG;GACH,kBAAkB;GAClB,cAAc;GACd,UAAU;EACX,EAAC;CACH;AACF"}
|
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"}
|
|
@@ -2,30 +2,30 @@
|
|
|
2
2
|
//#region src/load/import_constants.ts
|
|
3
3
|
/** Auto-generated by import-constants plugin. Do not edit manually */
|
|
4
4
|
const optionalImportEntrypoints = [
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
5
|
+
"langchain_classic/agents/load",
|
|
6
|
+
"langchain_classic/agents/toolkits/sql",
|
|
7
|
+
"langchain_classic/tools/sql",
|
|
8
|
+
"langchain_classic/tools/webbrowser",
|
|
9
|
+
"langchain_classic/chains/load",
|
|
10
|
+
"langchain_classic/chains/query_constructor",
|
|
11
|
+
"langchain_classic/chains/query_constructor/ir",
|
|
12
|
+
"langchain_classic/chains/sql_db",
|
|
13
|
+
"langchain_classic/chains/graph_qa/cypher",
|
|
14
|
+
"langchain_classic/chat_models/universal",
|
|
15
|
+
"langchain_classic/document_loaders/fs/buffer",
|
|
16
|
+
"langchain_classic/document_loaders/fs/directory",
|
|
17
|
+
"langchain_classic/document_loaders/fs/json",
|
|
18
|
+
"langchain_classic/document_loaders/fs/multi_file",
|
|
19
|
+
"langchain_classic/document_loaders/fs/text",
|
|
20
|
+
"langchain_classic/sql_db",
|
|
21
|
+
"langchain_classic/output_parsers/expression",
|
|
22
|
+
"langchain_classic/retrievers/self_query",
|
|
23
|
+
"langchain_classic/retrievers/self_query/functional",
|
|
24
|
+
"langchain_classic/cache/file_system",
|
|
25
|
+
"langchain_classic/stores/file/node",
|
|
26
|
+
"langchain_classic/storage/file_system",
|
|
27
|
+
"langchain_classic/hub",
|
|
28
|
+
"langchain_classic/hub/node"
|
|
29
29
|
];
|
|
30
30
|
|
|
31
31
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import_constants.cjs","names":["optionalImportEntrypoints: string[]"],"sources":["../../src/load/import_constants.ts"],"sourcesContent":["/** Auto-generated by import-constants plugin. Do not edit manually */\n\nexport const optionalImportEntrypoints: string[] = [\n \"
|
|
1
|
+
{"version":3,"file":"import_constants.cjs","names":["optionalImportEntrypoints: string[]"],"sources":["../../src/load/import_constants.ts"],"sourcesContent":["/** Auto-generated by import-constants plugin. Do not edit manually */\n\nexport const optionalImportEntrypoints: string[] = [\n \"langchain_classic/agents/load\",\n \"langchain_classic/agents/toolkits/sql\",\n \"langchain_classic/tools/sql\",\n \"langchain_classic/tools/webbrowser\",\n \"langchain_classic/chains/load\",\n \"langchain_classic/chains/query_constructor\",\n \"langchain_classic/chains/query_constructor/ir\",\n \"langchain_classic/chains/sql_db\",\n \"langchain_classic/chains/graph_qa/cypher\",\n \"langchain_classic/chat_models/universal\",\n \"langchain_classic/document_loaders/fs/buffer\",\n \"langchain_classic/document_loaders/fs/directory\",\n \"langchain_classic/document_loaders/fs/json\",\n \"langchain_classic/document_loaders/fs/multi_file\",\n \"langchain_classic/document_loaders/fs/text\",\n \"langchain_classic/sql_db\",\n \"langchain_classic/output_parsers/expression\",\n \"langchain_classic/retrievers/self_query\",\n \"langchain_classic/retrievers/self_query/functional\",\n \"langchain_classic/cache/file_system\",\n \"langchain_classic/stores/file/node\",\n \"langchain_classic/storage/file_system\",\n \"langchain_classic/hub\",\n \"langchain_classic/hub/node\",\n];\n"],"mappings":";;;AAEA,MAAaA,4BAAsC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD"}
|