Getting Started
Upstash RAG Chat is TypeScript toolkit for building powerful RAG applications. With Upstash RAG Chat, you can focus on building a high-quality chatbot without having to deal with complicated AI orchestration tools.
You can find the Github Repository here.
Installation
Install the package using your preferred package manager:
Quick start
- Set up your environment variables:
- Initialize and use RAGChat:
Configuring Your Chat Model
RAGChat supports both Upstash-hosted models and all OpenAI and OpenAI-compatible models out of the box:
Using OpenAI Models
To use an OpenAI model, first initialize RAGChat:
And set your OpenAI API key as an environment variable:
Using Upstash-hosted Open-Source Models
To use an Upstash model, first initialize RAGChat:
And set your Upstash QStash API key environment variable:
Using Custom Providers - TogetherAi, Replicate
Initialize RAGChat with custom provider’s API key and url:
Managing Your Knowledge Base
Add various types of data to your RAG application:
Adding Text
Adding PDF Content
Adding Web Content
Removing Content
Remove specific documents:
Managing Chat History
RAGChat provides robust functionality for interacting with and managing chat history. This allows you to maintain context, review past interactions, and customize the conversation flow.
Retrieving Chat History
Fetch recent messages from the chat history:
You can also specify a session ID to retrieve history for a particular conversation:
Deleting Chat History
Remove chat history for a specific session:
Adding Custom Messages
Injecting custom messages into the chat history: