langchain 0.1.2 → 0.1.4

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.
Files changed (68) hide show
  1. package/dist/agents/openai_functions/index.cjs +3 -3
  2. package/dist/agents/openai_functions/index.js +3 -3
  3. package/dist/agents/openai_functions/output_parser.cjs +1 -1
  4. package/dist/agents/openai_functions/output_parser.d.ts +1 -1
  5. package/dist/agents/openai_functions/output_parser.js +1 -1
  6. package/dist/agents/openai_tools/index.cjs +2 -2
  7. package/dist/agents/openai_tools/index.js +2 -2
  8. package/dist/agents/openai_tools/output_parser.cjs +1 -1
  9. package/dist/agents/openai_tools/output_parser.d.ts +1 -1
  10. package/dist/agents/openai_tools/output_parser.js +1 -1
  11. package/dist/agents/toolkits/conversational_retrieval/tool.cjs +2 -2
  12. package/dist/agents/toolkits/conversational_retrieval/tool.d.ts +1 -1
  13. package/dist/agents/toolkits/conversational_retrieval/tool.js +1 -1
  14. package/dist/agents/toolkits/openapi/openapi.cjs +2 -2
  15. package/dist/agents/toolkits/openapi/openapi.js +1 -1
  16. package/dist/cache/cloudflare_kv.cjs +2 -1
  17. package/dist/cache/cloudflare_kv.js +2 -1
  18. package/dist/chains/history_aware_retriever.cjs +1 -1
  19. package/dist/chains/history_aware_retriever.d.ts +1 -1
  20. package/dist/chains/history_aware_retriever.js +1 -1
  21. package/dist/chains/openai_functions/base.d.ts +1 -1
  22. package/dist/chains/openai_functions/openapi.d.ts +1 -1
  23. package/dist/chains/openai_functions/structured_output.cjs +2 -0
  24. package/dist/chains/openai_functions/structured_output.d.ts +3 -1
  25. package/dist/chains/openai_functions/structured_output.js +2 -0
  26. package/dist/chains/sql_db/sql_db_prompt.cjs +20 -1
  27. package/dist/chains/sql_db/sql_db_prompt.d.ts +6 -0
  28. package/dist/chains/sql_db/sql_db_prompt.js +19 -0
  29. package/dist/chat_models/cloudflare_workersai.cjs +2 -0
  30. package/dist/chat_models/cloudflare_workersai.js +2 -0
  31. package/dist/document_transformers/openai_functions.d.ts +1 -1
  32. package/dist/document_transformers/openai_functions.js +1 -1
  33. package/dist/embeddings/cloudflare_workersai.cjs +2 -0
  34. package/dist/embeddings/cloudflare_workersai.js +2 -0
  35. package/dist/experimental/chat_models/anthropic_functions.cjs +2 -2
  36. package/dist/experimental/chat_models/anthropic_functions.js +2 -2
  37. package/dist/experimental/hubs/makersuite/googlemakersuitehub.d.ts +2 -1
  38. package/dist/experimental/plan_and_execute/agent_executor.d.ts +1 -2
  39. package/dist/experimental/plan_and_execute/prompt.d.ts +1 -2
  40. package/dist/llms/cloudflare_workersai.cjs +2 -0
  41. package/dist/llms/cloudflare_workersai.js +2 -0
  42. package/dist/output_parsers/index.cjs +2 -1
  43. package/dist/output_parsers/index.d.ts +1 -1
  44. package/dist/output_parsers/index.js +1 -1
  45. package/dist/output_parsers/openai_functions.d.ts +1 -1
  46. package/dist/output_parsers/openai_tools.cjs +86 -8
  47. package/dist/output_parsers/openai_tools.d.ts +31 -2
  48. package/dist/output_parsers/openai_tools.js +84 -7
  49. package/dist/output_parsers/structured.js +1 -1
  50. package/dist/runnables/remote.cjs +177 -73
  51. package/dist/runnables/remote.d.ts +2 -0
  52. package/dist/runnables/remote.js +178 -74
  53. package/dist/stores/message/cloudflare_d1.cjs +2 -0
  54. package/dist/stores/message/cloudflare_d1.js +2 -0
  55. package/dist/tools/chain.cjs +3 -2
  56. package/dist/tools/chain.d.ts +3 -1
  57. package/dist/tools/chain.js +2 -1
  58. package/dist/tools/convert_to_openai.cjs +3 -26
  59. package/dist/tools/convert_to_openai.d.ts +2 -8
  60. package/dist/tools/convert_to_openai.js +2 -24
  61. package/dist/tools/retriever.cjs +2 -2
  62. package/dist/tools/retriever.d.ts +1 -1
  63. package/dist/tools/retriever.js +1 -1
  64. package/dist/util/sql_utils.cjs +23 -0
  65. package/dist/util/sql_utils.js +24 -1
  66. package/dist/vectorstores/cloudflare_vectorize.cjs +2 -0
  67. package/dist/vectorstores/cloudflare_vectorize.js +2 -0
  68. package/package.json +7 -7
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createOpenAIFunctionsAgent = exports.OpenAIAgent = exports._formatIntermediateSteps = void 0;
4
4
  const runnables_1 = require("@langchain/core/runnables");
5
- const openai_1 = require("@langchain/openai");
5
+ const function_calling_1 = require("@langchain/core/utils/function_calling");
6
6
  const messages_1 = require("@langchain/core/messages");
