langchain 0.3.29 → 0.3.30

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 (110) hide show
  1. package/README.md +15 -12
  2. package/dist/agents/agent.cjs +1 -1
  3. package/dist/agents/agent.d.ts +1 -1
  4. package/dist/agents/agent.js +1 -1
  5. package/dist/agents/mrkl/index.cjs +1 -1
  6. package/dist/agents/mrkl/index.d.ts +1 -1
  7. package/dist/agents/mrkl/index.js +1 -1
  8. package/dist/agents/openai_functions/index.cjs +1 -0
  9. package/dist/agents/openai_functions/index.d.ts +1 -0
  10. package/dist/agents/openai_functions/index.js +1 -0
  11. package/dist/agents/openai_functions/output_parser.cjs +1 -1
  12. package/dist/agents/openai_functions/output_parser.d.ts +1 -1
  13. package/dist/agents/openai_functions/output_parser.js +1 -1
  14. package/dist/agents/openai_tools/index.cjs +1 -1
  15. package/dist/agents/openai_tools/index.d.ts +1 -1
  16. package/dist/agents/openai_tools/index.js +1 -1
  17. package/dist/agents/openai_tools/output_parser.cjs +1 -1
  18. package/dist/agents/openai_tools/output_parser.d.ts +1 -1
  19. package/dist/agents/openai_tools/output_parser.js +1 -1
  20. package/dist/agents/structured_chat/index.cjs +1 -1
  21. package/dist/agents/structured_chat/index.d.ts +1 -1
  22. package/dist/agents/structured_chat/index.js +1 -1
  23. package/dist/agents/structured_chat/outputParser.cjs +1 -1
  24. package/dist/agents/structured_chat/outputParser.d.ts +1 -1
  25. package/dist/agents/structured_chat/outputParser.js +1 -1
  26. package/dist/agents/toolkits/openapi/openapi.cjs +1 -1
  27. package/dist/agents/toolkits/openapi/openapi.d.ts +1 -1
  28. package/dist/agents/toolkits/openapi/openapi.js +1 -1
  29. package/dist/agents/toolkits/sql/sql.cjs +1 -1
  30. package/dist/agents/toolkits/sql/sql.d.ts +1 -1
  31. package/dist/agents/toolkits/sql/sql.js +1 -1
  32. package/dist/agents/toolkits/vectorstore/vectorstore.cjs +1 -1
  33. package/dist/agents/toolkits/vectorstore/vectorstore.d.ts +1 -1
  34. package/dist/agents/toolkits/vectorstore/vectorstore.js +1 -1
  35. package/dist/chains/analyze_documents_chain.cjs +1 -1
  36. package/dist/chains/analyze_documents_chain.d.ts +1 -1
  37. package/dist/chains/analyze_documents_chain.js +1 -1
  38. package/dist/chains/constitutional_ai/constitutional_principle.cjs +2 -2
  39. package/dist/chains/constitutional_ai/constitutional_principle.d.ts +2 -2
  40. package/dist/chains/constitutional_ai/constitutional_principle.js +2 -2
  41. package/dist/chains/conversation.cjs +1 -1
  42. package/dist/chains/conversation.d.ts +1 -1
  43. package/dist/chains/conversation.js +1 -1
  44. package/dist/chains/graph_qa/cypher.cjs +1 -1
  45. package/dist/chains/graph_qa/cypher.d.ts +1 -1
  46. package/dist/chains/graph_qa/cypher.js +1 -1
  47. package/dist/chains/history_aware_retriever.cjs +1 -1
  48. package/dist/chains/history_aware_retriever.d.ts +1 -1
  49. package/dist/chains/history_aware_retriever.js +1 -1
  50. package/dist/chains/llm_chain.cjs +1 -1
  51. package/dist/chains/llm_chain.d.ts +1 -1
  52. package/dist/chains/llm_chain.js +1 -1
  53. package/dist/chains/openai_functions/base.cjs +1 -1
  54. package/dist/chains/openai_functions/base.d.ts +1 -1
  55. package/dist/chains/openai_functions/base.js +1 -1
  56. package/dist/chains/openai_functions/structured_output.cjs +1 -1
  57. package/dist/chains/openai_functions/structured_output.js +1 -1
  58. package/dist/chains/retrieval.cjs +1 -1
  59. package/dist/chains/retrieval.d.ts +1 -1
  60. package/dist/chains/retrieval.js +1 -1
  61. package/dist/chains/router/multi_prompt.cjs +16 -13
  62. package/dist/chains/router/multi_prompt.d.ts +16 -13
  63. package/dist/chains/router/multi_prompt.js +16 -13
  64. package/dist/chains/router/multi_retrieval_qa.cjs +1 -1
  65. package/dist/chains/router/multi_retrieval_qa.d.ts +1 -1
  66. package/dist/chains/router/multi_retrieval_qa.js +1 -1
  67. package/dist/chains/sequential_chain.cjs +2 -2
  68. package/dist/chains/sequential_chain.d.ts +2 -2
  69. package/dist/chains/sequential_chain.js +2 -2
  70. package/dist/chains/sql_db/sql_db_chain.cjs +1 -1
  71. package/dist/chains/sql_db/sql_db_chain.d.ts +1 -1
  72. package/dist/chains/sql_db/sql_db_chain.js +1 -1
  73. package/dist/document_transformers/openai_functions.cjs +1 -1
  74. package/dist/document_transformers/openai_functions.js +1 -1
  75. package/dist/evaluation/loader.cjs +1 -1
  76. package/dist/evaluation/loader.js +1 -1
  77. package/dist/experimental/autogpt/agent.cjs +1 -1
  78. package/dist/experimental/autogpt/agent.d.ts +1 -1
  79. package/dist/experimental/autogpt/agent.js +1 -1
  80. package/dist/experimental/generative_agents/generative_agent.cjs +1 -1
  81. package/dist/experimental/generative_agents/generative_agent.d.ts +1 -1
  82. package/dist/experimental/generative_agents/generative_agent.js +1 -1
  83. package/dist/memory/buffer_memory.cjs +1 -1
  84. package/dist/memory/buffer_memory.d.ts +1 -1
  85. package/dist/memory/buffer_memory.js +1 -1
  86. package/dist/memory/buffer_token_memory.cjs +1 -1
  87. package/dist/memory/buffer_token_memory.d.ts +1 -1
  88. package/dist/memory/buffer_token_memory.js +1 -1
  89. package/dist/memory/buffer_window_memory.cjs +1 -1
  90. package/dist/memory/buffer_window_memory.d.ts +1 -1
  91. package/dist/memory/buffer_window_memory.js +1 -1
  92. package/dist/memory/entity_memory.cjs +2 -2
  93. package/dist/memory/entity_memory.d.ts +2 -2
  94. package/dist/memory/entity_memory.js +2 -2
  95. package/dist/memory/summary.cjs +2 -2
  96. package/dist/memory/summary.d.ts +2 -2
  97. package/dist/memory/summary.js +2 -2
  98. package/dist/memory/summary_buffer.cjs +2 -2
  99. package/dist/memory/summary_buffer.d.ts +2 -2
  100. package/dist/memory/summary_buffer.js +2 -2
  101. package/dist/retrievers/hyde.cjs +1 -1
  102. package/dist/retrievers/hyde.d.ts +1 -1
  103. package/dist/retrievers/hyde.js +1 -1
  104. package/dist/retrievers/self_query/index.cjs +1 -1
  105. package/dist/retrievers/self_query/index.d.ts +1 -1
  106. package/dist/retrievers/self_query/index.js +1 -1
  107. package/dist/tools/webbrowser.cjs +1 -1
  108. package/dist/tools/webbrowser.d.ts +1 -1
  109. package/dist/tools/webbrowser.js +1 -1
  110. package/package.json +4 -4
