UNPKG

@langchain/community

Version:
1 lines • 4.17 kB
{"version":3,"file":"aurora_dsql.d.ts","names":["BaseListChatMessageHistory","BaseMessage","pg","AuroraDsqlChatMessageHistoryInput","PoolConfig","Pool","StoredAuroraDsqlMessageData","Record","AuroraDsqlChatMessageHistory","Promise"],"sources":["../../../src/stores/message/aurora_dsql.d.ts"],"sourcesContent":["import { BaseListChatMessageHistory } from \"@langchain/core/chat_history\";\nimport { BaseMessage } from \"@langchain/core/messages\";\nimport pg from \"pg\";\n/**\n * Type definition for the input parameters required when instantiating a\n * AuroraDsqlChatMessageHistory object.\n */\nexport type AuroraDsqlChatMessageHistoryInput = {\n /**\n * Name of the table to use when storing and retrieving chat message\n */\n tableName?: string;\n /**\n * Session ID to use when storing and retrieving chat message history.\n */\n sessionId: string;\n /**\n * Configuration object for the Postgres pool. If provided the\n * AuroraDsqlChatMessageHistory object will create a new pool using\n * the provided configuration. Otherwise it will use the provided\n * pool.\n */\n poolConfig?: pg.PoolConfig;\n /**\n * Postgres pool to use. If provided the PostgresChatMessageHistory\n * object will use the provided pool. Otherwise it will create a\n * new pool using the provided configuration.\n */\n pool?: pg.Pool;\n /**\n * If true, the table name will be escaped. ('lAnGcHaIn' will be escaped to '\"lAnGcHaIn\"')\n */\n escapeTableName?: boolean;\n};\nexport interface StoredAuroraDsqlMessageData {\n name: string | undefined;\n role: string | undefined;\n content: string;\n additional_kwargs?: Record<string, unknown>;\n type: string;\n tool_call_id: string | undefined;\n}\n/**\n * Class for managing chat message history using a Amazon Aurora DSQL Database as a\n * storage backend. Extends the BaseListChatMessageHistory class.\n * @example\n * ```typescript\n * const chatHistory = new AuroraDsqlChatMessageHistory({\n * tableName: \"langchain_chat_histories\",\n * sessionId: \"lc-example\",\n * pool: new pg.Pool({\n * host: \"your_dsql_endpoint\",\n * port: 5432,\n * user: \"admin\",\n * password: \"your_token\",\n * database: \"postgres\",\n * ssl: true\n * }),\n * });\n * ```\n */\nexport declare class AuroraDsqlChatMessageHistory extends BaseListChatMessageHistory {\n lc_namespace: string[];\n pool: pg.Pool;\n tableName: string;\n sessionId: string;\n private initialized;\n /**\n * Creates a new AuroraDsqlChatMessageHistory.\n * @param {AuroraDsqlChatMessageHistoryInput} fields The input fields for the AuroraDsqlChatMessageHistory.\n * @param {string} fields.tableName The name of the table name to use. Defaults to `langchain_chat_histories`.\n * @param {string} fields.sessionId The session ID to use when storing and retrieving chat message history.\n * @param {pg.Pool} fields.pool The Postgres pool to use. If provided, the AuroraDsqlChatMessageHistory will use the provided pool.\n * @param {pg.PoolConfig} fields.poolConfig The configuration object for the Postgres pool. If no pool is provided, the config will be used to create a new pool.\n * If `pool` is provided, it will be used as the Postgres pool even if `poolConfig` is also provided.\n * @throws If neither `pool` nor `poolConfig` is provided.\n */\n constructor(fields: AuroraDsqlChatMessageHistoryInput);\n private ensureTable;\n private createIndex;\n addMessage(message: BaseMessage): Promise<void>;\n getMessages(): Promise<BaseMessage[]>;\n clear(): Promise<void>;\n /**\n * End the Postgres pool.\n */\n end(): Promise<void>;\n}\n//# sourceMappingURL=aurora_dsql.d.ts.map"],"mappings":";;;;;;;;AAOA;AA2BA;AA2BqBQ,KAtDTL,iCAAAA,GAsDqC;EAEpCE;;;EAiByBI,SAAAA,CAAAA,EAAAA,MAAAA;EACXR;;;EAKhBQ,SAAAA,EAAAA,MAAAA;EAzB+CT;AAA0B;;;;;eAvCnEE,EAAAA,CAAGE;;;;;;SAMTF,EAAAA,CAAGG;;;;;;UAMGC,2BAAAA;;;;sBAIOC;;;;;;;;;;;;;;;;;;;;;;;cAuBHC,4BAAAA,SAAqCR,0BAAAA;;QAEhDE,EAAAA,CAAGG;;;;;;;;;;;;;;sBAcWF;;;sBAGAF,cAAcQ;iBACnBA,QAAQR;WACdQ;;;;SAIFA"}