Embedding and storing documents
The final step for preparing the documents for retrieval is embedding and storing them. You'll be using the text-embedding-3-small
model from OpenAI for embedding the chunked documents, and storing them in a local Chroma vector database.
The chunks
you created from splitting the Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks paper recursively have been pre-loaded.
Creating and using an OpenAI API key is not required in this exercise. You can leave the <OPENAI_API_TOKEN>
placeholder, which will send valid requests to the OpenAI API.
Este exercício faz parte do curso
Retrieval Augmented Generation (RAG) with LangChain
Instruções do exercício
- Initialize the default embedding model from OpenAI.
- Embed the document
chunks
usingembedding_model
and store them in a Chroma vector database.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Initialize the OpenAI embedding model
embedding_model = ____(api_key="", model='text-embedding-3-small')
# Create a Chroma vector store and embed the chunks
vector_store = ____