XataChatMessageHistory
class, you can use Xata databases for longer-term persistence of chat sessions.
Because Xata works via a REST API and has a pure TypeScript SDK, you can use this with Vercel Edge, Cloudflare Workers and any other Serverless environment.
langchain
.
When executed for the first time, the Xata LangChain integration will create the table used for storing the chat messages. If a table with that name already exists, it will be left untouched.
xata.ts
or xata.js
file that defines the client you can use to interact with the database. See the Xata getting started docs for more details on using the Xata JavaScript/TypeScript SDK.
getXataClient()
function is used to create a new Xata client based on the environment variables. However, we recommend using the code generated by the xata init
command, in which case you only need to import the getXataClient()
function from the generated xata.ts
file.
createTable: false
to the constructor. The table must have the following columns:
sessionId
of type String
type
of type String
role
of type String
content
of type Text
name
of type String
additionalKwargs
of type Text