0
0
LangChainframework~10 mins

Chroma vector store setup in LangChain - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the Chroma vector store from LangChain.

LangChain
from langchain_community.vectorstores import [1]
Drag options to blanks, or click blank then click option'
AFAISS
BPinecone
CChroma
DWeaviate
Attempts:
3 left
💡 Hint
Common Mistakes
Importing a different vector store like Pinecone or FAISS.
Forgetting to import from langchain.vectorstores.
2fill in blank
medium

Complete the code to create a Chroma vector store instance with an embedding function.

LangChain
vectordb = Chroma(embedding_function=[1])
Drag options to blanks, or click blank then click option'
AFAISS()
BOpenAI()
CChroma()
DOpenAIEmbeddings()
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the vector store class instead of an embedding function.
Using the OpenAI client instead of embeddings.
3fill in blank
hard

Fix the error in the code to specify the persist directory for Chroma storage.

LangChain
vectordb = Chroma(embedding_function=OpenAIEmbeddings(), persist_directory=[1])
Drag options to blanks, or click blank then click option'
A123
B'./db'
CNone
DTrue
Attempts:
3 left
💡 Hint
Common Mistakes
Passing a number or boolean instead of a string path.
Using None which disables persistence.
4fill in blank
hard

Fill both blanks to create a Chroma vector store with embeddings and persist directory.

LangChain
vectordb = Chroma(embedding_function=[1], persist_directory=[2])
Drag options to blanks, or click blank then click option'
AOpenAIEmbeddings()
B'./chroma_db'
C'./data'
DOpenAI()
Attempts:
3 left
💡 Hint
Common Mistakes
Using OpenAI() instead of OpenAIEmbeddings().
Passing a wrong directory path.
5fill in blank
hard

Fill all three blanks to initialize Chroma with embeddings, persist directory, and collection name.

LangChain
vectordb = Chroma(embedding_function=[1], persist_directory=[2], collection_name=[3])
Drag options to blanks, or click blank then click option'
AOpenAIEmbeddings()
B'./chroma_persist'
C'my_collection'
DOpenAI()
Attempts:
3 left
💡 Hint
Common Mistakes
Using OpenAI() instead of OpenAIEmbeddings().
Passing non-string values for directory or collection name.