Bird
0
0

Which of the following is the correct way to initialize a Chroma vector store with an embedding function named embed and collection name my_collection?

easy📝 Syntax Q12 of 15
LangChain - Embeddings and Vector Stores
Which of the following is the correct way to initialize a Chroma vector store with an embedding function named embed and collection name my_collection?
Astore = Chroma(embedding=embed, collection='my_collection')
Bstore = Chroma(collection='my_collection', embed=embedding_function)
Cstore = Chroma('my_collection', embed_function=embed)
Dstore = Chroma(embedding_function=embed, collection_name='my_collection')
Step-by-Step Solution
Solution:
  1. Step 1: Check parameter names for Chroma initialization

    The correct parameters are embedding_function and collection_name.
  2. Step 2: Match correct syntax

    store = Chroma(embedding_function=embed, collection_name='my_collection') uses embedding_function=embed and collection_name='my_collection', which is correct.
  3. Final Answer:

    store = Chroma(embedding_function=embed, collection_name='my_collection') -> Option D
  4. Quick Check:

    embedding_function + collection_name = store = Chroma(embedding_function=embed, collection_name='my_collection') [OK]
Quick Trick: Use embedding_function and collection_name keys exactly [OK]
Common Mistakes:
  • Using wrong parameter names like embed or collection
  • Passing parameters in wrong order without keywords
  • Confusing embedding_function with embed_function

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes