langchain 0.0.204-rc.0 → 0.0.204-rc.1

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 (55) hide show
  1. package/dist/agents/toolkits/aws_sfn.cjs +3 -75
  2. package/dist/agents/toolkits/aws_sfn.d.ts +2 -45
  3. package/dist/agents/toolkits/aws_sfn.js +2 -73
  4. package/dist/agents/toolkits/base.cjs +15 -9
  5. package/dist/agents/toolkits/base.d.ts +1 -9
  6. package/dist/agents/toolkits/base.js +1 -7
  7. package/dist/agents/toolkits/connery/index.cjs +15 -37
  8. package/dist/agents/toolkits/connery/index.d.ts +1 -23
  9. package/dist/agents/toolkits/connery/index.js +1 -35
  10. package/dist/cache/ioredis.cjs +15 -77
  11. package/dist/cache/ioredis.d.ts +1 -40
  12. package/dist/cache/ioredis.js +1 -75
  13. package/dist/memory/chat_memory.cjs +15 -61
  14. package/dist/memory/chat_memory.d.ts +1 -36
  15. package/dist/memory/chat_memory.js +1 -59
  16. package/dist/memory/motorhead_memory.cjs +15 -161
  17. package/dist/memory/motorhead_memory.d.ts +1 -63
  18. package/dist/memory/motorhead_memory.js +1 -159
  19. package/dist/memory/zep.cjs +15 -222
  20. package/dist/memory/zep.d.ts +1 -86
  21. package/dist/memory/zep.js +1 -220
  22. package/dist/stores/message/in_memory.cjs +15 -49
  23. package/dist/stores/message/in_memory.d.ts +1 -28
  24. package/dist/stores/message/in_memory.js +1 -47
  25. package/dist/tools/aws_lambda.cjs +15 -83
  26. package/dist/tools/aws_lambda.d.ts +1 -25
  27. package/dist/tools/aws_lambda.js +1 -82
  28. package/dist/tools/dynamic.cjs +15 -87
  29. package/dist/tools/dynamic.d.ts +1 -48
  30. package/dist/tools/dynamic.js +1 -84
  31. package/dist/util/convex.cjs +15 -75
  32. package/dist/util/convex.d.ts +1 -26
  33. package/dist/util/convex.js +1 -74
  34. package/dist/vectorstores/memory.cjs +143 -15
  35. package/dist/vectorstores/memory.d.ts +92 -1
  36. package/dist/vectorstores/memory.js +141 -1
  37. package/package.json +2 -241
  38. package/dist/util/chunk.cjs +0 -11
  39. package/dist/util/chunk.d.ts +0 -1
  40. package/dist/util/chunk.js +0 -7
  41. package/dist/util/googlevertexai-gauth.cjs +0 -36
  42. package/dist/util/googlevertexai-gauth.d.ts +0 -8
  43. package/dist/util/googlevertexai-gauth.js +0 -32
  44. package/dist/util/googlevertexai-webauth.cjs +0 -96
  45. package/dist/util/googlevertexai-webauth.d.ts +0 -22
  46. package/dist/util/googlevertexai-webauth.js +0 -92
  47. package/dist/util/iflytek_websocket_stream.cjs +0 -81
  48. package/dist/util/iflytek_websocket_stream.d.ts +0 -27
  49. package/dist/util/iflytek_websocket_stream.js +0 -77
  50. package/dist/util/llama_cpp.cjs +0 -34
  51. package/dist/util/llama_cpp.d.ts +0 -46
  52. package/dist/util/llama_cpp.js +0 -28
  53. package/dist/util/momento.cjs +0 -26
  54. package/dist/util/momento.d.ts +0 -9
  55. package/dist/util/momento.js +0 -22