7
7
  const prompts_1 = require("@langchain/core/prompts");
8
8
  const agent_js_1 = require("../agent.cjs");
@@ -145,7 +145,7 @@ class OpenAIAgent extends agent_js_1.Agent {
145
145
  const llm = this.llmChain.llm;
146
146
  const valuesForPrompt = { ...newInputs };
147
147
  const valuesForLLM = {
148
- functions: this.tools.map(openai_1.formatToOpenAIFunction),
148
+ functions: this.tools.map(function_calling_1.convertToOpenAIFunction),
149
149
  };
150
150
  const callKeys = "callKeys" in this.llmChain.llm ? this.llmChain.llm.callKeys : [];
151
151
  for (const key of callKeys) {
@@ -227,7 +227,7 @@ async function createOpenAIFunctionsAgent({ llm, tools, prompt, }) {
227
227
  ].join("\n"));
228
228
  }
229
229
  const llmWithTools = llm.bind({
230
- functions: tools.map(openai_1.formatToOpenAIFunction),
230
+ functions: tools.map(function_calling_1.convertToOpenAIFunction),
231
231
  });
232
232
  const agent = runnables_1.RunnableSequence.from([
233
233
  runnables_1.RunnablePassthrough.assign({
@@ -1,5 +1,5 @@
1
1
  import { RunnablePassthrough, RunnableSequence, } from "@langchain/core/runnables";
2
- import { formatToOpenAIFunction, } from "@langchain/openai";
2
+ import { convertToOpenAIFunction } from "@langchain/core/utils/function_calling";
3
3
  import { AIMessage, FunctionMessage, } from "@langchain/core/messages";
4
4
  import { ChatPromptTemplate, HumanMessagePromptTemplate, MessagesPlaceholder, SystemMessagePromptTemplate, } from "@langchain/core/prompts";
5
5
  import { Agent } from "../agent.js";
@@ -141,7 +141,7 @@ export class OpenAIAgent extends Agent {
141
141
  const llm = this.llmChain.llm;
142
142
  const valuesForPrompt = { ...newInputs };
143
143
  const valuesForLLM = {
144
- functions: this.tools.map(formatToOpenAIFunction),
144
+ functions: this.tools.map(convertToOpenAIFunction),
145
145
  };
146
146
  const callKeys = "callKeys" in this.llmChain.llm ? this.llmChain.llm.callKeys : [];
147
147
  for (const key of callKeys) {
@@ -222,7 +222,7 @@ export async function createOpenAIFunctionsAgent({ llm, tools, prompt, }) {
222
222
  ].join("\n"));
223
223
  }
224
224
  const llmWithTools = llm.bind({
225
- functions: tools.map(formatToOpenAIFunction),
225
+ functions: tools.map(convertToOpenAIFunction),
226
226
  });
227
227
  const agent = RunnableSequence.from([
228
228
  RunnablePassthrough.assign({
@@ -18,7 +18,7 @@ const types_js_1 = require("../types.cjs");
18
18
  * modelName: "gpt-4",
19
19
  * temperature: 0,
20
20
  * }).bind({
21
- * functions: tools.map((tool) => formatToOpenAIFunction(tool)),
21
+ * functions: tools.map((tool) => convertToOpenAIFunction(tool)),
22
22
  * });
23
23
  *
24
24
  * const runnableAgent = RunnableSequence.from([
@@ -22,7 +22,7 @@ export type FunctionsAgentAction = AgentAction & {
22
22
  * modelName: "gpt-4",
23
23
  * temperature: 0,
24
24
  * }).bind({
25
- * functions: tools.map((tool) => formatToOpenAIFunction(tool)),
25
+ * functions: tools.map((tool) => convertToOpenAIFunction(tool)),
26
26
  * });
27
27
  *
28
28
  * const runnableAgent = RunnableSequence.from([
@@ -15,7 +15,7 @@ import { AgentActionOutputParser } from "../types.js";
15
15
  * modelName: "gpt-4",
16
16
  * temperature: 0,
17
17
  * }).bind({
18
- * functions: tools.map((tool) => formatToOpenAIFunction(tool)),
18
+ * functions: tools.map((tool) => convertToOpenAIFunction(tool)),
19
19
  * });
20
20
  *
21
21
  * const runnableAgent = RunnableSequence.from([
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createOpenAIToolsAgent = exports.OpenAIToolsAgentOutputParser = void 0;
4
4
  const runnables_1 = require("@langchain/core/runnables");
5
- const openai_1 = require("@langchain/openai");
5
+ const function_calling_1 = require("@langchain/core/utils/function_calling");
6
6
  const openai_tools_js_1 = require("../format_scratchpad/openai_tools.cjs");
7
7
  const output_parser_js_1 = require("../openai/output_parser.cjs");
8
8
  Object.defineProperty(exports, "OpenAIToolsAgentOutputParser", { enumerable: true, get: function () { return output_parser_js_1.OpenAIToolsAgentOutputParser; } });
@@ -69,7 +69,7 @@ async function createOpenAIToolsAgent({ llm, tools, prompt, }) {
69
69
  `Found ${JSON.stringify(prompt.inputVariables)} instead.`,
70
70
  ].join("\n"));
71
71
  }
72
- const modelWithTools = llm.bind({ tools: tools.map(openai_1.formatToOpenAITool) });
72
+ const modelWithTools = llm.bind({ tools: tools.map(function_calling_1.convertToOpenAITool) });
73
73
  const agent = runnables_1.RunnableSequence.from([
74
74
  runnables_1.RunnablePassthrough.assign({
75
75
  agent_scratchpad: (input) => (0, openai_tools_js_1.formatToOpenAIToolMessages)(input.steps),
@@ -1,5 +1,5 @@
1
1
  import { RunnablePassthrough, RunnableSequence, } from "@langchain/core/runnables";
2
- import { formatToOpenAITool } from "@langchain/openai";
2
+ import { convertToOpenAITool } from "@langchain/core/utils/function_calling";
3
3
  import { formatToOpenAIToolMessages } from "../format_scratchpad/openai_tools.js";
4
4
  import { OpenAIToolsAgentOutputParser, } from "../openai/output_parser.js";
5
5
  export { OpenAIToolsAgentOutputParser };
@@ -66,7 +66,7 @@ export async function createOpenAIToolsAgent({ llm, tools, prompt, }) {
66
66
  `Found ${JSON.stringify(prompt.inputVariables)} instead.`,
67
67
  ].join("\n"));
68
68
  }
69
- const modelWithTools = llm.bind({ tools: tools.map(formatToOpenAITool) });
69
+ const modelWithTools = llm.bind({ tools: tools.map(convertToOpenAITool) });
70
70
  const agent = RunnableSequence.from([
71
71
  RunnablePassthrough.assign({
72
72
  agent_scratchpad: (input) => formatToOpenAIToolMessages(input.steps),
@@ -24,7 +24,7 @@ const types_js_1 = require("../types.cjs");
24
24
  * new ChatOpenAI({
25
25
  * modelName: "gpt-3.5-turbo-1106",
26
26
  * temperature: 0,
27
- * }).bind({ tools: tools.map(formatToOpenAITool) }),
27
+ * }).bind({ tools: tools.map(convertToOpenAITool) }),
28
28
  * new OpenAIToolsAgentOutputParser(),
29
29
  * ]).withConfig({ runName: "OpenAIToolsAgent" });
30
30
  *
@@ -32,7 +32,7 @@ export type ToolsAgentStep = AgentStep & {
32
32
  * new ChatOpenAI({
33
33
  * modelName: "gpt-3.5-turbo-1106",
34
34
  * temperature: 0,
35
- * }).bind({ tools: tools.map(formatToOpenAITool) }),
35
+ * }).bind({ tools: tools.map(convertToOpenAITool) }),
36
36
  * new OpenAIToolsAgentOutputParser(),
37
37
  * ]).withConfig({ runName: "OpenAIToolsAgent" });
38
38
  *
@@ -21,7 +21,7 @@ import { AgentMultiActionOutputParser } from "../types.js";
21
21
  * new ChatOpenAI({
22
22
  * modelName: "gpt-3.5-turbo-1106",
23
23
  * temperature: 0,
24
- * }).bind({ tools: tools.map(formatToOpenAITool) }),
24
+ * }).bind({ tools: tools.map(convertToOpenAITool) }),
25
25
  * new OpenAIToolsAgentOutputParser(),
26
26
  * ]).withConfig({ runName: "OpenAIToolsAgent" });
27
27
  *
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createRetrieverTool = void 0;
4
4
  const zod_1 = require("zod");
5
- const dynamic_1 = require("@langchain/community/tools/dynamic");
5
+ const tools_1 = require("@langchain/core/tools");
6
6
  const document_js_1 = require("../../../util/document.cjs");
7
7
  /** @deprecated Use "langchain/tools/retriever" instead. */
8
8
  function createRetrieverTool(retriever, input) {
@@ -15,6 +15,6 @@ function createRetrieverTool(retriever, input) {
15
15
  .string()
16
16
  .describe("Natural language query used as input to the retriever"),
17
17
  });
18
- return new dynamic_1.DynamicStructuredTool({ ...input, func, schema });
18
+ return new tools_1.DynamicStructuredTool({ ...input, func, schema });
19
19
  }
20
20
  exports.createRetrieverTool = createRetrieverTool;
@@ -1,6 +1,6 @@
1
1
  import type { BaseRetrieverInterface } from "@langchain/core/retrievers";
2
2
  import { z } from "zod";
3
- import { DynamicStructuredTool, DynamicStructuredToolInput } from "@langchain/community/tools/dynamic";
3
+ import { DynamicStructuredTool, DynamicStructuredToolInput } from "@langchain/core/tools";
4
4
  /** @deprecated Use "langchain/tools/retriever" instead. */
5
5
  export declare function createRetrieverTool(retriever: BaseRetrieverInterface, input: Omit<DynamicStructuredToolInput, "func" | "schema">): DynamicStructuredTool<z.ZodObject<{
6
6
  input: z.ZodString;
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { DynamicStructuredTool, } from "@langchain/community/tools/dynamic";
2
+ import { DynamicStructuredTool, } from "@langchain/core/tools";
3
3
  import { formatDocumentsAsString } from "../../../util/document.js";
4
4
  /** @deprecated Use "langchain/tools/retriever" instead. */
5
5
  export function createRetrieverTool(retriever, input) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createOpenApiAgent = exports.OpenApiToolkit = exports.RequestsToolkit = void 0;
4
- const dynamic_1 = require("@langchain/community/tools/dynamic");
4
+ const tools_1 = require("@langchain/core/tools");
5
5
  const base_1 = require("@langchain/community/agents/toolkits/base");
6
6
  const executor_js_1 = require("../../executor.cjs");
7
7
  const prompt_js_1 = require("./prompt.cjs");
@@ -56,7 +56,7 @@ class OpenApiToolkit extends RequestsToolkit {
56
56
  const jsonAgent = (0, json_js_1.createJsonAgent)(llm, new json_js_1.JsonToolkit(jsonSpec));
57
57
  this.tools = [
58
58
  ...this.tools,
59
- new dynamic_1.DynamicTool({
59
+ new tools_1.DynamicTool({
60
60
  name: "json_explorer",
61
61
  func: async (input) => {
62
62
  const result = await jsonAgent.call({ input });
@@ -1,4 +1,4 @@
1
- import { DynamicTool } from "@langchain/community/tools/dynamic";
1
+ import { DynamicTool } from "@langchain/core/tools";
2
2
  import { Toolkit } from "@langchain/community/agents/toolkits/base";
3
3
  import { AgentExecutor } from "../../executor.js";
4
4
  import { OPENAPI_PREFIX, OPENAPI_SUFFIX, JSON_EXPLORER_DESCRIPTION, } from "./prompt.js";
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  const entrypoint_deprecation_js_1 = require("../util/entrypoint_deprecation.cjs");
18
18
  /* #__PURE__ */ (0, entrypoint_deprecation_js_1.logVersion010MigrationWarning)({
19
19
  oldEntrypointName: "cache/cloudflare_kv",
20
- newEntrypointName: "caches/cloudflare_kv",
20
+ newEntrypointName: "",
21
+ newPackageName: "@langchain/cloudflare",
21
22
  });
22
23
  __exportStar(require("@langchain/community/caches/cloudflare_kv"), exports);
@@ -1,6 +1,7 @@
1
1
  import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js";
2
2
  /* #__PURE__ */ logVersion010MigrationWarning({
3
3
  oldEntrypointName: "cache/cloudflare_kv",
4
- newEntrypointName: "caches/cloudflare_kv",
4
+ newEntrypointName: "",
5
+ newPackageName: "@langchain/cloudflare",
5
6
  });
6
7
  export * from "@langchain/community/caches/cloudflare_kv";
@@ -24,7 +24,7 @@ const output_parsers_1 = require("@langchain/core/output_parsers");
24
24
  * const rephrasePrompt = await pull("langchain-ai/chat-langchain-rephrase");
25
25
  * const llm = new ChatOpenAI({});
26
26
  * const retriever = ...
27
- * const historyAwareRetrieverChain = await createHistoryAwareRetriever({
27
+ * const chain = await createHistoryAwareRetriever({
28
28
  * llm,
29
29
  * retriever,
30
30
  * rephrasePrompt,
@@ -41,7 +41,7 @@ export type CreateHistoryAwareRetrieverParams = {
41
41
  * const rephrasePrompt = await pull("langchain-ai/chat-langchain-rephrase");
42
42
  * const llm = new ChatOpenAI({});
43
43
  * const retriever = ...
44
- * const historyAwareRetrieverChain = await createHistoryAwareRetriever({
44
+ * const chain = await createHistoryAwareRetriever({
45
45
  * llm,
46
46
  * retriever,
47
47
  * rephrasePrompt,
@@ -21,7 +21,7 @@ import { StringOutputParser } from "@langchain/core/output_parsers";
21
21
  * const rephrasePrompt = await pull("langchain-ai/chat-langchain-rephrase");
22
22
  * const llm = new ChatOpenAI({});
23
23
  * const retriever = ...
24
- * const historyAwareRetrieverChain = await createHistoryAwareRetriever({
24
+ * const chain = await createHistoryAwareRetriever({
25
25
  * llm,
26
26
  * retriever,
27
27
  * rephrasePrompt,
@@ -1,5 +1,5 @@
1
1
  import type { z } from "zod";
2
- import { JsonSchema7Type } from "zod-to-json-schema/src/parseDef.js";
2
+ import { JsonSchema7Type } from "zod-to-json-schema";
3
3
  import type { BaseOutputParser } from "@langchain/core/output_parsers";
4
4
  import type { BasePromptTemplate } from "@langchain/core/prompts";
5
5
  import type { RunnableInterface } from "@langchain/core/runnables";
@@ -1,4 +1,4 @@
1
- import { JsonSchema7Type } from "zod-to-json-schema/src/parseDef.js";
1
+ import { JsonSchema7Type } from "zod-to-json-schema";
2
2
  import type { OpenAPIV3_1 } from "openapi-types";
3
3
  import { BaseChatModel } from "@langchain/core/language_models/chat_models";
4
4
  import { BaseFunctionCallOptions } from "@langchain/core/language_models/base";
@@ -102,6 +102,7 @@ class FunctionCallStructuredOutputParser extends output_parsers_1.BaseLLMOutputP
102
102
  }
103
103
  exports.FunctionCallStructuredOutputParser = FunctionCallStructuredOutputParser;
104
104
  /**
105
+ * @deprecated Use {@link https://api.js.langchain.com/functions/langchain_chains_openai_functions.createStructuredOutputRunnable.html | createStructuredOutputRunnable} instead
105
106
  * Create a chain that returns output matching a JSON Schema.
106
107
  * @param input Object that includes all LLMChainInput fields except "outputParser"
107
108
  * as well as an additional required "outputSchema" JSON Schema object.
@@ -137,6 +138,7 @@ function createStructuredOutputChain(input) {
137
138
  });
138
139
  }
139
140
  exports.createStructuredOutputChain = createStructuredOutputChain;
141
+ /** @deprecated Use {@link https://api.js.langchain.com/functions/langchain_chains_openai_functions.createStructuredOutputRunnable.html | createStructuredOutputRunnable} instead */
140
142
  function createStructuredOutputChainFromZod(zodSchema, input) {
141
143
  return createStructuredOutputChain({
142
144
  ...input,
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { JsonSchema7Type } from "zod-to-json-schema/src/parseDef.js";
2
+ import { JsonSchema7Type } from "zod-to-json-schema";
3
3
  import { Validator } from "@langchain/core/utils/json_schema";
4
4
  import { ChatOpenAI } from "@langchain/openai";
5
5
  import { BasePromptTemplate } from "@langchain/core/prompts";
@@ -49,10 +49,12 @@ export declare class FunctionCallStructuredOutputParser<T extends z.AnyZodObject
49
49
  parseResult(generations: ChatGeneration[]): Promise<any>;
50
50
  }
51
51
  /**
52
+ * @deprecated Use {@link https://api.js.langchain.com/functions/langchain_chains_openai_functions.createStructuredOutputRunnable.html | createStructuredOutputRunnable} instead
52
53
  * Create a chain that returns output matching a JSON Schema.
53
54
  * @param input Object that includes all LLMChainInput fields except "outputParser"
54
55
  * as well as an additional required "outputSchema" JSON Schema object.
55
56
  * @returns OpenAPIChain
56
57
  */
57
58
  export declare function createStructuredOutputChain<T extends z.AnyZodObject = z.AnyZodObject>(input: StructuredOutputChainInput<T>): LLMChain<any, BaseChatModel<BaseFunctionCallOptions> | ChatOpenAI<BaseFunctionCallOptions>>;
59
+ /** @deprecated Use {@link https://api.js.langchain.com/functions/langchain_chains_openai_functions.createStructuredOutputRunnable.html | createStructuredOutputRunnable} instead */
58
60
  export declare function createStructuredOutputChainFromZod<T extends z.AnyZodObject>(zodSchema: T, input: Omit<StructuredOutputChainInput<T>, "outputSchema">): LLMChain<any, BaseChatModel<BaseFunctionCallOptions> | ChatOpenAI<BaseFunctionCallOptions>>;
@@ -98,6 +98,7 @@ export class FunctionCallStructuredOutputParser extends BaseLLMOutputParser {
98
98
  }
99
99
  }
100
100
  /**
101
+ * @deprecated Use {@link https://api.js.langchain.com/functions/langchain_chains_openai_functions.createStructuredOutputRunnable.html | createStructuredOutputRunnable} instead
101
102
  * Create a chain that returns output matching a JSON Schema.
102
103
  * @param input Object that includes all LLMChainInput fields except "outputParser"
103
104
  * as well as an additional required "outputSchema" JSON Schema object.
@@ -132,6 +133,7 @@ export function createStructuredOutputChain(input) {
132
133
  ...rest,
133
134
  });
134
135
  }
136
+ /** @deprecated Use {@link https://api.js.langchain.com/functions/langchain_chains_openai_functions.createStructuredOutputRunnable.html | createStructuredOutputRunnable} instead */
135
137
  export function createStructuredOutputChainFromZod(zodSchema, input) {
136
138
  return createStructuredOutputChain({
137
139
  ...input,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SQL_SAP_HANA_PROMPT = exports.SQL_MSSQL_PROMPT = exports.SQL_MYSQL_PROMPT = exports.SQL_SQLITE_PROMPT = exports.SQL_POSTGRES_PROMPT = exports.DEFAULT_SQL_DATABASE_PROMPT = void 0;
3
+ exports.SQL_ORACLE_PROMPT = exports.SQL_SAP_HANA_PROMPT = exports.SQL_MSSQL_PROMPT = exports.SQL_MYSQL_PROMPT = exports.SQL_SQLITE_PROMPT = exports.SQL_POSTGRES_PROMPT = exports.DEFAULT_SQL_DATABASE_PROMPT = void 0;
4
4
  /* eslint-disable spaced-comment */
5
5
  const prompts_1 = require("@langchain/core/prompts");
6
6
  exports.DEFAULT_SQL_DATABASE_PROMPT = new prompts_1.PromptTemplate({
@@ -120,3 +120,22 @@ Only use the following tables:
120
120
  Question: {input}`,
121
121
  inputVariables: ["dialect", "table_info", "input", "top_k"],
122
122
  });
123
+ exports.SQL_ORACLE_PROMPT = new prompts_1.PromptTemplate({
124
+ template: `You are a ORACLE expert. Given an input question, first create a syntactically correct ORACLE query to run, then look at the results of the query and return the answer to the input question.
125
+ Unless the user specifies in the question a specific number of examples to obtain, query for at most {top_k} results using the ROWNUM clause as per ORACLE. You can order the results to return the most informative data in the database.
126
+ Never query for all columns from a table. You must query only the columns that are needed to answer the question.
127
+ Pay attention to use only the column names you can see in the tables below. Be careful to not query for columns that do not exist. Also, pay attention to which column is in which table.
128
+
129
+ Use the following format:
130
+
131
+ Question: "Question here"
132
+ SQLQuery: "SQL Query to run"
133
+ SQLResult: "Result of the SQLQuery"
134
+ Answer: "Final answer here"
135
+
136
+ Only use the following tables:
137
+ {table_info}
138
+
139
+ Question: {input}`,
140
+ inputVariables: ["dialect", "table_info", "input", "top_k"],
141
+ });
@@ -35,3 +35,9 @@ export declare const SQL_SAP_HANA_PROMPT: PromptTemplate<{
35
35
  dialect: any;
36
36
  table_info: any;
37
37
  }, any>;
38
+ export declare const SQL_ORACLE_PROMPT: PromptTemplate<{
39
+ input: any;
40
+ top_k: any;
41
+ dialect: any;
42
+ table_info: any;
43
+ }, any>;
@@ -117,3 +117,22 @@ Only use the following tables:
117
117
  Question: {input}`,
118
118
  inputVariables: ["dialect", "table_info", "input", "top_k"],
119
119
  });
120
+ export const SQL_ORACLE_PROMPT = /*#__PURE__*/ new PromptTemplate({
121
+ template: `You are a ORACLE expert. Given an input question, first create a syntactically correct ORACLE query to run, then look at the results of the query and return the answer to the input question.
122
+ Unless the user specifies in the question a specific number of examples to obtain, query for at most {top_k} results using the ROWNUM clause as per ORACLE. You can order the results to return the most informative data in the database.
123
+ Never query for all columns from a table. You must query only the columns that are needed to answer the question.
124
+ Pay attention to use only the column names you can see in the tables below. Be careful to not query for columns that do not exist. Also, pay attention to which column is in which table.
125
+
126
+ Use the following format:
127
+
128
+ Question: "Question here"
129
+ SQLQuery: "SQL Query to run"
130
+ SQLResult: "Result of the SQLQuery"
131
+ Answer: "Final answer here"
132
+
133
+ Only use the following tables:
134
+ {table_info}
135
+
136
+ Question: {input}`,
137
+ inputVariables: ["dialect", "table_info", "input", "top_k"],
138
+ });
@@ -17,5 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  const entrypoint_deprecation_js_1 = require("../util/entrypoint_deprecation.cjs");
18
18
  /* #__PURE__ */ (0, entrypoint_deprecation_js_1.logVersion010MigrationWarning)({
19
19
  oldEntrypointName: "chat_models/cloudflare_workersai",
20
+ newEntrypointName: "",
21
+ newPackageName: "@langchain/cloudflare",
20
22
  });
21
23
  __exportStar(require("@langchain/community/chat_models/cloudflare_workersai"), exports);
@@ -1,5 +1,7 @@
1
1
  import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js";
2
2
  /* #__PURE__ */ logVersion010MigrationWarning({
3
3
  oldEntrypointName: "chat_models/cloudflare_workersai",
4
+ newEntrypointName: "",
5
+ newPackageName: "@langchain/cloudflare",
4
6
  });
5
7
  export * from "@langchain/community/chat_models/cloudflare_workersai";
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { JsonSchema7ObjectType } from "zod-to-json-schema/src/parsers/object.js";
2
+ import { type JsonSchema7ObjectType } from "zod-to-json-schema";
3
3
  import { Document, MappingDocumentTransformer } from "@langchain/core/documents";
4
4
  import { ChatOpenAI } from "@langchain/openai";
5
5
  import { BaseChain } from "../chains/base.js";
@@ -1,4 +1,4 @@
1
- import { zodToJsonSchema } from "zod-to-json-schema";
1
+ import { zodToJsonSchema, } from "zod-to-json-schema";
2
2
  import { Document, MappingDocumentTransformer, } from "@langchain/core/documents";
3
3
  import { ChatOpenAI } from "@langchain/openai";
4
4
  import { createTaggingChain, } from "../chains/openai_functions/index.js";
@@ -17,5 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  const entrypoint_deprecation_js_1 = require("../util/entrypoint_deprecation.cjs");
18
18
  /* #__PURE__ */ (0, entrypoint_deprecation_js_1.logVersion010MigrationWarning)({
19
19
  oldEntrypointName: "embeddings/cloudflare_workersai",
20
+ newEntrypointName: "",
21
+ newPackageName: "@langchain/cloudflare",
20
22
  });
21
23
  __exportStar(require("@langchain/community/embeddings/cloudflare_workersai"), exports);
@@ -1,5 +1,7 @@
1
1
  import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js";
2
2
  /* #__PURE__ */ logVersion010MigrationWarning({
3
3
  oldEntrypointName: "embeddings/cloudflare_workersai",
4
+ newEntrypointName: "",
5
+ newPackageName: "@langchain/cloudflare",
4
6
  });
5
7
  export * from "@langchain/community/embeddings/cloudflare_workersai";
@@ -5,7 +5,7 @@ const fast_xml_parser_1 = require("fast-xml-parser");
5
5
  const messages_1 = require("@langchain/core/messages");
6
6
  const chat_models_1 = require("@langchain/core/language_models/chat_models");
7
7
  const prompts_1 = require("@langchain/core/prompts");
8
- const openai_1 = require("@langchain/openai");
8
+ const function_calling_1 = require("@langchain/core/utils/function_calling");
9
9
  const anthropic_js_1 = require("../../chat_models/anthropic.cjs");
10
10
  const TOOL_SYSTEM_PROMPT =
11
11
  /* #__PURE__ */
@@ -71,7 +71,7 @@ class AnthropicFunctions extends chat_models_1.BaseChatModel {
71
71
  let functionCall;
72
72
  if (options.tools) {
73
73
  // eslint-disable-next-line no-param-reassign
74
- options.functions = (options.functions ?? []).concat(options.tools.map(openai_1.formatToOpenAIFunction));
74
+ options.functions = (options.functions ?? []).concat(options.tools.map(function_calling_1.convertToOpenAIFunction));
75
75
  }
76
76
  if (options.functions !== undefined && options.functions.length > 0) {
77
77
  const content = await TOOL_SYSTEM_PROMPT.format({
@@ -2,7 +2,7 @@ import { XMLParser } from "fast-xml-parser";
2
2
  import { AIMessage, SystemMessage, } from "@langchain/core/messages";
3
3
  import { BaseChatModel, } from "@langchain/core/language_models/chat_models";
4
4
  import { PromptTemplate } from "@langchain/core/prompts";
5
- import { formatToOpenAIFunction } from "@langchain/openai";
5
+ import { convertToOpenAIFunction } from "@langchain/core/utils/function_calling";
6
6
  import { ChatAnthropic, DEFAULT_STOP_SEQUENCES, } from "../../chat_models/anthropic.js";
7
7
  const TOOL_SYSTEM_PROMPT =
8
8
  /* #__PURE__ */
@@ -68,7 +68,7 @@ export class AnthropicFunctions extends BaseChatModel {
68
68
  let functionCall;
69
69
  if (options.tools) {
70
70
  // eslint-disable-next-line no-param-reassign
71
- options.functions = (options.functions ?? []).concat(options.tools.map(formatToOpenAIFunction));
71
+ options.functions = (options.functions ?? []).concat(options.tools.map(convertToOpenAIFunction));
72
72
  }
73
73
  if (options.functions !== undefined && options.functions.length > 0) {
74
74
  const content = await TOOL_SYSTEM_PROMPT.format({
@@ -2,6 +2,7 @@ import type { protos } from "@google-ai/generativelanguage";
2
2
  import type { google } from "@google-ai/generativelanguage/build/protos/protos.js";
3
3
  import { GoogleAuthOptions } from "google-auth-library";
4
4
  import type { BaseLanguageModel } from "@langchain/core/language_models/base";
5
+ import { Runnable } from "@langchain/core/runnables";
5
6
  import { PromptTemplate } from "@langchain/core/prompts";
6
7
  import { AsyncCaller, AsyncCallerCallOptions } from "@langchain/core/utils/async_caller";
7
8
  import { GoogleAbstractedClientOpsMethod, GoogleResponse, GoogleVertexAIConnectionParams } from "../../../types/googlevertexai-types.js";
@@ -118,7 +119,7 @@ export declare class MakerSuitePrompt {
118
119
  * will have the parameters (model name, temperature, etc) from those in
119
120
  * MakerSuite.
120
121
  */
121
- toChain(): import("@langchain/core/runnables").RunnableSequence<any, any>;
122
+ toChain(): Runnable<any, any, import("@langchain/core/runnables").RunnableConfig>;
122
123
  }
123
124
  interface DriveFileReadParams extends GoogleVertexAIConnectionParams<GoogleAuthOptions> {
124
125
  fileId: string;
@@ -1,8 +1,7 @@
1
1
  import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
2
2
  import { ChainValues } from "@langchain/core/utils/types";
3
- import { Tool } from "@langchain/core/tools";
3
+ import { Tool, DynamicStructuredTool } from "@langchain/core/tools";
4
4
  import { CallbackManagerForChainRun } from "@langchain/core/callbacks/manager";
5
- import { DynamicStructuredTool } from "@langchain/community/tools/dynamic";
6
5
  import { BaseChain, ChainInputs } from "../../chains/base.js";
7
6
  import { BasePlanner, BaseStepContainer, BaseStepExecutor, LLMPlanner, ChainStepExecutor } from "./base.js";
8
7
  import { SerializedLLMChain } from "../../chains/serde.js";
@@ -1,6 +1,5 @@
1
1
  import { ChatPromptTemplate } from "@langchain/core/prompts";
2
- import { Tool } from "@langchain/core/tools";
3
- import { DynamicStructuredTool } from "@langchain/community/tools/dynamic";
2
+ import { Tool, DynamicStructuredTool } from "@langchain/core/tools";
4
3
  export declare const PLANNER_SYSTEM_PROMPT_MESSAGE_TEMPLATE: string;
5
4
  export declare const DEFAULT_STEP_EXECUTOR_HUMAN_CHAT_MESSAGE_TEMPLATE = "Previous steps: {previous_steps}\n\nCurrent objective: {current_step}\n\n{agent_scratchpad}\n\nYou may extract and combine relevant data from your previous steps when responding to me.";
6
5
  /**
@@ -17,5 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  const entrypoint_deprecation_js_1 = require("../util/entrypoint_deprecation.cjs");
18
18
  /* #__PURE__ */ (0, entrypoint_deprecation_js_1.logVersion010MigrationWarning)({
19
19
  oldEntrypointName: "llms/cloudflare_workersai",
20
+ newEntrypointName: "",
21
+ newPackageName: "@langchain/cloudflare",
20
22
  });
21
23
  __exportStar(require("@langchain/community/llms/cloudflare_workersai"), exports);
@@ -1,5 +1,7 @@
1
1
  import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js";
2
2
  /* #__PURE__ */ logVersion010MigrationWarning({
3
3
  oldEntrypointName: "llms/cloudflare_workersai",
4
+ newEntrypointName: "",
5
+ newPackageName: "@langchain/cloudflare",
4
6
  });
5
7
  export * from "@langchain/community/llms/cloudflare_workersai";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DatetimeOutputParser = exports.HttpResponseOutputParser = exports.JsonOutputToolsParser = exports.JsonKeyOutputFunctionsParser = exports.JsonOutputFunctionsParser = exports.OutputFunctionsParser = exports.CustomListOutputParser = exports.RouterOutputParser = exports.CombiningOutputParser = exports.OutputFixingParser = exports.JsonMarkdownStructuredOutputParser = exports.AsymmetricStructuredOutputParser = exports.StructuredOutputParser = exports.RegexParser = exports.CommaSeparatedListOutputParser = exports.ListOutputParser = void 0;
3
+ exports.DatetimeOutputParser = exports.HttpResponseOutputParser = exports.JsonOutputKeyToolsParser = exports.JsonOutputToolsParser = exports.JsonKeyOutputFunctionsParser = exports.JsonOutputFunctionsParser = exports.OutputFunctionsParser = exports.CustomListOutputParser = exports.RouterOutputParser = exports.CombiningOutputParser = exports.OutputFixingParser = exports.JsonMarkdownStructuredOutputParser = exports.AsymmetricStructuredOutputParser = exports.StructuredOutputParser = exports.RegexParser = exports.CommaSeparatedListOutputParser = exports.ListOutputParser = void 0;
4
4
  var list_js_1 = require("./list.cjs");
5
5
  Object.defineProperty(exports, "ListOutputParser", { enumerable: true, get: function () { return list_js_1.ListOutputParser; } });
6
6
  Object.defineProperty(exports, "CommaSeparatedListOutputParser", { enumerable: true, get: function () { return list_js_1.CommaSeparatedListOutputParser; } });
@@ -24,6 +24,7 @@ Object.defineProperty(exports, "JsonOutputFunctionsParser", { enumerable: true,
24
24
  Object.defineProperty(exports, "JsonKeyOutputFunctionsParser", { enumerable: true, get: function () { return openai_functions_js_1.JsonKeyOutputFunctionsParser; } });
25
25
  var openai_tools_js_1 = require("../output_parsers/openai_tools.cjs");
26
26
  Object.defineProperty(exports, "JsonOutputToolsParser", { enumerable: true, get: function () { return openai_tools_js_1.JsonOutputToolsParser; } });
27
+ Object.defineProperty(exports, "JsonOutputKeyToolsParser", { enumerable: true, get: function () { return openai_tools_js_1.JsonOutputKeyToolsParser; } });
27
28
  var http_response_js_1 = require("./http_response.cjs");
28
29
  Object.defineProperty(exports, "HttpResponseOutputParser", { enumerable: true, get: function () { return http_response_js_1.HttpResponseOutputParser; } });
29
30
  var datetime_js_1 = require("./datetime.cjs");
@@ -6,6 +6,6 @@ export { CombiningOutputParser } from "./combining.js";
6
6
  export { RouterOutputParser, type RouterOutputParserInput } from "./router.js";
7
7
  export { CustomListOutputParser } from "./list.js";
8
8
  export { type FunctionParameters, OutputFunctionsParser, JsonOutputFunctionsParser, JsonKeyOutputFunctionsParser, } from "../output_parsers/openai_functions.js";
9
- export { type ParsedToolCall, JsonOutputToolsParser, } from "../output_parsers/openai_tools.js";
9
+ export { type ParsedToolCall, JsonOutputToolsParser, type JsonOutputToolsParserParams, JsonOutputKeyToolsParser, type JsonOutputKeyToolsParserParams, } from "../output_parsers/openai_tools.js";
10
10
  export { HttpResponseOutputParser, type HttpResponseOutputParserInput, } from "./http_response.js";
11
11
  export { DatetimeOutputParser } from "./datetime.js";
@@ -6,6 +6,6 @@ export { CombiningOutputParser } from "./combining.js";
6
6
  export { RouterOutputParser } from "./router.js";
7
7
  export { CustomListOutputParser } from "./list.js";
8
8
  export { OutputFunctionsParser, JsonOutputFunctionsParser, JsonKeyOutputFunctionsParser, } from "../output_parsers/openai_functions.js";
9
- export { JsonOutputToolsParser, } from "../output_parsers/openai_tools.js";
9
+ export { JsonOutputToolsParser, JsonOutputKeyToolsParser, } from "../output_parsers/openai_tools.js";
10
10
  export { HttpResponseOutputParser, } from "./http_response.js";
11
11
  export { DatetimeOutputParser } from "./datetime.js";
@@ -1,4 +1,4 @@
1
- import { JsonSchema7ObjectType } from "zod-to-json-schema/src/parsers/object.js";
1
+ import { JsonSchema7ObjectType } from "zod-to-json-schema";
2
2
  import { type Operation as JSONPatchOperation } from "@langchain/core/utils/json_patch";
3
3
  import { ChatGeneration, Generation } from "@langchain/core/outputs";
4
4
  import { BaseCumulativeTransformOutputParser, type BaseCumulativeTransformOutputParserInput, BaseLLMOutputParser } from "@langchain/core/output_parsers";