UNPKG

@langchain/community

Version:
1 lines • 2.98 kB
{"version":3,"file":"astradb.d.ts","names":["BaseListChatMessageHistory","BaseMessage","Collection","AstraDBChatMessageHistoryInput","AstraDBChatMessageHistoryProps","AstraDBChatMessageHistory","collection","sessionId","token","endpoint","collectionName","namespace","Promise"],"sources":["../../../src/stores/message/astradb.d.ts"],"sourcesContent":["import { BaseListChatMessageHistory } from \"@langchain/core/chat_history\";\nimport { BaseMessage } from \"@langchain/core/messages\";\nimport { Collection } from \"@datastax/astra-db-ts\";\nexport interface AstraDBChatMessageHistoryInput {\n token: string;\n endpoint: string;\n collectionName: string;\n namespace?: string;\n sessionId: string;\n}\nexport interface AstraDBChatMessageHistoryProps {\n collection: Collection;\n sessionId: string;\n}\n/**\n * Class for storing chat message history with Astra DB. It extends the\n * BaseListChatMessageHistory class and provides methods to get, add, and\n * clear messages.\n * @example\n *\n * ```typescript\n * const client = new AstraDB(\n * process.env.ASTRA_DB_APPLICATION_TOKEN,\n * process.env.ASTRA_DB_ENDPOINT,\n * process.env.ASTRA_DB_NAMESPACE\n * );\n *\n * const collection = await client.collection(\"test_chat\");\n *\n * const chatHistory = new AstraDBChatMessageHistory({\n * collection,\n * sessionId: \"YOUR_SESSION_ID\",\n * });\n *\n * const messages = await chatHistory.getMessages();\n *\n * await chatHistory.clear();\n */\nexport declare class AstraDBChatMessageHistory extends BaseListChatMessageHistory {\n lc_namespace: string[];\n private sessionId;\n private collection;\n constructor({ collection, sessionId }: AstraDBChatMessageHistoryProps);\n /**\n * async initializer function to return a new instance of AstraDBChatMessageHistory in a single step\n * @param AstraDBChatMessageHistoryInput\n * @returns Promise<AstraDBChatMessageHistory>\n *\n * @example\n * const chatHistory = await AstraDBChatMessageHistory.initialize({\n * token: process.env.ASTRA_DB_APPLICATION_TOKEN,\n * endpoint: process.env.ASTRA_DB_ENDPOINT,\n * namespace: process.env.ASTRA_DB_NAMESPACE,\n * collectionName:\"test_chat\",\n * sessionId: \"YOUR_SESSION_ID\"\n * });\n */\n static initialize({ token, endpoint, collectionName, namespace, sessionId }: AstraDBChatMessageHistoryInput): Promise<AstraDBChatMessageHistory>;\n getMessages(): Promise<BaseMessage[]>;\n addMessage(message: BaseMessage): Promise<void>;\n clear(): Promise<void>;\n}\n//# sourceMappingURL=astradb.d.ts.map"],"mappings":";;;;;UAGiBG,8BAAAA;;EAAAA,QAAAA,EAAAA,MAAAA;EAOAC,cAAAA,EAAAA,MAAAA;EA4BIC,SAAAA,CAAAA,EAAAA,MAAAA;EAIHC,SAAAA,EAAAA,MAAAA;;AAAyBF,UAhC1BA,8BAAAA,CAgC0BA;EAenBI,UAAAA,EA9CRN,UA8CQM;EAAOC,SAAAA,EAAAA,MAAAA;;;;;;;;;;;;;AAnBkD;;;;;;;;;;;;;cAA5DJ,yBAAAA,SAAkCL,0BAAAA;;;;;;;KAIZI;;;;;;;;;;;;;;;;;;;;;KAesCD,iCAAiCS,QAAQP;iBACvGO,QAAQX;sBACHA,cAAcW;WACzBA"}