Integrations
Unstructured
You can use Unstructured.io as a content processor in RAGChat. To use Unstructured.io for processing your data, first initialize RAGChat with your chosen model, then add context using Unstructured.io as the processor:
import { RAGChat, upstash } from "@upstash/rag-chat";
const ragChat = new RAGChat({
model: upstash("meta-llama/Meta-Llama-3-8B-Instruct"),
});
const fileSource = "./hackernews.html";
const response = await fetch("https://news.ycombinator.com/");
// Or, fs.writeFile('/Users/joe/test.txt', content);
await Bun.write(fileSource, await response.text());
await ragChat.context.add({
options: {
namespace: "unstructured-upstash",
},
fileSource,
processor: {
name: "unstructured",
options: { apiKey: process.env.UNSTRUCTURED_IO_KEY },
},
});
const result = await ragChat.chat("What is the second story on hacker news?", {
streaming: false,
namespace: "unstructured-upstash",
});
Was this page helpful?