Research & Opinions

Generative Intelligence #3: Vector Databases & LLMs

In this episode of Generative Intelligence #3, we go over vector databases and the role that they play when creating chat-enabled applications.
Shanif Dhanani
5.0 minutes

Large language models (LLMs) like ChatGPT and Bard have incredible potential to help businesses maximize efficiency and productivity, whether it's improving internal search engines, automating decision-making, or developing better customer support tools. But like any emerging technology, LLMs also present their unique challenges. 

ChatGPT was trained on public data, which gives it a wide variety of knowledge across different topics. But what it doesn't have is knowledge of your business' proprietary data. In order for an LLM to truly live up to its potential for your business, it needs access to your key documents, databases, manuals, and other important sources of information. That’s where a vector database comes in.

How vector databases enhance LLMs for businesses

Have you ever had a question about a project you’re working on, but struggled to find the answer you know exists in your files somewhere? That’s a pretty common occurrence, and one that businesses want to look to an LLM to solve. Essentially, it’s just a matter of using the technology to crawl through your files instead of digging around yourself - saving a ton of time and effort.

Here’s the hangup: if you want an LLM like ChatGPT to search your company’s files, you have to be able to tell it which files to search through. Since there’s a limit to the number of words you can message ChatGPT, asking it to search for an answer to your query from a large database of company information is impossible.

To address this challenge, you can create a vector database. A vector database can store textual content in a way that makes it simple to find data and information relevant to your question. Instead of taking your question directly to ChatGPT, you first use a vector database to identify which documents, paragraphs, or lines in a spreadsheet might contain the answer. Then, you provide those specific documents along with your original question to ChatGPT to get the most accurate and informative response to your query.

Growing improvements for an imperfect system

Remember when we mentioned technology has challenges? While vector databases can be incredibly useful when paired with LLMs, they also come with a few caveats:

  • Scoring: Vector databases work by assigning content a score between 0 and 1 for how well it matches your initial search query. Usually, a score of 0.75 or above will provide relevant results. However, vector databases don’t work by providing the best match for the semantic intent of your query, like LLMs. So occasionally, they may suggest irrelevant results.
  • Data upkeep: Vector databases aren’t inherently linked to your source data, and as such don’t “auto-update” whenever you modify your documents. So, to ensure you’re getting the most up-to-date and accurate results from your searches, you’ll need to periodically re-index your data.
  • Integration: Currently, vector databases aren't meant to be used within a chatbox window, like on the ChatGPT website. They require you to store and retrieve documents via an API. So, in order to effectively optimize your LLM usage with a vector database, your business will need a pre-existing product that connects your workflows (or an engineering team to build an entire custom system).

Bridging the gap with APIs

If you have a dedicated engineering team ready to build out a custom vector database integration for your LLM, great! But for many businesses, finding an existing tool to connect these workflows will be a more reasonable and efficient solution. Luckily, leading API platforms are hard at work creating systems to handle data connection, indexing and infrastructure, and LLM queries. 

Essentially, these purpose-built APIs work to automate the challenging aspects of working with vector databases while improving functionality. You can use an API to…

  • Quickly integrate popular data sources. API platforms can provide pre-built connectors to standard protocols like OAuth, as well as allow new data sources to be added through a simple point-and-click interface. These platforms typically automatically extract text and handle identity management. This allows you to save time and money, since you won’t have to custom-code scrapers and access systems from scratch.
  • Keep proprietary data up-to-date. APIs allow document embedding and re-indexing to run continuously behind-the-scenes. They can track changes across connected sources, which means you don’t have to worry about remembering to re-index your data whenever you update a document. 
  • Manage permissions and access. Since API platforms have their own identity providers and access policies, you don’t have to build any custom authorization systems. Users have access to specific tools, and the API will use their access permissions to index and refresh data.
  • Create direct integration with LLMs. The best APIs will not only let you index and query documents, but will also include built-in support for integrating indexed data into LLMs. Certain API systems will even allow you to integrate multiple data sources, retrieve relevant data snippets, and generate an LLM response based on a single prompt.

Finding the tools to move forward

As technology around LLMs continues to grow and expand, we’ll continue to find new, more efficient ways to optimize their systems for our businesses. The combined power of vector databases and LLMs has the potential to give companies a huge boost to efficiency and productivity across many different aspects of work. However, you’ll still need an API tool to bridge the gap between locating the right data and getting the right answer to your question.

If you want to test out the power of a data ingestion API without having to operate your own vector database, check out Locusive’s API. You can easily connect your data sources to be indexed for queries, and even automatically invoke an LLM using context from your data.