ComenzarEmpieza gratis

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 ejercicio forma parte del curso

Retrieval Augmented Generation (RAG) with LangChain

Ver curso

Instrucciones del ejercicio

  • Initialize the default embedding model from OpenAI.
  • Embed the document chunks using embedding_model and store them in a Chroma vector database.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# 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 = ____
Editar y ejecutar código