langchain 0.1.10 → 0.1.11
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/history_aware_retriever.d.ts +2 -2
- package/dist/chains/retrieval.d.ts +2 -2
- package/dist/document_loaders/web/confluence.cjs +13 -2
- package/dist/document_loaders/web/confluence.d.ts +7 -1
- package/dist/document_loaders/web/confluence.js +13 -2
- package/dist/util/entrypoint_deprecation.cjs +4 -1
- package/dist/util/entrypoint_deprecation.js +4 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LanguageModelLike } from "@langchain/core/language_models/base";
|
|
2
|
-
import { type RunnableInterface } from "@langchain/core/runnables";
|
|
2
|
+
import { type Runnable, type RunnableInterface } from "@langchain/core/runnables";
|
|
3
3
|
import { type BasePromptTemplate } from "@langchain/core/prompts";
|
|
4
4
|
import type { DocumentInterface } from "@langchain/core/documents";
|
|
5
5
|
import type { BaseMessage } from "@langchain/core/messages";
|
|
@@ -49,7 +49,7 @@ export type CreateHistoryAwareRetrieverParams = {
|
|
|
49
49
|
* const result = await chain.invoke({"input": "...", "chat_history": [] })
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
|
-
export declare function createHistoryAwareRetriever({ llm, retriever, rephrasePrompt, }: CreateHistoryAwareRetrieverParams): Promise<
|
|
52
|
+
export declare function createHistoryAwareRetriever({ llm, retriever, rephrasePrompt, }: CreateHistoryAwareRetrieverParams): Promise<Runnable<{
|
|
53
53
|
input: string;
|
|
54
54
|
chat_history: string | BaseMessage[];
|
|
55
55
|
}, DocumentInterface[]>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseRetrieverInterface } from "@langchain/core/retrievers";
|
|
2
|
-
import { type RunnableInterface } from "@langchain/core/runnables";
|
|
2
|
+
import { type Runnable, type RunnableInterface } from "@langchain/core/runnables";
|
|
3
3
|
import type { BaseMessage } from "@langchain/core/messages";
|
|
4
4
|
import type { DocumentInterface } from "@langchain/core/documents";
|
|
5
5
|
/**
|
|
@@ -52,7 +52,7 @@ export type CreateRetrievalChainParams<RunOutput> = {
|
|
|
52
52
|
* const response = await chain.invoke({ input: "..." });
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
|
-
export declare function createRetrievalChain<RunOutput>({ retriever, combineDocsChain, }: CreateRetrievalChainParams<RunOutput>): Promise<
|
|
55
|
+
export declare function createRetrievalChain<RunOutput>({ retriever, combineDocsChain, }: CreateRetrievalChainParams<RunOutput>): Promise<Runnable<{
|
|
56
56
|
input: string;
|
|
57
57
|
chat_history?: BaseMessage[] | string;
|
|
58
58
|
} & {
|
|
@@ -19,7 +19,7 @@ const base_js_1 = require("../base.cjs");
|
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
21
|
class ConfluencePagesLoader extends base_js_1.BaseDocumentLoader {
|
|
22
|
-
constructor({ baseUrl, spaceKey, username, accessToken, limit = 25, personalAccessToken, }) {
|
|
22
|
+
constructor({ baseUrl, spaceKey, username, accessToken, limit = 25, expand = "body.storage", personalAccessToken, }) {
|
|
23
23
|
super();
|
|
24
24
|
Object.defineProperty(this, "baseUrl", {
|
|
25
25
|
enumerable: true,
|
|
@@ -51,6 +51,16 @@ class ConfluencePagesLoader extends base_js_1.BaseDocumentLoader {
|
|
|
51
51
|
writable: true,
|
|
52
52
|
value: void 0
|
|
53
53
|
});
|
|
54
|
+
/**
|
|
55
|
+
* expand parameter for confluence rest api
|
|
56
|
+
* description can be found at https://developer.atlassian.com/server/confluence/expansions-in-the-rest-api/
|
|
57
|
+
*/
|
|
58
|
+
Object.defineProperty(this, "expand", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
configurable: true,
|
|
61
|
+
writable: true,
|
|
62
|
+
value: void 0
|
|
63
|
+
});
|
|
54
64
|
Object.defineProperty(this, "personalAccessToken", {
|
|
55
65
|
enumerable: true,
|
|
56
66
|
configurable: true,
|
|
@@ -62,6 +72,7 @@ class ConfluencePagesLoader extends base_js_1.BaseDocumentLoader {
|
|
|
62
72
|
this.username = username;
|
|
63
73
|
this.accessToken = accessToken;
|
|
64
74
|
this.limit = limit;
|
|
75
|
+
this.expand = expand;
|
|
65
76
|
this.personalAccessToken = personalAccessToken;
|
|
66
77
|
}
|
|
67
78
|
/**
|
|
@@ -126,7 +137,7 @@ class ConfluencePagesLoader extends base_js_1.BaseDocumentLoader {
|
|
|
126
137
|
* @returns Promise resolving to an array of ConfluencePage objects.
|
|
127
138
|
*/
|
|
128
139
|
async fetchAllPagesInSpace(start = 0) {
|
|
129
|
-
const url = `${this.baseUrl}/rest/api/content?spaceKey=${this.spaceKey}&limit=${this.limit}&start=${start}&expand
|
|
140
|
+
const url = `${this.baseUrl}/rest/api/content?spaceKey=${this.spaceKey}&limit=${this.limit}&start=${start}&expand=${this.expand}`;
|
|
130
141
|
const data = await this.fetchConfluenceData(url);
|
|
131
142
|
if (data.size === 0) {
|
|
132
143
|
return [];
|
|
@@ -11,6 +11,7 @@ export interface ConfluencePagesLoaderParams {
|
|
|
11
11
|
accessToken?: string;
|
|
12
12
|
personalAccessToken?: string;
|
|
13
13
|
limit?: number;
|
|
14
|
+
expand?: string;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* Interface representing a Confluence page.
|
|
@@ -51,8 +52,13 @@ export declare class ConfluencePagesLoader extends BaseDocumentLoader {
|
|
|
51
52
|
readonly username?: string;
|
|
52
53
|
readonly accessToken?: string;
|
|
53
54
|
readonly limit: number;
|
|
55
|
+
/**
|
|
56
|
+
* expand parameter for confluence rest api
|
|
57
|
+
* description can be found at https://developer.atlassian.com/server/confluence/expansions-in-the-rest-api/
|
|
58
|
+
*/
|
|
59
|
+
readonly expand?: string;
|
|
54
60
|
readonly personalAccessToken?: string;
|
|
55
|
-
constructor({ baseUrl, spaceKey, username, accessToken, limit, personalAccessToken, }: ConfluencePagesLoaderParams);
|
|
61
|
+
constructor({ baseUrl, spaceKey, username, accessToken, limit, expand, personalAccessToken, }: ConfluencePagesLoaderParams);
|
|
56
62
|
/**
|
|
57
63
|
* Returns the authorization header for the request.
|
|
58
64
|
* @returns The authorization header as a string, or undefined if no credentials were provided.
|
|
@@ -16,7 +16,7 @@ import { BaseDocumentLoader } from "../base.js";
|
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
18
|
export class ConfluencePagesLoader extends BaseDocumentLoader {
|
|
19
|
-
constructor({ baseUrl, spaceKey, username, accessToken, limit = 25, personalAccessToken, }) {
|
|
19
|
+
constructor({ baseUrl, spaceKey, username, accessToken, limit = 25, expand = "body.storage", personalAccessToken, }) {
|
|
20
20
|
super();
|
|
21
21
|
Object.defineProperty(this, "baseUrl", {
|
|
22
22
|
enumerable: true,
|
|
@@ -48,6 +48,16 @@ export class ConfluencePagesLoader extends BaseDocumentLoader {
|
|
|
48
48
|
writable: true,
|
|
49
49
|
value: void 0
|
|
50
50
|
});
|
|
51
|
+
/**
|
|
52
|
+
* expand parameter for confluence rest api
|
|
53
|
+
* description can be found at https://developer.atlassian.com/server/confluence/expansions-in-the-rest-api/
|
|
54
|
+
*/
|
|
55
|
+
Object.defineProperty(this, "expand", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
writable: true,
|
|
59
|
+
value: void 0
|
|
60
|
+
});
|
|
51
61
|
Object.defineProperty(this, "personalAccessToken", {
|
|
52
62
|
enumerable: true,
|
|
53
63
|
configurable: true,
|
|
@@ -59,6 +69,7 @@ export class ConfluencePagesLoader extends BaseDocumentLoader {
|
|
|
59
69
|
this.username = username;
|
|
60
70
|
this.accessToken = accessToken;
|
|
61
71
|
this.limit = limit;
|
|
72
|
+
this.expand = expand;
|
|
62
73
|
this.personalAccessToken = personalAccessToken;
|
|
63
74
|
}
|
|
64
75
|
/**
|
|
@@ -123,7 +134,7 @@ export class ConfluencePagesLoader extends BaseDocumentLoader {
|
|
|
123
134
|
* @returns Promise resolving to an array of ConfluencePage objects.
|
|
124
135
|
*/
|
|
125
136
|
async fetchAllPagesInSpace(start = 0) {
|
|
126
|
-
const url = `${this.baseUrl}/rest/api/content?spaceKey=${this.spaceKey}&limit=${this.limit}&start=${start}&expand
|
|
137
|
+
const url = `${this.baseUrl}/rest/api/content?spaceKey=${this.spaceKey}&limit=${this.limit}&start=${start}&expand=${this.expand}`;
|
|
127
138
|
const data = await this.fetchConfluenceData(url);
|
|
128
139
|
if (data.size === 0) {
|
|
129
140
|
return [];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.logVersion010MigrationWarning = void 0;
|
|
4
|
+
const env_js_1 = require("./env.cjs");
|
|
4
5
|
function logVersion010MigrationWarning({ oldEntrypointName, newEntrypointName, newPackageName = "@langchain/community", }) {
|
|
5
6
|
let finalEntrypointName = "";
|
|
6
7
|
if (newEntrypointName === undefined) {
|
|
@@ -29,6 +30,8 @@ function logVersion010MigrationWarning({ oldEntrypointName, newEntrypointName, n
|
|
|
29
30
|
`This will be mandatory after the next "langchain" minor version bump to 0.2.`,
|
|
30
31
|
].join("\n");
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
+
if ((0, env_js_1.getEnvironmentVariable)("LANGCHAIN_SUPPRESS_MIGRATION_WARNINGS") !== "true") {
|
|
34
|
+
console.warn(warningText);
|
|
35
|
+
}
|
|
33
36
|
}
|
|
34
37
|
exports.logVersion010MigrationWarning = logVersion010MigrationWarning;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getEnvironmentVariable } from "./env.js";
|
|
1
2
|
export function logVersion010MigrationWarning({ oldEntrypointName, newEntrypointName, newPackageName = "@langchain/community", }) {
|
|
2
3
|
let finalEntrypointName = "";
|
|
3
4
|
if (newEntrypointName === undefined) {
|
|
@@ -26,5 +27,7 @@ export function logVersion010MigrationWarning({ oldEntrypointName, newEntrypoint
|
|
|
26
27
|
`This will be mandatory after the next "langchain" minor version bump to 0.2.`,
|
|
27
28
|
].join("\n");
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
+
if (getEnvironmentVariable("LANGCHAIN_SUPPRESS_MIGRATION_WARNINGS") !== "true") {
|
|
31
|
+
console.warn(warningText);
|
|
32
|
+
}
|
|
30
33
|
}
|