๐ Integrations
Select a language
- Python
- JavaScript
๐ฆ๏ธ๐ Langchainโ
- LangChain + Chroma on the LangChain blog
- Harrison's
chroma-langchain
demo repo - Tutorials
- Chroma and LangChain tutorial - The demo showcases how to pull data from the English Wikipedia using their API. The project also demonstrates how to vectorize data in chunks and get embeddings using OpenAI embeddings model.
- Create a Voice-based ChatGPT Clone That Can Search on the Internet and local files
- LangChain's Chroma Documentation
๐ฆ LlamaIndexโ
formerly known as GPT-index
๐ฆ๏ธ๐ LangchainJSโ
Here is an example in LangChainJS
import { OpenAI } from "langchain/llms/openai";
import { ConversationalRetrievalQAChain } from "langchain/chains";
import { Chroma } from "langchain/vectorstores/chroma";
import { OpenAIEmbeddings } from "langchain/embeddings/openai";
import { RecursiveCharacterTextSplitter } from "langchain/text_splitter";
import * as fs from "fs";
// to run this first run a chroma server with `chroma run --path /path/to/data`
export const run = async () => {
/* Initialize the LLM to use to answer the question */
const model = new OpenAI();
/* Load in the file we want to do question answering over */
const text = fs.readFileSync("state_of_the_union.txt", "utf8");
/* Split the text into chunks */
const textSplitter = new RecursiveCharacterTextSplitter({ chunkSize: 1000 });
const docs = await textSplitter.createDocuments([text]);
/* Create the vectorstore */
const vectorStore = await Chroma.fromDocuments(docs, new OpenAIEmbeddings(), {
collectionName: "state_of_the_union",
});
/* Create the chain */
const chain = ConversationalRetrievalQAChain.fromLLM(
model,
vectorStore.asRetriever()
);
/* Ask it a question */
const question = "What did the president say about Justice Breyer?";
const res = await chain.call({ question, chat_history: [] });
console.log(res);
};