langchain 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -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)));
|