@langchain/community
Version:
Third-party integrations for LangChain.js
1 lines • 3.1 kB
Source Map (JSON)
{"version":3,"file":"planetscale.d.cts","names":["Client","PlanetScaleClient","Config","PlanetScaleConfig","BaseListChatMessageHistory","BaseMessage","PlanetScaleChatMessageHistoryInput","PlanetScaleChatMessageHistory","Promise"],"sources":["../../../src/stores/message/planetscale.d.ts"],"sourcesContent":["import { Client as PlanetScaleClient, Config as PlanetScaleConfig } from \"@planetscale/database\";\nimport { BaseListChatMessageHistory } from \"@langchain/core/chat_history\";\nimport { BaseMessage } from \"@langchain/core/messages\";\n/**\n * Type definition for the input parameters required when instantiating a\n * PlanetScaleChatMessageHistory object.\n */\nexport type PlanetScaleChatMessageHistoryInput = {\n tableName?: string;\n sessionId: string;\n config?: PlanetScaleConfig;\n client?: PlanetScaleClient;\n};\n/**\n * Class for storing and retrieving chat message history from a\n * PlanetScale database. Extends the BaseListChatMessageHistory class.\n * @example\n * ```typescript\n * const chatHistory = new PlanetScaleChatMessageHistory({\n * tableName: \"stored_message\",\n * sessionId: \"lc-example\",\n * config: {\n * url: \"ADD_YOURS_HERE\",\n * },\n * });\n * const chain = new ConversationChain({\n * llm: new ChatOpenAI({ model: \"gpt-4o-mini\" }),\n * memory: chatHistory,\n * });\n * const response = await chain.invoke({\n * input: \"What did I just say my name was?\",\n * });\n * console.log({ response });\n * ```\n */\nexport declare class PlanetScaleChatMessageHistory extends BaseListChatMessageHistory {\n lc_namespace: string[];\n get lc_secrets(): {\n \"config.host\": string;\n \"config.username\": string;\n \"config.password\": string;\n \"config.url\": string;\n };\n client: PlanetScaleClient;\n private connection;\n private tableName;\n private sessionId;\n private tableInitialized;\n constructor(fields: PlanetScaleChatMessageHistoryInput);\n private ensureTable;\n /**\n * Method to retrieve all messages from the PlanetScale database for the\n * current session.\n * @returns Promise that resolves to an array of BaseMessage objects.\n */\n getMessages(): Promise<BaseMessage[]>;\n /**\n * Method to add a new message to the PlanetScale database for the current\n * session.\n * @param message The BaseMessage object to be added to the database.\n * @returns Promise that resolves to void.\n */\n addMessage(message: BaseMessage): Promise<void>;\n /**\n * Method to delete all messages from the PlanetScale database for the\n * current session.\n * @returns Promise that resolves to void.\n */\n clear(): Promise<void>;\n}\n//# sourceMappingURL=planetscale.d.ts.map"],"mappings":";;;;;;;;AAOA;AA4BA;AAQYC,KApCAK,kCAAAA,GAoCAL;EAKYK,SAAAA,CAAAA,EAAAA,MAAAA;EAOGD,SAAAA,EAAAA,MAAAA;EAARG,MAAAA,CAAAA,EA7CNL,MA6CMK;EAOKH,MAAAA,CAAAA,EAnDXJ,MAmDWI;CAAcG;;;AA3B+C;;;;;;;;;;;;;;;;;;;;cAAhED,6BAAAA,SAAsCH,0BAAAA;;;;;;;;UAQ/CH;;;;;sBAKYK;;;;;;;iBAOLE,QAAQH;;;;;;;sBAOHA,cAAcG;;;;;;WAMzBA"}