langchain 0.3.7 → 0.3.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/dist/chains/combine_documents/base.cjs +3 -0
- package/dist/chains/combine_documents/base.js +3 -0
- package/dist/chains/query_constructor/parser.cjs +2 -1
- package/dist/chains/query_constructor/parser.js +2 -1
- package/dist/chat_models/universal.cjs +5 -0
- package/dist/chat_models/universal.js +5 -0
- package/package.json +6 -1
|
@@ -8,6 +8,9 @@ exports.INTERMEDIATE_STEPS_KEY = "intermediate_steps";
|
|
|
8
8
|
exports.DEFAULT_DOCUMENT_PROMPT =
|
|
9
9
|
/* #__PURE__ */ prompts_1.PromptTemplate.fromTemplate("{page_content}");
|
|
10
10
|
async function formatDocuments({ documentPrompt, documentSeparator, documents, config, }) {
|
|
11
|
+
if (documents == null || documents.length === 0) {
|
|
12
|
+
return "";
|
|
13
|
+
}
|
|
11
14
|
const formattedDocs = await Promise.all(documents.map((document) => documentPrompt
|
|
12
15
|
.withConfig({ runName: "document_formatter" })
|
|
13
16
|
.invoke({ ...document.metadata, page_content: document.pageContent }, config)));
|
|
@@ -5,6 +5,9 @@ export const INTERMEDIATE_STEPS_KEY = "intermediate_steps";
|
|
|
5
5
|
export const DEFAULT_DOCUMENT_PROMPT =
|
|
6
6
|
/* #__PURE__ */ PromptTemplate.fromTemplate("{page_content}");
|
|
7
7
|
export async function formatDocuments({ documentPrompt, documentSeparator, documents, config, }) {
|
|
8
|
+
if (documents == null || documents.length === 0) {
|
|
9
|
+
return "";
|
|
10
|
+
}
|
|
8
11
|
const formattedDocs = await Promise.all(documents.map((document) => documentPrompt
|
|
9
12
|
.withConfig({ runName: "document_formatter" })
|
|
10
13
|
.invoke({ ...document.metadata, page_content: document.pageContent }, config)));
|
|
@@ -75,7 +75,8 @@ class QueryTransformer {
|
|
|
75
75
|
}
|
|
76
76
|
if (funcName in ir_js_1.Comparators) {
|
|
77
77
|
if (node.args && node.args.length === 2) {
|
|
78
|
-
|
|
78
|
+
const [attribute, value] = node.args;
|
|
79
|
+
return new ir_js_1.Comparison(funcName, traverse(attribute), traverse(value));
|
|
79
80
|
}
|
|
80
81
|
throw new Error("Comparator must have exactly 2 arguments");
|
|
81
82
|
}
|
|
@@ -72,7 +72,8 @@ export class QueryTransformer {
|
|
|
72
72
|
}
|
|
73
73
|
if (funcName in Comparators) {
|
|
74
74
|
if (node.args && node.args.length === 2) {
|
|
75
|
-
|
|
75
|
+
const [attribute, value] = node.args;
|
|
76
|
+
return new Comparison(funcName, traverse(attribute), traverse(value));
|
|
76
77
|
}
|
|
77
78
|
throw new Error("Comparator must have exactly 2 arguments");
|
|
78
79
|
}
|
|
@@ -64,6 +64,10 @@ params = {}) {
|
|
|
64
64
|
const { ChatGroq } = await import("@langchain/groq");
|
|
65
65
|
return new ChatGroq({ model, ...passedParams });
|
|
66
66
|
}
|
|
67
|
+
case "cerebras": {
|
|
68
|
+
const { ChatCerebras } = await import("@langchain/cerebras");
|
|
69
|
+
return new ChatCerebras({ model, ...passedParams });
|
|
70
|
+
}
|
|
67
71
|
case "bedrock": {
|
|
68
72
|
const { ChatBedrockConverse } = await import("@langchain/aws");
|
|
69
73
|
return new ChatBedrockConverse({ model, ...passedParams });
|
|
@@ -382,6 +386,7 @@ class _ConfigurableModel extends chat_models_1.BaseChatModel {
|
|
|
382
386
|
* - mistralai (@langchain/mistralai)
|
|
383
387
|
* - groq (@langchain/groq)
|
|
384
388
|
* - ollama (@langchain/ollama)
|
|
389
|
+
* - cerebras (@langchain/cerebras)
|
|
385
390
|
* @param {string[] | "any"} [fields.configurableFields] - Which model parameters are configurable:
|
|
386
391
|
* - undefined: No configurable fields.
|
|
387
392
|
* - "any": All fields are configurable. (See Security Note in description)
|
|
@@ -61,6 +61,10 @@ params = {}) {
|
|
|
61
61
|
const { ChatGroq } = await import("@langchain/groq");
|
|
62
62
|
return new ChatGroq({ model, ...passedParams });
|
|
63
63
|
}
|
|
64
|
+
case "cerebras": {
|
|
65
|
+
const { ChatCerebras } = await import("@langchain/cerebras");
|
|
66
|
+
return new ChatCerebras({ model, ...passedParams });
|
|
67
|
+
}
|
|
64
68
|
case "bedrock": {
|
|
65
69
|
const { ChatBedrockConverse } = await import("@langchain/aws");
|
|
66
70
|
return new ChatBedrockConverse({ model, ...passedParams });
|
|
@@ -378,6 +382,7 @@ class _ConfigurableModel extends BaseChatModel {
|
|
|
378
382
|
* - mistralai (@langchain/mistralai)
|
|
379
383
|
* - groq (@langchain/groq)
|
|
380
384
|
* - ollama (@langchain/ollama)
|
|
385
|
+
* - cerebras (@langchain/cerebras)
|
|
381
386
|
* @param {string[] | "any"} [fields.configurableFields] - Which model parameters are configurable:
|
|
382
387
|
* - undefined: No configurable fields.
|
|
383
388
|
* - "any": All fields are configurable. (See Security Note in description)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langchain",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
4
4
|
"description": "Typescript bindings for langchain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -413,6 +413,7 @@
|
|
|
413
413
|
"@jest/globals": "^29.5.0",
|
|
414
414
|
"@langchain/anthropic": "*",
|
|
415
415
|
"@langchain/aws": "*",
|
|
416
|
+
"@langchain/cerebras": "*",
|
|
416
417
|
"@langchain/cohere": "*",
|
|
417
418
|
"@langchain/core": "workspace:*",
|
|
418
419
|
"@langchain/google-genai": "*",
|
|
@@ -460,6 +461,7 @@
|
|
|
460
461
|
"peerDependencies": {
|
|
461
462
|
"@langchain/anthropic": "*",
|
|
462
463
|
"@langchain/aws": "*",
|
|
464
|
+
"@langchain/cerebras": "*",
|
|
463
465
|
"@langchain/cohere": "*",
|
|
464
466
|
"@langchain/core": ">=0.2.21 <0.4.0",
|
|
465
467
|
"@langchain/google-genai": "*",
|
|
@@ -480,6 +482,9 @@
|
|
|
480
482
|
"@langchain/aws": {
|
|
481
483
|
"optional": true
|
|
482
484
|
},
|
|
485
|
+
"@langchain/cerebras": {
|
|
486
|
+
"optional": true
|
|
487
|
+
},
|
|
483
488
|
"@langchain/cohere": {
|
|
484
489
|
"optional": true
|
|
485
490
|
},
|