UNPKG

@langchain/community

Version:
1 lines • 6.76 kB
{"version":3,"file":"convex.d.ts","names":["DocumentByName","FieldPaths","FunctionReference","GenericActionCtx","GenericDataModel","NamedTableInfo","TableNamesInDataModel","IndexNames","BaseListChatMessageHistory","BaseMessage","ConvexChatMessageHistoryInput","DataModel","TableName","IndexName","SessionIdFieldName","MessageTextFieldName","InsertMutation","LookupQuery","DeleteManyMutation","ConvexChatMessageHistory","Promise"],"sources":["../../../src/stores/message/convex.d.ts"],"sourcesContent":["import { DocumentByName, FieldPaths, FunctionReference, GenericActionCtx, GenericDataModel, NamedTableInfo, TableNamesInDataModel, IndexNames } from \"convex/server\";\nimport { BaseListChatMessageHistory } from \"@langchain/core/chat_history\";\nimport { BaseMessage } from \"@langchain/core/messages\";\n/**\n * Type that defines the config required to initialize the\n * ConvexChatMessageHistory class. At minimum it needs a sessionId\n * and an ActionCtx.\n */\nexport type ConvexChatMessageHistoryInput<DataModel extends GenericDataModel, TableName extends TableNamesInDataModel<DataModel> = \"messages\", IndexName extends IndexNames<NamedTableInfo<DataModel, TableName>> = \"bySessionId\", SessionIdFieldName extends FieldPaths<NamedTableInfo<DataModel, TableName>> = \"sessionId\", MessageTextFieldName extends FieldPaths<NamedTableInfo<DataModel, TableName>> = \"message\", InsertMutation extends FunctionReference<\"mutation\", \"internal\", {\n table: string;\n document: object;\n}> = any, LookupQuery extends FunctionReference<\"query\", \"internal\", {\n table: string;\n index: string;\n keyField: string;\n key: string;\n}, object[]> = any, DeleteManyMutation extends FunctionReference<\"mutation\", \"internal\", {\n table: string;\n index: string;\n keyField: string;\n key: string;\n}> = any> = {\n readonly ctx: GenericActionCtx<DataModel>;\n readonly sessionId: DocumentByName<DataModel, TableName>[SessionIdFieldName];\n /**\n * Defaults to \"messages\"\n */\n readonly table?: TableName;\n /**\n * Defaults to \"bySessionId\"\n */\n readonly index?: IndexName;\n /**\n * Defaults to \"sessionId\"\n */\n readonly sessionIdField?: SessionIdFieldName;\n /**\n * Defaults to \"message\"\n */\n readonly messageTextFieldName?: MessageTextFieldName;\n /**\n * Defaults to `internal.langchain.db.insert`\n */\n readonly insert?: InsertMutation;\n /**\n * Defaults to `internal.langchain.db.lookup`\n */\n readonly lookup?: LookupQuery;\n /**\n * Defaults to `internal.langchain.db.deleteMany`\n */\n readonly deleteMany?: DeleteManyMutation;\n};\nexport declare class ConvexChatMessageHistory<DataModel extends GenericDataModel, SessionIdFieldName extends FieldPaths<NamedTableInfo<DataModel, TableName>> = \"sessionId\", TableName extends TableNamesInDataModel<DataModel> = \"messages\", IndexName extends IndexNames<NamedTableInfo<DataModel, TableName>> = \"bySessionId\", MessageTextFieldName extends FieldPaths<NamedTableInfo<DataModel, TableName>> = \"message\", InsertMutation extends FunctionReference<\"mutation\", \"internal\", {\n table: string;\n document: object;\n}> = any, LookupQuery extends FunctionReference<\"query\", \"internal\", {\n table: string;\n index: string;\n keyField: string;\n key: string;\n}, object[]> = any, DeleteManyMutation extends FunctionReference<\"mutation\", \"internal\", {\n table: string;\n index: string;\n keyField: string;\n key: string;\n}> = any> extends BaseListChatMessageHistory {\n lc_namespace: string[];\n private readonly ctx;\n private readonly sessionId;\n private readonly table;\n private readonly index;\n private readonly sessionIdField;\n private readonly messageTextFieldName;\n private readonly insert;\n private readonly lookup;\n private readonly deleteMany;\n constructor(config: ConvexChatMessageHistoryInput<DataModel, TableName, IndexName, SessionIdFieldName, MessageTextFieldName, InsertMutation, LookupQuery, DeleteManyMutation>);\n getMessages(): Promise<BaseMessage[]>;\n addMessage(message: BaseMessage): Promise<void>;\n clear(): Promise<void>;\n}\n//# sourceMappingURL=convex.d.ts.map"],"mappings":";;;;;;;;AAQA;;;AAAgGM,KAApFI,6BAAoFJ,CAAAA,kBAApCF,gBAAoCE,EAAAA,kBAAAA,qBAAAA,CAAsBK,SAAtBL,CAAAA,GAAAA,UAAAA,EAAAA,kBAAiEC,UAAjED,CAA4ED,cAA5EC,CAA2FK,SAA3FL,EAAsGM,SAAtGN,CAAAA,CAAAA,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