@@ -1,47 +1 @@
1
- import { BaseListChatMessageHistory } from "../../schema/index.js";
2
- /**
3
- * Class for storing chat message history in-memory. It extends the
4
- * BaseListChatMessageHistory class and provides methods to get, add, and
5
- * clear messages.
6
- */
7
- export class ChatMessageHistory extends BaseListChatMessageHistory {
8
- constructor(messages) {
9
- super(...arguments);
10
- Object.defineProperty(this, "lc_namespace", {
11
- enumerable: true,
12
- configurable: true,
13
- writable: true,
14
- value: ["langchain", "stores", "message", "in_memory"]
15
- });
16
- Object.defineProperty(this, "messages", {
17
- enumerable: true,
18
- configurable: true,
19
- writable: true,
20
- value: []
21
- });
22
- this.messages = messages ?? [];
23
- }
24
- /**
25
- * Method to get all the messages stored in the ChatMessageHistory
26
- * instance.
27
- * @returns Array of stored BaseMessage instances.
28
- */
29
- async getMessages() {
30
- return this.messages;
31
- }
32
- /**
33
- * Method to add a new message to the ChatMessageHistory instance.
34
- * @param message The BaseMessage instance to add.
35
- * @returns A promise that resolves when the message has been added.
36
- */
37
- async addMessage(message) {
38
- this.messages.push(message);
39
- }
40
- /**
41
- * Method to clear all the messages from the ChatMessageHistory instance.
42
- * @returns A promise that resolves when all messages have been cleared.
43
- */
44
- async clear() {
45
- this.messages = [];
46
- }
47
- }
1
+ export * from "@langchain/community/stores/message/in_memory";
@@ -1,85 +1,17 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AWSLambda = void 0;
4
- const dynamic_js_1 = require("./dynamic.cjs");
5
- /**
6
- * Class for invoking AWS Lambda functions within the LangChain framework.
7
- * Extends the DynamicTool class.
8
- */
9
- class AWSLambda extends dynamic_js_1.DynamicTool {
10
- get lc_namespace() {
11
- return [...super.lc_namespace, "aws_lambda"];
12
- }
13
- get lc_secrets() {
14
- return {
15
- accessKeyId: "AWS_ACCESS_KEY_ID",
16
- secretAccessKey: "AWS_SECRET_ACCESS_KEY",
17
- };
18
- }
19
- constructor({ name, description, ...rest }) {
20
- super({
21
- name,
22
- description,
23
- func: async (input) => this._func(input),
24
- });
25
- Object.defineProperty(this, "lambdaConfig", {
26
- enumerable: true,
27
- configurable: true,
28
- writable: true,
29
- value: void 0
30
- });
31
- this.lambdaConfig = rest;
32
- }
33
- /** @ignore */
34
- async _func(input) {
35
- const { Client, Invoker } = await LambdaImports();
36
- const clientConstructorArgs = {};
37
- if (this.lambdaConfig.region) {
38
- clientConstructorArgs.region = this.lambdaConfig.region;
39
- }
40
- if (this.lambdaConfig.accessKeyId && this.lambdaConfig.secretAccessKey) {
41
- clientConstructorArgs.credentials = {
42
- accessKeyId: this.lambdaConfig.accessKeyId,
43
- secretAccessKey: this.lambdaConfig.secretAccessKey,
44
- };
45
- }
46
- const lambdaClient = new Client(clientConstructorArgs);
47
- return new Promise((resolve) => {
48
- const payloadUint8Array = new TextEncoder().encode(JSON.stringify(input));
49
- const command = new Invoker({
50
- FunctionName: this.lambdaConfig.functionName,
51
- InvocationType: "RequestResponse",
52
- Payload: payloadUint8Array,
53
- });
54
- lambdaClient
55
- .send(command)
56
- .then((response) => {
57
- const responseData = JSON.parse(new TextDecoder().decode(response.Payload));
58
- resolve(responseData.body ? responseData.body : "request completed.");
59
- })
60
- .catch((error) => {
61
- console.error("Error invoking Lambda function:", error);
62
- resolve("failed to complete request");
63
- });
64
- });
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
65
7
  }
66
- }
67
- exports.AWSLambda = AWSLambda;
68
- /**
69
- * Helper function that imports the necessary AWS SDK modules for invoking
70
- * the Lambda function. Returns an object that includes the LambdaClient
71
- * and InvokeCommand classes from the AWS SDK.
72
- */
73
- async function LambdaImports() {
74
- try {
75
- const { LambdaClient, InvokeCommand } = await import("@aws-sdk/client-lambda");
76
- return {
77
- Client: LambdaClient,
78
- Invoker: InvokeCommand,
79
- };
80
- }
81
- catch (e) {
82
- console.error(e);
83
- throw new Error("Failed to load @aws-sdk/client-lambda'. Please install it eg. `yarn add @aws-sdk/client-lambda`.");
84
- }
85
- }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("@langchain/community/tools/aws_lambda"), exports);
@@ -1,25 +1 @@
1
- import { DynamicTool, DynamicToolInput } from "./dynamic.js";
2
- /**
3
- * Interface for the configuration of the AWS Lambda function.
4
- */
5
- interface LambdaConfig {
6
- functionName: string;
7
- region?: string;
8
- accessKeyId?: string;
9
- secretAccessKey?: string;
10
- }
11
- /**
12
- * Class for invoking AWS Lambda functions within the LangChain framework.
13
- * Extends the DynamicTool class.
14
- */
15
- declare class AWSLambda extends DynamicTool {
16
- get lc_namespace(): string[];
17
- get lc_secrets(): {
18
- [key: string]: string;
19
- } | undefined;
20
- private lambdaConfig;
21
- constructor({ name, description, ...rest }: LambdaConfig & Omit<DynamicToolInput, "func">);
22
- /** @ignore */
23
- _func(input: string): Promise<string>;
24
- }
25
- export { AWSLambda };
1
+ export * from "@langchain/community/tools/aws_lambda";
@@ -1,82 +1 @@
1
- import { DynamicTool } from "./dynamic.js";
2
- /**
3
- * Class for invoking AWS Lambda functions within the LangChain framework.
4
- * Extends the DynamicTool class.
5
- */
6
- class AWSLambda extends DynamicTool {
7
- get lc_namespace() {
8
- return [...super.lc_namespace, "aws_lambda"];
9
- }
10
- get lc_secrets() {
11
- return {
12
- accessKeyId: "AWS_ACCESS_KEY_ID",
13
- secretAccessKey: "AWS_SECRET_ACCESS_KEY",
14
- };
15
- }
16
- constructor({ name, description, ...rest }) {
17
- super({
18
- name,
19
- description,
20
- func: async (input) => this._func(input),
21
- });
22
- Object.defineProperty(this, "lambdaConfig", {
23
- enumerable: true,
24
- configurable: true,
25
- writable: true,
26
- value: void 0
27
- });
28
- this.lambdaConfig = rest;
29
- }
30
- /** @ignore */
31
- async _func(input) {
32
- const { Client, Invoker } = await LambdaImports();
33
- const clientConstructorArgs = {};
34
- if (this.lambdaConfig.region) {
35
- clientConstructorArgs.region = this.lambdaConfig.region;
36
- }
37
- if (this.lambdaConfig.accessKeyId && this.lambdaConfig.secretAccessKey) {
38
- clientConstructorArgs.credentials = {
39
- accessKeyId: this.lambdaConfig.accessKeyId,
40
- secretAccessKey: this.lambdaConfig.secretAccessKey,
41
- };
42
- }
43
- const lambdaClient = new Client(clientConstructorArgs);
44
- return new Promise((resolve) => {
45
- const payloadUint8Array = new TextEncoder().encode(JSON.stringify(input));
46
- const command = new Invoker({
47
- FunctionName: this.lambdaConfig.functionName,
48
- InvocationType: "RequestResponse",
49
- Payload: payloadUint8Array,
50
- });
51
- lambdaClient
52
- .send(command)
53
- .then((response) => {
54
- const responseData = JSON.parse(new TextDecoder().decode(response.Payload));
55
- resolve(responseData.body ? responseData.body : "request completed.");
56
- })
57
- .catch((error) => {
58
- console.error("Error invoking Lambda function:", error);
59
- resolve("failed to complete request");
60
- });
61
- });
62
- }
63
- }
64
- /**
65
- * Helper function that imports the necessary AWS SDK modules for invoking
66
- * the Lambda function. Returns an object that includes the LambdaClient
67
- * and InvokeCommand classes from the AWS SDK.
68
- */
69
- async function LambdaImports() {
70
- try {
71
- const { LambdaClient, InvokeCommand } = await import("@aws-sdk/client-lambda");
72
- return {
73
- Client: LambdaClient,
74
- Invoker: InvokeCommand,
75
- };
76
- }
77
- catch (e) {
78
- console.error(e);
79
- throw new Error("Failed to load @aws-sdk/client-lambda'. Please install it eg. `yarn add @aws-sdk/client-lambda`.");
80
- }
81
- }
82
- export { AWSLambda };
1
+ export * from "@langchain/community/tools/aws_lambda";
@@ -1,89 +1,17 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DynamicStructuredTool = exports.DynamicTool = void 0;
4
- const base_js_1 = require("./base.cjs");
5
- /**
6
- * A tool that can be created dynamically from a function, name, and description.
7
- */
8
- class DynamicTool extends base_js_1.Tool {
9
- static lc_name() {
10
- return "DynamicTool";
11
- }
12
- constructor(fields) {
13
- super(fields);
14
- Object.defineProperty(this, "name", {
15
- enumerable: true,
16
- configurable: true,
17
- writable: true,
18
- value: void 0
19
- });
20
- Object.defineProperty(this, "description", {
21
- enumerable: true,
22
- configurable: true,
23
- writable: true,
24
- value: void 0
25
- });
26
- Object.defineProperty(this, "func", {
27
- enumerable: true,
28
- configurable: true,
29
- writable: true,
30
- value: void 0
31
- });
32
- this.name = fields.name;
33
- this.description = fields.description;
34
- this.func = fields.func;
35
- this.returnDirect = fields.returnDirect ?? this.returnDirect;
36
- }
37
- /** @ignore */
38
- async _call(input, runManager) {
39
- return this.func(input, runManager);
40
- }
41
- }
42
- exports.DynamicTool = DynamicTool;
43
- /**
44
- * A tool that can be created dynamically from a function, name, and
45
- * description, designed to work with structured data. It extends the
46
- * StructuredTool class and overrides the _call method to execute the
47
- * provided function when the tool is called.
48
- */
49
- class DynamicStructuredTool extends base_js_1.StructuredTool {
50
- static lc_name() {
51
- return "DynamicStructuredTool";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
52
7
  }
53
- constructor(fields) {
54
- super(fields);
55
- Object.defineProperty(this, "name", {
56
- enumerable: true,
57
- configurable: true,
58
- writable: true,
59
- value: void 0
60
- });
61
- Object.defineProperty(this, "description", {
62
- enumerable: true,
63
- configurable: true,
64
- writable: true,
65
- value: void 0
66
- });
67
- Object.defineProperty(this, "func", {
68
- enumerable: true,
69
- configurable: true,
70
- writable: true,
71
- value: void 0
72
- });
73
- Object.defineProperty(this, "schema", {
74
- enumerable: true,
75
- configurable: true,
76
- writable: true,
77
- value: void 0
78
- });
79
- this.name = fields.name;
80
- this.description = fields.description;
81
- this.func = fields.func;
82
- this.returnDirect = fields.returnDirect ?? this.returnDirect;
83
- this.schema = fields.schema;
84
- }
85
- _call(arg, runManager) {
86
- return this.func(arg, runManager);
87
- }
88
- }
89
- exports.DynamicStructuredTool = DynamicStructuredTool;
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("@langchain/community/tools/dynamic"), exports);
@@ -1,48 +1 @@
1
- import { z } from "zod";
2
- import { CallbackManagerForToolRun } from "../callbacks/manager.js";
3
- import { StructuredTool, Tool, ToolParams } from "./base.js";
4
- export interface BaseDynamicToolInput extends ToolParams {
5
- name: string;
6
- description: string;
7
- returnDirect?: boolean;
8
- }
9
- /**
10
- * Interface for the input parameters of the DynamicTool class.
11
- */
12
- export interface DynamicToolInput extends BaseDynamicToolInput {
13
- func: (input: string, runManager?: CallbackManagerForToolRun) => Promise<string>;
14
- }
15
- /**
16
- * Interface for the input parameters of the DynamicStructuredTool class.
17
- */
18
- export interface DynamicStructuredToolInput<T extends z.ZodObject<any, any, any, any> = z.ZodObject<any, any, any, any>> extends BaseDynamicToolInput {
19
- func: (input: z.infer<T>, runManager?: CallbackManagerForToolRun) => Promise<string>;
20
- schema: T;
21
- }
22
- /**
23
- * A tool that can be created dynamically from a function, name, and description.
24
- */
25
- export declare class DynamicTool extends Tool {
26
- static lc_name(): string;
27
- name: string;
28
- description: string;
29
- func: DynamicToolInput["func"];
30
- constructor(fields: DynamicToolInput);
31
- /** @ignore */
32
- _call(input: string, runManager?: CallbackManagerForToolRun): Promise<string>;
33
- }
34
- /**
35
- * A tool that can be created dynamically from a function, name, and
36
- * description, designed to work with structured data. It extends the
37
- * StructuredTool class and overrides the _call method to execute the
38
- * provided function when the tool is called.
39
- */
40
- export declare class DynamicStructuredTool<T extends z.ZodObject<any, any, any, any> = z.ZodObject<any, any, any, any>> extends StructuredTool {
41
- static lc_name(): string;
42
- name: string;
43
- description: string;
44
- func: DynamicStructuredToolInput["func"];
45
- schema: T;
46
- constructor(fields: DynamicStructuredToolInput<T>);
47
- protected _call(arg: z.output<T>, runManager?: CallbackManagerForToolRun): Promise<string>;
48
- }
1
+ export * from "@langchain/community/tools/dynamic";
@@ -1,84 +1 @@
1
- import { StructuredTool, Tool } from "./base.js";
2
- /**
3
- * A tool that can be created dynamically from a function, name, and description.
4
- */
5
- export class DynamicTool extends Tool {
6
- static lc_name() {
7
- return "DynamicTool";
8
- }
9
- constructor(fields) {
10
- super(fields);
11
- Object.defineProperty(this, "name", {
12
- enumerable: true,
13
- configurable: true,
14
- writable: true,
15
- value: void 0
16
- });
17
- Object.defineProperty(this, "description", {
18
- enumerable: true,
19
- configurable: true,
20
- writable: true,
21
- value: void 0
22
- });
23
- Object.defineProperty(this, "func", {
24
- enumerable: true,
25
- configurable: true,
26
- writable: true,
27
- value: void 0
28
- });
29
- this.name = fields.name;
30
- this.description = fields.description;
31
- this.func = fields.func;
32
- this.returnDirect = fields.returnDirect ?? this.returnDirect;
33
- }
34
- /** @ignore */
35
- async _call(input, runManager) {
36
- return this.func(input, runManager);
37
- }
38
- }
39
- /**
40
- * A tool that can be created dynamically from a function, name, and
41
- * description, designed to work with structured data. It extends the
42
- * StructuredTool class and overrides the _call method to execute the
43
- * provided function when the tool is called.
44
- */
45
- export class DynamicStructuredTool extends StructuredTool {
46
- static lc_name() {
47
- return "DynamicStructuredTool";
48
- }
49
- constructor(fields) {
50
- super(fields);
51
- Object.defineProperty(this, "name", {
52
- enumerable: true,
53
- configurable: true,
54
- writable: true,
55
- value: void 0
56
- });
57
- Object.defineProperty(this, "description", {
58
- enumerable: true,
59
- configurable: true,
60
- writable: true,
61
- value: void 0
62
- });
63
- Object.defineProperty(this, "func", {
64
- enumerable: true,
65
- configurable: true,
66
- writable: true,
67
- value: void 0
68
- });
69
- Object.defineProperty(this, "schema", {
70
- enumerable: true,
71
- configurable: true,
72
- writable: true,
73
- value: void 0
74
- });
75
- this.name = fields.name;
76
- this.description = fields.description;
77
- this.func = fields.func;
78
- this.returnDirect = fields.returnDirect ?? this.returnDirect;
79
- this.schema = fields.schema;
80
- }
81
- _call(arg, runManager) {
82
- return this.func(arg, runManager);
83
- }
84
- }
1
+ export * from "@langchain/community/tools/dynamic";
@@ -1,77 +1,17 @@
1
1
  "use strict";
