Use Xata to ask your data questions and get the answers that matter most.
Written by
Daniel Everts
Published on
March 2, 2023
Xata’s here to take care of the hard stuff surrounding data: high availability, scaling, access control, synchronization, and a bunch more. Our data platform is built to handle these problems, so you can focus on building what’s unique to your product. As developers ourselves, building a platform is fun. We use Xata in our own work as much as possible, and out of it comes a tonne of new ideas. These ideas, turned into features, help you move faster.
It's been hard to miss the thunderstorm generated by OpenAI. For the last few months, it’s been everywhere; simple answers to tricky questions, hip-hop songs about Kubernetes, or standup comedy about functional programming. From all the uses, one thing felt clear: this was a firm shove into the future.
With their APIs, we now have tools to help you analyze, reshape, and reframe text. Tools to help inspire new ideas, distill information down into ELI5-chunks, or generate photo-realistic pictures of cats in space. It provides an API that deals with a complicated world. One where you can’t easily prepare for all reasonable inputs.
This isn’t a teary-eyed post about OpenAI though. We’re wanting to show you something we’ve had brewing over the last few weeks. Let’s begin with a screenshot taken a couple of days ago, from ChatGPT.
For those familiar with Xata, you'll see that this not correct. ChatGPT has confidently given us a wrong answer. We can’t blame it though, the model has a documented cutoff date for its data in 2021 and unfortunately for us, Xata’s documentation was published after this date.
Let’s take a look at once more image. I’ll ask the same question again.
We’ve been working on integrating OpenAI into our data platform. Xata now lets you ask your data questions. It relies fully on the data you have inside Xata. No waiting for OpenAI, Google, or any other company to index your changes. It’s your data, and you’re fully in control of it. You choose when to add information, remove information, modify information. Xata takes these changes and makes them available nearly instantly. It requires no work from you, and comes with options for both free and pro users.
The idea came out of a demo day. We run a session every few weeks where the team gathers to show off ideas, proof-of-concepts, or features we’ve just completed. During the demo for the integration (in those days it was called DanGPT), I had my screen shared. Demos are bad at the best of times, and here, I wasn’t totally sure what would be returned. I wrote my question, and nervously pressed a green “Ask” button that I had only finished that morning. The result that came out was almost perfect. It needed tuning, but seeing it take a natural-sounding question and coming back with Xata-specific details felt like magic.
Building this feature has been the source of a buffet of new ideas for us. Here’s a few things we’re thinking about.
We use Xata to store our documentation. This is stored as markdown in text
columns. The Xata Ask API queries the data and returns a response that matches the context of the question and uses the content we have stored. This helps users find information quicker, make use of it faster, and to be able to ask questions in a way that feels natural to them, rather than needing to try and adapt their question to what they think our docs wants.
This is coming to our documentation, look out for the “Ask our chat bot” buttons on the documentation site, and in the Xata app.
If you have a lot of data, finding the right document can be tough. Finding the right text in that document can also be tough. A question might be phrased in a way that is uncommon, or an answer might require context from several documents.
Xata understands the intent of the question, and has to one column of one table all the way up to all columns in all tables. This means that it can take a wide range of questions, and stitch together a coherent answer.
Have a FAQ or receive common questions? Use Xata to help answer common questions before being escalated to an agent. The responses will adapt to the questions, and you can write documentation in natural language. Xata’s search service will make the data you change available almost immediately.
What’s got us excited about releasing our integration with OpenAI is that we can offer it on top of our existing platform. By using one of our SDKs or the REST API, you’re able to leverage this technology without any major changes to your workflow.
Here’s the API call our docs make to retrieve data from our docs table.
// POST https://xata-uq2d57.eu-west-1.xata.sh/db/docs:main/tables/search/ask
// Accept: text/event-stream
{
"question": "How do a retrieve a single record?",
"rules": [
"Do not answer questions about pricing or the free tier. Respond that Xata has several options available, please check https://xata.io/pricing for more information.",
"When you give an example, this example must exist exactly in the context given.",
"Only answer questions that are relating to the defined context or are general technical questions. If asked about a question outside of the context, you can respond with \"It doesn't look like I have enough information to answer that. Check the documentation or contact support.\"",
"Your name is DanGPT"
],
"searchType": "keyword",
"search": {
"fuzziness": 2,
"prefix": "phrase",
"target": ["slug", { "column": "title", "weight": 4 }, "content", "section", { "column": "keywords", "weight": 4 }],
"boosters": [
{
"valueBooster": {
"column": "section",
"value": "guide",
"factor": 18
}
}
]
}
}
Sign up to add ChatGPT to your data today and get started with this new sample app. Come say hi on our Discord if you have any questions.
We’re excited to see what you build 🦋
Xata provides the best free plan in the industry. It is production ready by default and doesn't pause or cool-down. Take your time to build your business and upgrade when you're ready to scale.
Copyright © 2024 Xatabase Inc.
All rights reserved.