langchain 0.0.174 → 0.0.175

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.
@@ -41,6 +41,7 @@ exports.optionalImportEntrypoints = [
41
41
  "langchain/prompts/load",
42
42
  "langchain/vectorstores/analyticdb",
43
43
  "langchain/vectorstores/cassandra",
44
+ "langchain/vectorstores/convex",
44
45
  "langchain/vectorstores/elasticsearch",
45
46
  "langchain/vectorstores/cloudflare_vectorize",
46
47
  "langchain/vectorstores/closevector/web",
@@ -133,6 +134,7 @@ exports.optionalImportEntrypoints = [
133
134
  "langchain/cache/upstash_redis",
134
135
  "langchain/stores/doc/gcs",
135
136
  "langchain/stores/file/node",
137
+ "langchain/stores/message/convex",
136
138
  "langchain/stores/message/cloudflare_d1",
137
139
  "langchain/stores/message/dynamodb",
138
140
  "langchain/stores/message/firestore",
@@ -143,12 +145,14 @@ exports.optionalImportEntrypoints = [
143
145
  "langchain/stores/message/upstash_redis",
144
146
  "langchain/stores/message/planetscale",
145
147
  "langchain/stores/message/xata",
148
+ "langchain/storage/convex",
146
149
  "langchain/storage/ioredis",
147
150
  "langchain/storage/vercel_kv",
148
151
  "langchain/storage/upstash_redis",
149
152
  "langchain/storage/file_system",
150
153
  "langchain/graphs/neo4j_graph",
151
154
  "langchain/hub",
155
+ "langchain/util/convex",
152
156
  "langchain/experimental/multimodal_embeddings/googlevertexai",
153
157
  "langchain/experimental/chat_models/anthropic_functions",
154
158
  "langchain/experimental/llms/bittensor",
@@ -38,6 +38,7 @@ export const optionalImportEntrypoints = [
38
38
  "langchain/prompts/load",
39
39
  "langchain/vectorstores/analyticdb",
40
40
  "langchain/vectorstores/cassandra",
41
+ "langchain/vectorstores/convex",
41
42
  "langchain/vectorstores/elasticsearch",
42
43
  "langchain/vectorstores/cloudflare_vectorize",
43
44
  "langchain/vectorstores/closevector/web",
@@ -130,6 +131,7 @@ export const optionalImportEntrypoints = [
130
131
  "langchain/cache/upstash_redis",
131
132
  "langchain/stores/doc/gcs",
132
133
  "langchain/stores/file/node",
134
+ "langchain/stores/message/convex",
133
135
  "langchain/stores/message/cloudflare_d1",
134
136
  "langchain/stores/message/dynamodb",
135
137
  "langchain/stores/message/firestore",
@@ -140,12 +142,14 @@ export const optionalImportEntrypoints = [
140
142
  "langchain/stores/message/upstash_redis",
141
143
  "langchain/stores/message/planetscale",
142
144
  "langchain/stores/message/xata",
145
+ "langchain/storage/convex",
143
146
  "langchain/storage/ioredis",
144
147
  "langchain/storage/vercel_kv",
145
148
  "langchain/storage/upstash_redis",
146
149
  "langchain/storage/file_system",
147
150
  "langchain/graphs/neo4j_graph",
148
151
  "langchain/hub",
152
+ "langchain/util/convex",
149
153
  "langchain/experimental/multimodal_embeddings/googlevertexai",
150
154
  "langchain/experimental/chat_models/anthropic_functions",
151
155
  "langchain/experimental/llms/bittensor",
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConvexKVStore = void 0;
4
+ // eslint-disable-next-line import/no-extraneous-dependencies
5
+ const server_1 = require("convex/server");
6
+ const storage_js_1 = require("../schema/storage.cjs");
7
+ /**
8
+ * Class that extends the BaseStore class to interact with a Convex
9
+ * database. It provides methods for getting, setting, and deleting key value pairs,
10
+ * as well as yielding keys from the database.
11
+ */
12
+ class ConvexKVStore extends storage_js_1.BaseStore {
13
+ constructor(config) {
14
+ super(config);
15
+ Object.defineProperty(this, "lc_namespace", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: ["langchain", "storage", "convex"]
20
+ });
21
+ Object.defineProperty(this, "ctx", {
22
+ enumerable: true,
23
+ configurable: true,
24
+ writable: true,
25
+ value: void 0
26
+ });
27
+ Object.defineProperty(this, "table", {
28
+ enumerable: true,
29
+ configurable: true,
30
+ writable: true,
31
+ value: void 0
32
+ });
33
+ Object.defineProperty(this, "index", {
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true,
37
+ value: void 0
38
+ });
39
+ Object.defineProperty(this, "keyField", {
40
+ enumerable: true,
41
+ configurable: true,
42
+ writable: true,
43
+ value: void 0
44
+ });
45
+ Object.defineProperty(this, "valueField", {
46
+ enumerable: true,
47
+ configurable: true,
48
+ writable: true,
49
+ value: void 0
50
+ });
51
+ Object.defineProperty(this, "upsert", {
52
+ enumerable: true,
53
+ configurable: true,
54
+ writable: true,
55
+ value: void 0
56
+ });
57
+ Object.defineProperty(this, "lookup", {
58
+ enumerable: true,
59
+ configurable: true,
60
+ writable: true,
61
+ value: void 0
62
+ });
63
+ Object.defineProperty(this, "deleteMany", {
64
+ enumerable: true,
65
+ configurable: true,
66
+ writable: true,
67
+ value: void 0
68
+ });
69
+ this.ctx = config.ctx;
70
+ this.table = config.table ?? "cache";
71
+ this.index = config.index ?? "byKey";
72
+ this.keyField = config.keyField ?? "key";
73
+ this.valueField = config.valueField ?? "value";
74
+ this.upsert =
75
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
+ config.upsert ?? (0, server_1.makeFunctionReference)("langchain/db:upsert");
77
+ this.lookup =
78
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
79
+ config.lookup ?? (0, server_1.makeFunctionReference)("langchain/db:lookup");
80
+ this.deleteMany =
81
+ config.deleteMany ??
82
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
83
+ (0, server_1.makeFunctionReference)("langchain/db:deleteMany");
84
+ }
85
+ /**
86
+ * Gets multiple keys from the Convex database.
87
+ * @param keys Array of keys to be retrieved.
88
+ * @returns An array of retrieved values.
89
+ */
90
+ async mget(keys) {
91
+ return (await Promise.all(keys.map(async (key) => {
92
+ const found = (await this.ctx.runQuery(this.lookup, {
93
+ table: this.table,
94
+ index: this.index,
95
+ keyField: this.keyField,
96
+ key,
97
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
98
+ }));
99
+ return found.length > 0 ? found[0][this.valueField] : undefined;
100
+ })));
101
+ }
102
+ /**
103
+ * Sets multiple keys in the Convex database.
104
+ * @param keyValuePairs Array of key-value pairs to be set.
105
+ * @returns Promise that resolves when all keys have been set.
106
+ */
107
+ async mset(keyValuePairs) {
108
+ // TODO: Remove chunking when Convex handles the concurrent requests correctly
109
+ const PAGE_SIZE = 16;
110
+ for (let i = 0; i < keyValuePairs.length; i += PAGE_SIZE) {
111
+ await Promise.all(keyValuePairs.slice(i, i + PAGE_SIZE).map(([key, value]) => this.ctx.runMutation(this.upsert, {
112
+ table: this.table,
113
+ index: this.index,
114
+ keyField: this.keyField,
115
+ key,
116
+ document: { [this.keyField]: key, [this.valueField]: value },
117
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
118
+ })));
119
+ }
120
+ }
121
+ /**
122
+ * Deletes multiple keys from the Convex database.
123
+ * @param keys Array of keys to be deleted.
124
+ * @returns Promise that resolves when all keys have been deleted.
125
+ */
126
+ async mdelete(keys) {
127
+ await Promise.all(keys.map((key) => this.ctx.runMutation(this.deleteMany, {
128
+ table: this.table,
129
+ index: this.index,
130
+ keyField: this.keyField,
131
+ key,
132
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
133
+ })));
134
+ }
135
+ /**
136
+ * Yields keys from the Convex database.
137
+ * @param prefix Optional prefix to filter the keys.
138
+ * @returns An AsyncGenerator that yields keys from the Convex database.
139
+ */
140
+ // eslint-disable-next-line require-yield
141
+ async *yieldKeys(_prefix) {
142
+ throw new Error("yieldKeys not implemented yet for ConvexKVStore");
143
+ }
144
+ }
145
+ exports.ConvexKVStore = ConvexKVStore;
@@ -0,0 +1,85 @@
1
+ import { FieldPaths, FunctionReference, GenericActionCtx, GenericDataModel, NamedTableInfo, TableNamesInDataModel, VectorIndexNames } from "convex/server";
2
+ import { Value } from "convex/values";
3
+ import { BaseStore } from "../schema/storage.js";
4
+ /**
5
+ * Type that defines the config required to initialize the
6
+ * ConvexKVStore class. It includes the table name,
7
+ * index name, field name.
8
+ */
9
+ export type ConvexKVStoreConfig<DataModel extends GenericDataModel, TableName extends TableNamesInDataModel<DataModel>, IndexName extends VectorIndexNames<NamedTableInfo<DataModel, TableName>>, KeyFieldName extends FieldPaths<NamedTableInfo<DataModel, TableName>>, ValueFieldName extends FieldPaths<NamedTableInfo<DataModel, TableName>>, UpsertMutation extends FunctionReference<"mutation", "internal", {
10
+ table: string;
11
+ document: object;
12
+ }>, LookupQuery extends FunctionReference<"query", "internal", {
13
+ table: string;
14
+ index: string;
15
+ keyField: string;
16
+ key: string;
17
+ }, object[]>, DeleteManyMutation extends FunctionReference<"mutation", "internal", {
18
+ table: string;
19
+ index: string;
20
+ keyField: string;
21
+ key: string;
22
+ }>> = {
23
+ readonly ctx: GenericActionCtx<DataModel>;
24
+ readonly table?: TableName;
25
+ readonly index?: IndexName;
26
+ readonly keyField?: KeyFieldName;
27
+ readonly valueField?: ValueFieldName;
28
+ readonly upsert?: UpsertMutation;
29
+ readonly lookup?: LookupQuery;
30
+ readonly deleteMany?: DeleteManyMutation;
31
+ };
32
+ /**
33
+ * Class that extends the BaseStore class to interact with a Convex
34
+ * database. It provides methods for getting, setting, and deleting key value pairs,
35
+ * as well as yielding keys from the database.
36
+ */
37
+ export declare class ConvexKVStore<T extends Value, DataModel extends GenericDataModel, TableName extends TableNamesInDataModel<DataModel>, IndexName extends VectorIndexNames<NamedTableInfo<DataModel, TableName>>, KeyFieldName extends FieldPaths<NamedTableInfo<DataModel, TableName>>, ValueFieldName extends FieldPaths<NamedTableInfo<DataModel, TableName>>, UpsertMutation extends FunctionReference<"mutation", "internal", {
38
+ table: string;
39
+ document: object;
40
+ }>, LookupQuery extends FunctionReference<"query", "internal", {
41
+ table: string;
42
+ index: string;
43
+ keyField: string;
44
+ key: string;
45
+ }, object[]>, DeleteManyMutation extends FunctionReference<"mutation", "internal", {
46
+ table: string;
47
+ index: string;
48
+ keyField: string;
49
+ key: string;
50
+ }>> extends BaseStore<string, T> {
51
+ lc_namespace: string[];
52
+ private readonly ctx;
53
+ private readonly table;
54
+ private readonly index;
55
+ private readonly keyField;
56
+ private readonly valueField;
57
+ private readonly upsert;
58
+ private readonly lookup;
59
+ private readonly deleteMany;
60
+ constructor(config: ConvexKVStoreConfig<DataModel, TableName, IndexName, KeyFieldName, ValueFieldName, UpsertMutation, LookupQuery, DeleteManyMutation>);
61
+ /**
62
+ * Gets multiple keys from the Convex database.
63
+ * @param keys Array of keys to be retrieved.
64
+ * @returns An array of retrieved values.
65
+ */
66
+ mget(keys: string[]): Promise<(T | undefined)[]>;
67
+ /**
68
+ * Sets multiple keys in the Convex database.
69
+ * @param keyValuePairs Array of key-value pairs to be set.
70
+ * @returns Promise that resolves when all keys have been set.
71
+ */
72
+ mset(keyValuePairs: [string, T][]): Promise<void>;
73
+ /**
74
+ * Deletes multiple keys from the Convex database.
75
+ * @param keys Array of keys to be deleted.
76
+ * @returns Promise that resolves when all keys have been deleted.
77
+ */
78
+ mdelete(keys: string[]): Promise<void>;
79
+ /**
80
+ * Yields keys from the Convex database.
81
+ * @param prefix Optional prefix to filter the keys.
82
+ * @returns An AsyncGenerator that yields keys from the Convex database.
83
+ */
84
+ yieldKeys(_prefix?: string): AsyncGenerator<string>;
85
+ }
@@ -0,0 +1,141 @@
1
+ // eslint-disable-next-line import/no-extraneous-dependencies
2
+ import { makeFunctionReference, } from "convex/server";
3
+ import { BaseStore } from "../schema/storage.js";
4
+ /**
5
+ * Class that extends the BaseStore class to interact with a Convex
6
+ * database. It provides methods for getting, setting, and deleting key value pairs,
7
+ * as well as yielding keys from the database.
8
+ */
9
+ export class ConvexKVStore extends BaseStore {
10
+ constructor(config) {
11
+ super(config);
12
+ Object.defineProperty(this, "lc_namespace", {
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true,
16
+ value: ["langchain", "storage", "convex"]
17
+ });
18
+ Object.defineProperty(this, "ctx", {
19
+ enumerable: true,
20
+ configurable: true,
21
+ writable: true,
22
+ value: void 0
23
+ });
24
+ Object.defineProperty(this, "table", {
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true,
28
+ value: void 0
29
+ });
30
+ Object.defineProperty(this, "index", {
31
+ enumerable: true,
32
+ configurable: true,
33
+ writable: true,
34
+ value: void 0
35
+ });
36
+ Object.defineProperty(this, "keyField", {
37
+ enumerable: true,
38
+ configurable: true,
39
+ writable: true,
40
+ value: void 0
41
+ });
42
+ Object.defineProperty(this, "valueField", {
43
+ enumerable: true,
44
+ configurable: true,
45
+ writable: true,
46
+ value: void 0
47
+ });
48
+ Object.defineProperty(this, "upsert", {
49
+ enumerable: true,
50
+ configurable: true,
51
+ writable: true,
52
+ value: void 0
53
+ });
54
+ Object.defineProperty(this, "lookup", {
55
+ enumerable: true,
56
+ configurable: true,
57
+ writable: true,
58
+ value: void 0
59
+ });
60
+ Object.defineProperty(this, "deleteMany", {
61
+ enumerable: true,
62
+ configurable: true,
63
+ writable: true,
64
+ value: void 0
65
+ });
66
+ this.ctx = config.ctx;
67
+ this.table = config.table ?? "cache";
68
+ this.index = config.index ?? "byKey";
69
+ this.keyField = config.keyField ?? "key";
70
+ this.valueField = config.valueField ?? "value";
71
+ this.upsert =
72
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
73
+ config.upsert ?? makeFunctionReference("langchain/db:upsert");
74
+ this.lookup =
75
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
+ config.lookup ?? makeFunctionReference("langchain/db:lookup");
77
+ this.deleteMany =
78
+ config.deleteMany ??
79
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
80
+ makeFunctionReference("langchain/db:deleteMany");
81
+ }
82
+ /**
83
+ * Gets multiple keys from the Convex database.
84
+ * @param keys Array of keys to be retrieved.
85
+ * @returns An array of retrieved values.
86
+ */
87
+ async mget(keys) {
88
+ return (await Promise.all(keys.map(async (key) => {
89
+ const found = (await this.ctx.runQuery(this.lookup, {
90
+ table: this.table,
91
+ index: this.index,
92
+ keyField: this.keyField,
93
+ key,
94
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
95
+ }));
96
+ return found.length > 0 ? found[0][this.valueField] : undefined;
97
+ })));
98
+ }
99
+ /**
100
+ * Sets multiple keys in the Convex database.
101
+ * @param keyValuePairs Array of key-value pairs to be set.
102
+ * @returns Promise that resolves when all keys have been set.
103
+ */
104
+ async mset(keyValuePairs) {
105
+ // TODO: Remove chunking when Convex handles the concurrent requests correctly
106
+ const PAGE_SIZE = 16;
107
+ for (let i = 0; i < keyValuePairs.length; i += PAGE_SIZE) {
108
+ await Promise.all(keyValuePairs.slice(i, i + PAGE_SIZE).map(([key, value]) => this.ctx.runMutation(this.upsert, {
109
+ table: this.table,
110
+ index: this.index,
111
+ keyField: this.keyField,
112
+ key,
113
+ document: { [this.keyField]: key, [this.valueField]: value },
114
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
115
+ })));
116
+ }
117
+ }
118
+ /**
119
+ * Deletes multiple keys from the Convex database.
120
+ * @param keys Array of keys to be deleted.
121
+ * @returns Promise that resolves when all keys have been deleted.
122
+ */
123
+ async mdelete(keys) {
124
+ await Promise.all(keys.map((key) => this.ctx.runMutation(this.deleteMany, {
125
+ table: this.table,
126
+ index: this.index,
127
+ keyField: this.keyField,
128
+ key,
129
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
130
+ })));
131
+ }
132
+ /**
133
+ * Yields keys from the Convex database.
134
+ * @param prefix Optional prefix to filter the keys.
135
+ * @returns An AsyncGenerator that yields keys from the Convex database.
136
+ */
137
+ // eslint-disable-next-line require-yield
138
+ async *yieldKeys(_prefix) {
139
+ throw new Error("yieldKeys not implemented yet for ConvexKVStore");
140
+ }
141
+ }
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ConvexChatMessageHistory = void 0;
5
+ // eslint-disable-next-line import/no-extraneous-dependencies
6
+ const server_1 = require("convex/server");
7
+ const index_js_1 = require("../../schema/index.cjs");
8
+ const utils_js_1 = require("./utils.cjs");
9
+ class ConvexChatMessageHistory extends index_js_1.BaseListChatMessageHistory {
10
+ constructor(config) {
11
+ super();
12
+ Object.defineProperty(this, "lc_namespace", {
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true,
16
+ value: ["langchain", "stores", "message", "convex"]
17
+ });
18
+ Object.defineProperty(this, "ctx", {
19
+ enumerable: true,
20
+ configurable: true,
21
+ writable: true,
22
+ value: void 0
23
+ });
24
+ Object.defineProperty(this, "sessionId", {
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true,
28
+ value: void 0
29
+ });
30
+ Object.defineProperty(this, "table", {
31
+ enumerable: true,
32
+ configurable: true,
33
+ writable: true,
34
+ value: void 0
35
+ });
36
+ Object.defineProperty(this, "index", {
37
+ enumerable: true,
38
+ configurable: true,
39
+ writable: true,
40
+ value: void 0
41
+ });
42
+ Object.defineProperty(this, "sessionIdField", {
43
+ enumerable: true,
44
+ configurable: true,
45
+ writable: true,
46
+ value: void 0
47
+ });
48
+ Object.defineProperty(this, "messageTextFieldName", {
49
+ enumerable: true,
50
+ configurable: true,
51
+ writable: true,
52
+ value: void 0
53
+ });
54
+ Object.defineProperty(this, "insert", {
55
+ enumerable: true,
56
+ configurable: true,
57
+ writable: true,
58
+ value: void 0
59
+ });
60
+ Object.defineProperty(this, "lookup", {
61
+ enumerable: true,
62
+ configurable: true,
63
+ writable: true,
64
+ value: void 0
65
+ });
66
+ Object.defineProperty(this, "deleteMany", {
67
+ enumerable: true,
68
+ configurable: true,
69
+ writable: true,
70
+ value: void 0
71
+ });
72
+ this.ctx = config.ctx;
73
+ this.sessionId = config.sessionId;
74
+ this.table = config.table ?? "messages";
75
+ this.index = config.index ?? "bySessionId";
76
+ this.sessionIdField =
77
+ config.sessionIdField ?? "sessionId";
78
+ this.messageTextFieldName =
79
+ config.messageTextFieldName ?? "message";
80
+ this.insert =
81
+ config.insert ?? (0, server_1.makeFunctionReference)("langchain/db:insert");
82
+ this.lookup =
83
+ config.lookup ?? (0, server_1.makeFunctionReference)("langchain/db:lookup");
84
+ this.deleteMany =
85
+ config.deleteMany ??
86
+ (0, server_1.makeFunctionReference)("langchain/db:deleteMany");
87
+ }
88
+ async getMessages() {
89
+ const convexDocuments = await this.ctx.runQuery(this.lookup, {
90
+ table: this.table,
91
+ index: this.index,
92
+ keyField: this.sessionIdField,
93
+ key: this.sessionId,
94
+ });
95
+ return (0, utils_js_1.mapStoredMessagesToChatMessages)(convexDocuments.map((doc) => doc[this.messageTextFieldName]));
96
+ }
97
+ async addMessage(message) {
98
+ const messages = (0, utils_js_1.mapChatMessagesToStoredMessages)([message]);
99
+ // TODO: Remove chunking when Convex handles the concurrent requests correctly
100
+ const PAGE_SIZE = 16;
101
+ for (let i = 0; i < messages.length; i += PAGE_SIZE) {
102
+ await Promise.all(messages.slice(i, i + PAGE_SIZE).map((message) => this.ctx.runMutation(this.insert, {
103
+ table: this.table,
104
+ document: {
105
+ [this.sessionIdField]: this.sessionId,
106
+ [this.messageTextFieldName]: message,
107
+ },
108
+ })));
109
+ }
110
+ }
111
+ async clear() {
112
+ await this.ctx.runMutation(this.deleteMany, {
113
+ table: this.table,
114
+ index: this.index,
115
+ keyField: this.sessionIdField,
116
+ key: this.sessionId,
117
+ });
118
+ }
119
+ }
120
+ exports.ConvexChatMessageHistory = ConvexChatMessageHistory;
@@ -0,0 +1,60 @@
1
+ import { DocumentByName, FieldPaths, FunctionReference, GenericActionCtx, GenericDataModel, NamedTableInfo, TableNamesInDataModel, VectorIndexNames } from "convex/server";
2
+ import { BaseMessage, BaseListChatMessageHistory } from "../../schema/index.js";
3
+ /**
4
+ * Type that defines the config required to initialize the
5
+ * ConvexChatMessageHistory class. At minimum it needs a sessionId
6
+ * and an ActionCtx.
7
+ */
8
+ export type ConvexChatMessageHistoryInput<DataModel extends GenericDataModel, TableName extends TableNamesInDataModel<DataModel> = "messages", IndexName extends VectorIndexNames<NamedTableInfo<DataModel, TableName>> = "bySessionId", SessionIdFieldName extends FieldPaths<NamedTableInfo<DataModel, TableName>> = "sessionId", MessageTextFieldName extends FieldPaths<NamedTableInfo<DataModel, TableName>> = "message", InsertMutation extends FunctionReference<"mutation", "internal", {
9
+ table: string;
10
+ document: object;
11
+ }> = any, LookupQuery extends FunctionReference<"query", "internal", {
12
+ table: string;
13
+ index: string;
14
+ keyField: string;
15
+ key: string;
16
+ }, object[]> = any, DeleteManyMutation extends FunctionReference<"mutation", "internal", {
17
+ table: string;
18
+ index: string;
19
+ keyField: string;
20
+ key: string;
21
+ }> = any> = {
22
+ readonly ctx: GenericActionCtx<DataModel>;
23
+ readonly sessionId: DocumentByName<DataModel, TableName>[SessionIdFieldName];
24
+ readonly table?: TableName;
25
+ readonly index?: IndexName;
26
+ readonly sessionIdField?: SessionIdFieldName;
27
+ readonly messageTextFieldName?: MessageTextFieldName;
28
+ readonly insert?: InsertMutation;
29
+ readonly lookup?: LookupQuery;
30
+ readonly deleteMany?: DeleteManyMutation;
31
+ };
32
+ export declare class ConvexChatMessageHistory<DataModel extends GenericDataModel, SessionIdFieldName extends FieldPaths<NamedTableInfo<DataModel, TableName>> = "sessionId", TableName extends TableNamesInDataModel<DataModel> = "messages", IndexName extends VectorIndexNames<NamedTableInfo<DataModel, TableName>> = "bySessionId", MessageTextFieldName extends FieldPaths<NamedTableInfo<DataModel, TableName>> = "message", InsertMutation extends FunctionReference<"mutation", "internal", {
33
+ table: string;
34
+ document: object;
35
+ }> = any, LookupQuery extends FunctionReference<"query", "internal", {
36
+ table: string;
37
+ index: string;
38
+ keyField: string;
39
+ key: string;
40
+ }, object[]> = any, DeleteManyMutation extends FunctionReference<"mutation", "internal", {
41
+ table: string;
42
+ index: string;
43
+ keyField: string;
44
+ key: string;
45
+ }> = any> extends BaseListChatMessageHistory {
46
+ lc_namespace: string[];
47
+ private readonly ctx;
48
+ private readonly sessionId;
49
+ private readonly table;
50
+ private readonly index;
51
+ private readonly sessionIdField;
52
+ private readonly messageTextFieldName;
53
+ private readonly insert;
54
+ private readonly lookup;
55
+ private readonly deleteMany;
56
+ constructor(config: ConvexChatMessageHistoryInput<DataModel, TableName, IndexName, SessionIdFieldName, MessageTextFieldName, InsertMutation, LookupQuery, DeleteManyMutation>);
57
+ getMessages(): Promise<BaseMessage[]>;
58
+ addMessage(message: BaseMessage): Promise<void>;
59
+ clear(): Promise<void>;
60
+ }