2
- /* eslint-disable spaced-comment */
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
3
16
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.deleteMany = exports.upsert = exports.lookup = exports.insert = exports.get = void 0;
5
- // eslint-disable-next-line import/no-extraneous-dependencies
6
- const server_1 = require("convex/server");
7
- // eslint-disable-next-line import/no-extraneous-dependencies
8
- const values_1 = require("convex/values");
9
- exports.get = (0, server_1.internalQueryGeneric)({
10
- args: {
11
- id: /*#__PURE__*/ values_1.v.string(),
12
- },
13
- handler: async (ctx, args) => {
14
- const result = await ctx.db.get(args.id);
15
- return result;
16
- },
17
- });
18
- exports.insert = (0, server_1.internalMutationGeneric)({
19
- args: {
20
- table: /*#__PURE__*/ values_1.v.string(),
21
- document: /*#__PURE__*/ values_1.v.any(),
22
- },
23
- handler: async (ctx, args) => {
24
- await ctx.db.insert(args.table, args.document);
25
- },
26
- });
27
- exports.lookup = (0, server_1.internalQueryGeneric)({
28
- args: {
29
- table: /*#__PURE__*/ values_1.v.string(),
30
- index: /*#__PURE__*/ values_1.v.string(),
31
- keyField: /*#__PURE__*/ values_1.v.string(),
32
- key: /*#__PURE__*/ values_1.v.string(),
33
- },
34
- handler: async (ctx, args) => {
35
- const result = await ctx.db
36
- .query(args.table)
37
- .withIndex(args.index, (q) => q.eq(args.keyField, args.key))
38
- .collect();
39
- return result;
40
- },
41
- });
42
- exports.upsert = (0, server_1.internalMutationGeneric)({
43
- args: {
44
- table: /*#__PURE__*/ values_1.v.string(),
45
- index: /*#__PURE__*/ values_1.v.string(),
46
- keyField: /*#__PURE__*/ values_1.v.string(),
47
- key: /*#__PURE__*/ values_1.v.string(),
48
- document: /*#__PURE__*/ values_1.v.any(),
49
- },
50
- handler: async (ctx, args) => {
51
- const existing = await ctx.db
52
- .query(args.table)
53
- .withIndex(args.index, (q) => q.eq(args.keyField, args.key))
54
- .unique();
55
- if (existing !== null) {
56
- await ctx.db.replace(existing._id, args.document);
57
- }
58
- else {
59
- await ctx.db.insert(args.table, args.document);
60
- }
61
- },
62
- });
63
- exports.deleteMany = (0, server_1.internalMutationGeneric)({
64
- args: {
65
- table: /*#__PURE__*/ values_1.v.string(),
66
- index: /*#__PURE__*/ values_1.v.string(),
67
- keyField: /*#__PURE__*/ values_1.v.string(),
68
- key: /*#__PURE__*/ values_1.v.string(),
69
- },
70
- handler: async (ctx, args) => {
71
- const existing = await ctx.db
72
- .query(args.table)
73
- .withIndex(args.index, (q) => q.eq(args.keyField, args.key))
74
- .collect();
75
- await Promise.all(existing.map((doc) => ctx.db.delete(doc._id)));
76
- },
77
- });
17
+ __exportStar(require("@langchain/community/util/convex"), exports);
@@ -1,26 +1 @@
1
- export declare const get: import("convex/server").RegisteredQuery<"internal", {
2
- id: string;
3
- }, Promise<any>>;
4
- export declare const insert: import("convex/server").RegisteredMutation<"internal", {
5
- document: any;
6
- table: string;
7
- }, Promise<void>>;
8
- export declare const lookup: import("convex/server").RegisteredQuery<"internal", {
9
- key: string;
10
- index: string;
11
- table: string;
12
- keyField: string;
13
- }, Promise<any[]>>;
14
- export declare const upsert: import("convex/server").RegisteredMutation<"internal", {
15
- key: string;
16
- document: any;
17
- index: string;
18
- table: string;
19
- keyField: string;
20
- }, Promise<void>>;
21
- export declare const deleteMany: import("convex/server").RegisteredMutation<"internal", {
22
- key: string;
23
- index: string;
24
- table: string;
25
- keyField: string;
26
- }, Promise<void>>;
1
+ export * from "@langchain/community/util/convex";