@@ -126,7 +126,7 @@ export type CreateStructuredOutputRunnableConfig<RunInput extends Record<string,
126
126
  * required: ["name", "age"],
127
127
  * };
128
128
  *
129
- * const model = new ChatOpenAI();
129
+ * const model = new ChatOpenAI({ model: "gpt-4o-mini" });
130
130
  * const prompt = ChatPromptTemplate.fromMessages([
131
131
  * ["human", "Human description: {description}"],
132
132
  * ]);
@@ -94,7 +94,7 @@ export function createOpenAIFnRunnable(config) {
94
94
  * required: ["name", "age"],
95
95
  * };
96
96
  *
97
- * const model = new ChatOpenAI();
97
+ * const model = new ChatOpenAI({ model: "gpt-4o-mini" });
98
98
  * const prompt = ChatPromptTemplate.fromMessages([
99
99
  * ["human", "Human description: {description}"],
100
100
  * ]);
@@ -111,7 +111,7 @@ exports.FunctionCallStructuredOutputParser = FunctionCallStructuredOutputParser;
111
111
  * @returns OpenAPIChain
112
112
  */
113
113
  function createStructuredOutputChain(input) {
114
- const { outputSchema, llm = new openai_1.ChatOpenAI({ modelName: "gpt-3.5-turbo-0613", temperature: 0 }), outputKey = "output", llmKwargs = {}, zodSchema, ...rest } = input;
114
+ const { outputSchema, llm = new openai_1.ChatOpenAI({ model: "gpt-3.5-turbo-0613", temperature: 0 }), outputKey = "output", llmKwargs = {}, zodSchema, ...rest } = input;
115
115
  if (outputSchema === undefined && zodSchema === undefined) {
116
116
  throw new Error(`Must provide one of "outputSchema" or "zodSchema".`);
117
117
  }
@@ -105,7 +105,7 @@ export class FunctionCallStructuredOutputParser extends BaseLLMOutputParser {
105
105
  * @returns OpenAPIChain
106
106
  */
107
107
  export function createStructuredOutputChain(input) {
108
- const { outputSchema, llm = new ChatOpenAI({ modelName: "gpt-3.5-turbo-0613", temperature: 0 }), outputKey = "output", llmKwargs = {}, zodSchema, ...rest } = input;
108
+ const { outputSchema, llm = new ChatOpenAI({ model: "gpt-3.5-turbo-0613", temperature: 0 }), outputKey = "output", llmKwargs = {}, zodSchema, ...rest } = input;
109
109
  if (outputSchema === undefined && zodSchema === undefined) {
110
110
  throw new Error(`Must provide one of "outputSchema" or "zodSchema".`);
111
111
  }
@@ -22,7 +22,7 @@ function isBaseRetriever(x) {
22
22
  * import { createStuffDocumentsChain } from "langchain/chains/combine_documents";
23
23
  *
24
24
  * const retrievalQAChatPrompt = await pull("langchain-ai/retrieval-qa-chat");
25
- * const llm = new ChatOpenAI({});
25
+ * const llm = new ChatOpenAI({ model: "gpt-4o-mini" });
26
26
  * const retriever = ...
27
27
  * const combineDocsChain = await createStuffDocumentsChain(...);
28
28
  * const retrievalChain = await createRetrievalChain({
@@ -42,7 +42,7 @@ export type CreateRetrievalChainParams<RunOutput> = {
42
42
  * import { createStuffDocumentsChain } from "langchain/chains/combine_documents";
43
43
  *
44
44
  * const retrievalQAChatPrompt = await pull("langchain-ai/retrieval-qa-chat");
45
- * const llm = new ChatOpenAI({});
45
+ * const llm = new ChatOpenAI({ model: "gpt-4o-mini" });
46
46
  * const retriever = ...
47
47
  * const combineDocsChain = await createStuffDocumentsChain(...);
48
48
  * const retrievalChain = await createRetrievalChain({
@@ -19,7 +19,7 @@ function isBaseRetriever(x) {
19
19
  * import { createStuffDocumentsChain } from "langchain/chains/combine_documents";
20
20
  *
21
21
  * const retrievalQAChatPrompt = await pull("langchain-ai/retrieval-qa-chat");
22
- * const llm = new ChatOpenAI({});
22
+ * const llm = new ChatOpenAI({ model: "gpt-4o-mini" });
23
23
  * const retriever = ...
24
24
  * const combineDocsChain = await createStuffDocumentsChain(...);
25
25
  * const retrievalChain = await createRetrievalChain({
@@ -16,19 +16,22 @@ const router_js_1 = require("../../output_parsers/router.cjs");
16
16
  * functionality specific to multi-prompt chains.
17
17
  * @example
18
18
  * ```typescript
19
- * const multiPromptChain = MultiPromptChain.fromLLMAndPrompts(new ChatOpenAI(), {
20
- * promptNames: ["physics", "math", "history"],
21
- * promptDescriptions: [
22
- * "Good for answering questions about physics",
23
- * "Good for answering math questions",
24
- * "Good for answering questions about history",
25
- * ],
26
- * promptTemplates: [
27
- * `You are a very smart physics professor. Here is a question:\n{input}\n`,
28
- * `You are a very good mathematician. Here is a question:\n{input}\n`,
29
- * `You are a very smart history professor. Here is a question:\n{input}\n`,
30
- * ],
31
- * });
19
+ * const multiPromptChain = MultiPromptChain.fromLLMAndPrompts(
20
+ * new ChatOpenAI({ model: "gpt-4o-mini" }),
21
+ * {
22
+ * promptNames: ["physics", "math", "history"],
23
+ * promptDescriptions: [
24
+ * "Good for answering questions about physics",
25
+ * "Good for answering math questions",
26
+ * "Good for answering questions about history",
27
+ * ],
28
+ * promptTemplates: [
29
+ * `You are a very smart physics professor. Here is a question:\n{input}\n`,
30
+ * `You are a very good mathematician. Here is a question:\n{input}\n`,
31
+ * `You are a very smart history professor. Here is a question:\n{input}\n`,
32
+ * ],
33
+ * }
34
+ * );
32
35
  * const result = await multiPromptChain.call({
33
36
  * input: "What is the speed of light?",
34
37
  * });
@@ -9,19 +9,22 @@ import { LLMChainInput } from "../../chains/llm_chain.js";
9
9
  * functionality specific to multi-prompt chains.
10
10
  * @example
11
11
  * ```typescript
12
- * const multiPromptChain = MultiPromptChain.fromLLMAndPrompts(new ChatOpenAI(), {
13
- * promptNames: ["physics", "math", "history"],
14
- * promptDescriptions: [
15
- * "Good for answering questions about physics",
16
- * "Good for answering math questions",
17
- * "Good for answering questions about history",
18
- * ],
19
- * promptTemplates: [
20
- * `You are a very smart physics professor. Here is a question:\n{input}\n`,
21
- * `You are a very good mathematician. Here is a question:\n{input}\n`,
22
- * `You are a very smart history professor. Here is a question:\n{input}\n`,
23
- * ],
24
- * });
12
+ * const multiPromptChain = MultiPromptChain.fromLLMAndPrompts(
13
+ * new ChatOpenAI({ model: "gpt-4o-mini" }),
14
+ * {
15
+ * promptNames: ["physics", "math", "history"],
16
+ * promptDescriptions: [
17
+ * "Good for answering questions about physics",
18
+ * "Good for answering math questions",
19
+ * "Good for answering questions about history",
20
+ * ],
21
+ * promptTemplates: [
22
+ * `You are a very smart physics professor. Here is a question:\n{input}\n`,
23
+ * `You are a very good mathematician. Here is a question:\n{input}\n`,
24
+ * `You are a very smart history professor. Here is a question:\n{input}\n`,
25
+ * ],
26
+ * }
27
+ * );
25
28
  * const result = await multiPromptChain.call({
26
29
  * input: "What is the speed of light?",
27
30
  * });
@@ -13,19 +13,22 @@ import { RouterOutputParser } from "../../output_parsers/router.js";
13
13
  * functionality specific to multi-prompt chains.
14
14
  * @example
15
15
  * ```typescript
16
- * const multiPromptChain = MultiPromptChain.fromLLMAndPrompts(new ChatOpenAI(), {
17
- * promptNames: ["physics", "math", "history"],
18
- * promptDescriptions: [
19
- * "Good for answering questions about physics",
20
- * "Good for answering math questions",
21
- * "Good for answering questions about history",
22
- * ],
23
- * promptTemplates: [
24
- * `You are a very smart physics professor. Here is a question:\n{input}\n`,
25
- * `You are a very good mathematician. Here is a question:\n{input}\n`,
26
- * `You are a very smart history professor. Here is a question:\n{input}\n`,
27
- * ],
28
- * });
16
+ * const multiPromptChain = MultiPromptChain.fromLLMAndPrompts(
17
+ * new ChatOpenAI({ model: "gpt-4o-mini" }),
18
+ * {
19
+ * promptNames: ["physics", "math", "history"],
20
+ * promptDescriptions: [
21
+ * "Good for answering questions about physics",
22
+ * "Good for answering math questions",
23
+ * "Good for answering questions about history",
24
+ * ],
25
+ * promptTemplates: [
26
+ * `You are a very smart physics professor. Here is a question:\n{input}\n`,
27
+ * `You are a very good mathematician. Here is a question:\n{input}\n`,
28
+ * `You are a very smart history professor. Here is a question:\n{input}\n`,
29
+ * ],
30
+ * }
31
+ * );
29
32
  * const result = await multiPromptChain.call({
30
33
  * input: "What is the speed of light?",
31
34
  * });
@@ -18,7 +18,7 @@ const router_js_1 = require("../../output_parsers/router.cjs");
18
18
  * @example
19
19
  * ```typescript
20
20
  * const multiRetrievalQAChain = MultiRetrievalQAChain.fromLLMAndRetrievers(
21
- * new ChatOpenAI(),
21
+ * new ChatOpenAI({ model: "gpt-4o-mini" }),
22
22
  * {
23
23
  * retrieverNames: ["aqua teen", "mst3k", "animaniacs"],
24
24
  * retrieverDescriptions: [
@@ -22,7 +22,7 @@ export type MultiRetrievalDefaults = {
22
22
  * @example
23
23
  * ```typescript
24
24
  * const multiRetrievalQAChain = MultiRetrievalQAChain.fromLLMAndRetrievers(
25
- * new ChatOpenAI(),
25
+ * new ChatOpenAI({ model: "gpt-4o-mini" }),
26
26
  * {
27
27
  * retrieverNames: ["aqua teen", "mst3k", "animaniacs"],
28
28
  * retrieverDescriptions: [
@@ -15,7 +15,7 @@ import { RouterOutputParser } from "../../output_parsers/router.js";
15
15
  * @example
16
16
  * ```typescript
17
17
  * const multiRetrievalQAChain = MultiRetrievalQAChain.fromLLMAndRetrievers(
18
- * new ChatOpenAI(),
18
+ * new ChatOpenAI({ model: "gpt-4o-mini" }),
19
19
  * {
20
20
  * retrieverNames: ["aqua teen", "mst3k", "animaniacs"],
21
21
  * retrieverDescriptions: [
@@ -32,12 +32,12 @@ function formatSet(input) {
32
32
  * const overallChain = new SequentialChain({
33
33
  * chains: [
34
34
  * new LLMChain({
35
- * llm: new ChatOpenAI({ temperature: 0 }),
35
+ * llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
36
36
  * prompt: promptTemplate,
37
37
  * outputKey: "synopsis",
38
38
  * }),
39
39
  * new LLMChain({
40
- * llm: new OpenAI({ temperature: 0 }),
40
+ * llm: new OpenAI({ model: "gpt-4o-mini", temperature: 0 }),
41
41
  * prompt: reviewPromptTemplate,
42
42
  * outputKey: "review",
43
43
  * }),
@@ -43,12 +43,12 @@ export interface SequentialChainInput extends ChainInputs {
43
43
  * const overallChain = new SequentialChain({
44
44
  * chains: [
45
45
  * new LLMChain({
46
- * llm: new ChatOpenAI({ temperature: 0 }),
46
+ * llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
47
47
  * prompt: promptTemplate,
48
48
  * outputKey: "synopsis",
49
49
  * }),
50
50
  * new LLMChain({
51
- * llm: new OpenAI({ temperature: 0 }),
51
+ * llm: new OpenAI({ model: "gpt-4o-mini", temperature: 0 }),
52
52
  * prompt: reviewPromptTemplate,
53
53
  * outputKey: "review",
54
54
  * }),
@@ -29,12 +29,12 @@ function formatSet(input) {
29
29
  * const overallChain = new SequentialChain({
30
30
  * chains: [
31
31
  * new LLMChain({
32
- * llm: new ChatOpenAI({ temperature: 0 }),
32
+ * llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
33
33
  * prompt: promptTemplate,
34
34
  * outputKey: "synopsis",
35
35
  * }),
36
36
  * new LLMChain({
37
- * llm: new OpenAI({ temperature: 0 }),
37
+ * llm: new OpenAI({ model: "gpt-4o-mini", temperature: 0 }),
38
38
  * prompt: reviewPromptTemplate,
39
39
  * outputKey: "review",
40
40
  * }),
@@ -218,7 +218,7 @@ const difference = (setA, setB) => new Set([...setA].filter((x) => !setB.has(x))
218
218
  * const db = await SqlDatabase.fromDataSourceParams({
219
219
  * appDataSource: datasource,
220
220
  * });
221
- * const llm = new ChatOpenAI({ temperature: 0 });
221
+ * const llm = new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 });
222
222
  * const chain = await createSqlQueryChain({
223
223
  * llm,
224
224
  * db,
@@ -104,7 +104,7 @@ export interface CreateSqlQueryChainFields {
104
104
  * const db = await SqlDatabase.fromDataSourceParams({
105
105
  * appDataSource: datasource,
106
106
  * });
107
- * const llm = new ChatOpenAI({ temperature: 0 });
107
+ * const llm = new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 });
108
108
  * const chain = await createSqlQueryChain({
109
109
  * llm,
110
110
  * db,
@@ -213,7 +213,7 @@ const difference = (setA, setB) => new Set([...setA].filter((x) => !setB.has(x))
213
213
  * const db = await SqlDatabase.fromDataSourceParams({
214
214
  * appDataSource: datasource,
215
215
  * });
216
- * const llm = new ChatOpenAI({ temperature: 0 });
216
+ * const llm = new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 });
217
217
  * const chain = await createSqlQueryChain({
218
218
  * llm,
219
219
  * db,
@@ -43,7 +43,7 @@ class MetadataTagger extends documents_1.MappingDocumentTransformer {
43
43
  }
44
44
  exports.MetadataTagger = MetadataTagger;
45
45
  function createMetadataTagger(schema, options) {
46
- const { llm = new openai_1.ChatOpenAI({ modelName: "gpt-3.5-turbo-0613" }), ...rest } = options;
46
+ const { llm = new openai_1.ChatOpenAI({ model: "gpt-3.5-turbo-0613" }), ...rest } = options;
47
47
  const taggingChain = (0, index_js_1.createTaggingChain)(schema, llm, rest);
48
48
  return new MetadataTagger({ taggingChain });
49
49
  }
@@ -37,7 +37,7 @@ export class MetadataTagger extends MappingDocumentTransformer {
37
37
  }
38
38
  }
39
39
  export function createMetadataTagger(schema, options) {
40
- const { llm = new ChatOpenAI({ modelName: "gpt-3.5-turbo-0613" }), ...rest } = options;
40
+ const { llm = new ChatOpenAI({ model: "gpt-3.5-turbo-0613" }), ...rest } = options;
41
41
  const taggingChain = createTaggingChain(schema, llm, rest);
42
42
  return new MetadataTagger({ taggingChain });
43
43
  }
@@ -19,7 +19,7 @@ async function loadEvaluator(type, options) {
19
19
  const { llm, chainOptions, criteria, agentTools } = options || {};
20
20
  const llm_ = llm ??
21
21
  new openai_1.ChatOpenAI({
22
- modelName: "gpt-4",
22
+ model: "gpt-4",
23
23
  temperature: 0.0,
24
24
  });
25
25
  let evaluator;
@@ -16,7 +16,7 @@ export async function loadEvaluator(type, options) {
16
16
  const { llm, chainOptions, criteria, agentTools } = options || {};
17
17
  const llm_ = llm ??
18
18
  new ChatOpenAI({
19
- modelName: "gpt-4",
19
+ model: "gpt-4",
20
20
  temperature: 0.0,
21
21
  });
22
22
  let evaluator;
@@ -16,7 +16,7 @@ const text_splitter_js_1 = require("../../text_splitter.cjs");
16
16
  * @example
17
17
  * ```typescript
18
18
  * const autogpt = AutoGPT.fromLLMAndTools(
19
- * new ChatOpenAI({ temperature: 0 }),
19
+ * new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
20
20
  * [
21
21
  * new ReadFileTool({ store: new InMemoryFileStore() }),
22
22
  * new WriteFileTool({ store: new InMemoryFileStore() }),
@@ -24,7 +24,7 @@ export interface AutoGPTInput {
24
24
  * @example
25
25
  * ```typescript
26
26
  * const autogpt = AutoGPT.fromLLMAndTools(
27
- * new ChatOpenAI({ temperature: 0 }),
27
+ * new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
28
28
  * [
29
29
  * new ReadFileTool({ store: new InMemoryFileStore() }),
30
30
  * new WriteFileTool({ store: new InMemoryFileStore() }),
@@ -13,7 +13,7 @@ import { TokenTextSplitter } from "../../text_splitter.js";
13
13
  * @example
14
14
  * ```typescript
15
15
  * const autogpt = AutoGPT.fromLLMAndTools(
16
- * new ChatOpenAI({ temperature: 0 }),
16
+ * new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
17
17
  * [
18
18
  * new ReadFileTool({ store: new InMemoryFileStore() }),
19
19
  * new WriteFileTool({ store: new InMemoryFileStore() }),
@@ -13,7 +13,7 @@ const base_js_1 = require("../../chains/base.cjs");
13
13
  * const tommie: GenerativeAgent = new GenerativeAgent(
14
14
  * new OpenAI({ temperature: 0.9, maxTokens: 1500 }),
15
15
  * new GenerativeAgentMemory(
16
- * new ChatOpenAI(),
16
+ * new ChatOpenAI({ model: "gpt-4o-mini" }),
17
17
  * new TimeWeightedVectorStoreRetriever({
18
18
  * vectorStore: new MemoryVectorStore(new OpenAIEmbeddings()),
19
19
  * otherScoreKeys: ["importance"],
@@ -27,7 +27,7 @@ export type GenerativeAgentConfig = {
27
27
  * const tommie: GenerativeAgent = new GenerativeAgent(
28
28
  * new OpenAI({ temperature: 0.9, maxTokens: 1500 }),
29
29
  * new GenerativeAgentMemory(
30
- * new ChatOpenAI(),
30
+ * new ChatOpenAI({ model: "gpt-4o-mini" }),
31
31
  * new TimeWeightedVectorStoreRetriever({
32
32
  * vectorStore: new MemoryVectorStore(new OpenAIEmbeddings()),
33
33
  * otherScoreKeys: ["importance"],
@@ -10,7 +10,7 @@ import { BaseChain } from "../../chains/base.js";
10
10
  * const tommie: GenerativeAgent = new GenerativeAgent(
11
11
  * new OpenAI({ temperature: 0.9, maxTokens: 1500 }),
12
12
  * new GenerativeAgentMemory(
13
- * new ChatOpenAI(),
13
+ * new ChatOpenAI({ model: "gpt-4o-mini" }),
14
14
  * new TimeWeightedVectorStoreRetriever({
15
15
  * vectorStore: new MemoryVectorStore(new OpenAIEmbeddings()),
16
16
  * otherScoreKeys: ["importance"],
@@ -18,7 +18,7 @@ const chat_memory_js_1 = require("./chat_memory.cjs");
18
18
  * ```typescript
19
19
  * // Initialize the memory to store chat history and set up the language model with a specific temperature.
20
20
  * const memory = new BufferMemory({ memoryKey: "chat_history" });
21
- * const model = new ChatOpenAI({ temperature: 0.9 });
21
+ * const model = new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0.9 });
22
22
  *
23
23
  * // Create a prompt template for a friendly conversation between a human and an AI.
24
24
  * const prompt =
@@ -23,7 +23,7 @@ export interface BufferMemoryInput extends BaseChatMemoryInput {
23
23
  * ```typescript
24
24
  * // Initialize the memory to store chat history and set up the language model with a specific temperature.
25
25
  * const memory = new BufferMemory({ memoryKey: "chat_history" });
26
- * const model = new ChatOpenAI({ temperature: 0.9 });
26
+ * const model = new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0.9 });
27
27
  *
28
28
  * // Create a prompt template for a friendly conversation between a human and an AI.
29
29
  * const prompt =
@@ -15,7 +15,7 @@ import { BaseChatMemory } from "./chat_memory.js";
15
15
  * ```typescript
16
16
  * // Initialize the memory to store chat history and set up the language model with a specific temperature.
17
17
  * const memory = new BufferMemory({ memoryKey: "chat_history" });
18
- * const model = new ChatOpenAI({ temperature: 0.9 });
18
+ * const model = new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0.9 });
19
19
  *
20
20
  * // Create a prompt template for a friendly conversation between a human and an AI.
21
21
  * const prompt =
@@ -10,7 +10,7 @@ const chat_memory_js_1 = require("./chat_memory.cjs");
10
10
  * @example
11
11
  * ```typescript
12
12
  * const memory = new ConversationTokenBufferMemory({
13
- * llm: new ChatOpenAI({}),
13
+ * llm: new ChatOpenAI({ model: "gpt-4o-mini" }),
14
14
  * maxTokenLimit: 10,
15
15
  * });
16
16
  *
@@ -18,7 +18,7 @@ export interface ConversationTokenBufferMemoryInput extends BaseChatMemoryInput
18
18
  * @example
19
19
  * ```typescript
20
20
  * const memory = new ConversationTokenBufferMemory({
21
- * llm: new ChatOpenAI({}),
21
+ * llm: new ChatOpenAI({ model: "gpt-4o-mini" }),
22
22
  * maxTokenLimit: 10,
23
23
  * });
24
24
  *
@@ -7,7 +7,7 @@ import { BaseChatMemory } from "./chat_memory.js";
7
7
  * @example
8
8
  * ```typescript
9
9
  * const memory = new ConversationTokenBufferMemory({
10
- * llm: new ChatOpenAI({}),
10
+ * llm: new ChatOpenAI({ model: "gpt-4o-mini" }),
11
11
  * maxTokenLimit: 10,
12
12
  * });
13
13
  *
@@ -18,7 +18,7 @@ const chat_memory_js_1 = require("./chat_memory.cjs");
18
18
  * AI:`);
19
19
  *
20
20
  * const chain = new LLMChain({
21
- * llm: new ChatOpenAI({ temperature: 0.9 }),
21
+ * llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0.9 }),
22
22
  * prompt,
23
23
  * memory: new BufferWindowMemory({ memoryKey: "chat_history", k: 1 }),
24
24
  * });
@@ -24,7 +24,7 @@ export interface BufferWindowMemoryInput extends BaseChatMemoryInput {
24
24
  * AI:`);
25
25
  *
26
26
  * const chain = new LLMChain({
27
- * llm: new ChatOpenAI({ temperature: 0.9 }),
27
+ * llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0.9 }),
28
28
  * prompt,
29
29
  * memory: new BufferWindowMemory({ memoryKey: "chat_history", k: 1 }),
30
30
  * });
@@ -15,7 +15,7 @@ import { BaseChatMemory } from "./chat_memory.js";
15
15
  * AI:`);
16
16
  *
17
17
  * const chain = new LLMChain({
18
- * llm: new ChatOpenAI({ temperature: 0.9 }),
18
+ * llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0.9 }),
19
19
  * prompt,
20
20
  * memory: new BufferWindowMemory({ memoryKey: "chat_history", k: 1 }),
21
21
  * });
@@ -15,11 +15,11 @@ const chat_memory_js_1 = require("./chat_memory.cjs");
15
15
  * @example
16
16
  * ```typescript
17
17
  * const memory = new EntityMemory({
18
- * llm: new ChatOpenAI({ temperature: 0 }),
18
+ * llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
19
19
  * chatHistoryKey: "history",
20
20
  * entitiesKey: "entities",
21
21
  * });
22
- * const model = new ChatOpenAI({ temperature: 0.9 });
22
+ * const model = new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0.9 });
23
23
  * const chain = new LLMChain({
24
24
  * llm: model,
25
25
  * prompt: ENTITY_MEMORY_CONVERSATION_TEMPLATE,
@@ -25,11 +25,11 @@ export interface EntityMemoryInput extends BaseChatMemoryInput {
25
25
  * @example
26
26
  * ```typescript
27
27
  * const memory = new EntityMemory({
28
- * llm: new ChatOpenAI({ temperature: 0 }),
28
+ * llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
29
29
  * chatHistoryKey: "history",
30
30
  * entitiesKey: "entities",
31
31
  * });
32
- * const model = new ChatOpenAI({ temperature: 0.9 });
32
+ * const model = new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0.9 });
33
33
  * const chain = new LLMChain({
34
34
  * llm: model,
35
35
  * prompt: ENTITY_MEMORY_CONVERSATION_TEMPLATE,
@@ -12,11 +12,11 @@ import { BaseChatMemory } from "./chat_memory.js";
12
12
  * @example
13
13
  * ```typescript
14
14
  * const memory = new EntityMemory({
15
- * llm: new ChatOpenAI({ temperature: 0 }),
15
+ * llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
16
16
  * chatHistoryKey: "history",
17
17
  * entitiesKey: "entities",
18
18
  * });
19
- * const model = new ChatOpenAI({ temperature: 0.9 });
19
+ * const model = new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0.9 });
20
20
  * const chain = new LLMChain({
21
21
  * llm: model,
22
22
  * prompt: ENTITY_MEMORY_CONVERSATION_TEMPLATE,
@@ -83,10 +83,10 @@ exports.BaseConversationSummaryMemory = BaseConversationSummaryMemory;
83
83
  * ```typescript
84
84
  * const memory = new ConversationSummaryMemory({
85
85
  * memoryKey: "chat_history",
86
- * llm: new ChatOpenAI({ modelName: "gpt-3.5-turbo", temperature: 0 }),
86
+ * llm: new ChatOpenAI({ model: "gpt-3.5-turbo", temperature: 0 }),
87
87
  * });
88
88
  *
89
- * const model = new ChatOpenAI();
89
+ * const model = new ChatOpenAI({ model: "gpt-4o-mini" });
90
90
  * const prompt =
91
91
  * PromptTemplate.fromTemplate(`The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.
92
92
  *
@@ -51,10 +51,10 @@ export declare abstract class BaseConversationSummaryMemory extends BaseChatMemo
51
51
  * ```typescript
52
52
  * const memory = new ConversationSummaryMemory({
53
53
  * memoryKey: "chat_history",
54
- * llm: new ChatOpenAI({ modelName: "gpt-3.5-turbo", temperature: 0 }),
54
+ * llm: new ChatOpenAI({ model: "gpt-3.5-turbo", temperature: 0 }),
55
55
  * });
56
56
  *
57
- * const model = new ChatOpenAI();
57
+ * const model = new ChatOpenAI({ model: "gpt-4o-mini" });
58
58
  * const prompt =
59
59
  * PromptTemplate.fromTemplate(`The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.
60
60
  *
@@ -79,10 +79,10 @@ export class BaseConversationSummaryMemory extends BaseChatMemory {
79
79
  * ```typescript
80
80
  * const memory = new ConversationSummaryMemory({
81
81
  * memoryKey: "chat_history",
82
- * llm: new ChatOpenAI({ modelName: "gpt-3.5-turbo", temperature: 0 }),
82
+ * llm: new ChatOpenAI({ model: "gpt-3.5-turbo", temperature: 0 }),
83
83
  * });
84
84
  *
85
- * const model = new ChatOpenAI();
85
+ * const model = new ChatOpenAI({ model: "gpt-4o-mini" });
86
86
  * const prompt =
87
87
  * PromptTemplate.fromTemplate(`The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.
88
88
  *
@@ -13,7 +13,7 @@ const summary_js_1 = require("./summary.cjs");
13
13
  * ```typescript
14
14
  * // Initialize the memory with a specific model and token limit
15
15
  * const memory = new ConversationSummaryBufferMemory({
16
- * llm: new ChatOpenAI({ modelName: "gpt-3.5-turbo-instruct", temperature: 0 }),
16
+ * llm: new ChatOpenAI({ model: "gpt-3.5-turbo-instruct", temperature: 0 }),
17
17
  * maxTokenLimit: 10,
18
18
  * });
19
19
  *
@@ -36,7 +36,7 @@ const summary_js_1 = require("./summary.cjs");
36
36
  *
37
37
  * // Initialize the conversation chain with the model, memory, and prompt
38
38
  * const chain = new ConversationChain({
39
- * llm: new ChatOpenAI({ temperature: 0.9, verbose: true }),
39
+ * llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0.9, verbose: true }),
40
40
  * memory: memory,
41
41
  * prompt: chatPrompt,
42
42
  * });
@@ -17,7 +17,7 @@ export interface ConversationSummaryBufferMemoryInput extends BaseConversationSu
17
17
  * ```typescript
18
18
  * // Initialize the memory with a specific model and token limit
19
19
  * const memory = new ConversationSummaryBufferMemory({
20
- * llm: new ChatOpenAI({ modelName: "gpt-3.5-turbo-instruct", temperature: 0 }),
20
+ * llm: new ChatOpenAI({ model: "gpt-3.5-turbo-instruct", temperature: 0 }),
21
21
  * maxTokenLimit: 10,
22
22
  * });
23
23
  *
@@ -40,7 +40,7 @@ export interface ConversationSummaryBufferMemoryInput extends BaseConversationSu
40
40
  *
41
41
  * // Initialize the conversation chain with the model, memory, and prompt
42
42
  * const chain = new ConversationChain({
43
- * llm: new ChatOpenAI({ temperature: 0.9, verbose: true }),
43
+ * llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0.9, verbose: true }),
44
44
  * memory: memory,
45
45
  * prompt: chatPrompt,
46
46
  * });