Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to initialize a FAISS vector store.
Agentic AI
from langchain.vectorstores import FAISS vector_store = FAISS.from_texts(texts, embeddings, index_factory=[1])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Pinecone' or 'Chroma' as FAISS index factory names.
Leaving the index_factory parameter empty.
✗ Incorrect
FAISS uses index factories like "Flat" to create a simple vector index. "Pinecone" and "Chroma" are different vector store types, not FAISS index factories.
2fill in blank
mediumComplete the code to create a Chroma vector store with a persist directory.
Agentic AI
from langchain.vectorstores import Chroma vector_store = Chroma.from_texts(texts, embeddings, persist_directory=[1])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing None or invalid paths to persist_directory.
Using paths meant for other vector stores like FAISS or Pinecone.
✗ Incorrect
Chroma vector store uses a directory path string for persist_directory to save the index. './chroma_db' is a valid local folder path.
3fill in blank
hardFix the error in the Pinecone initialization code by completing the missing parameter.
Agentic AI
import pinecone pinecone.init(api_key=[1], environment="us-west1-gcp")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing None or numeric values as api_key.
Confusing environment names with API keys.
✗ Incorrect
Pinecone requires a valid API key string to initialize. The placeholder 'your-pinecone-api-key' should be replaced with your actual key.
4fill in blank
hardFill both blanks to create a FAISS vector store and save it to disk.
Agentic AI
from langchain.vectorstores import FAISS vector_store = FAISS.from_texts(texts, embeddings, index_factory=[1]) vector_store.[2]("faiss_index")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect method names like 'save' or 'save_local_index'.
Using wrong index factory names.
✗ Incorrect
FAISS uses "Flat" as an index factory for exact search. The method to save the index locally is 'save_local'.
5fill in blank
hardFill all three blanks to create a Pinecone vector store client with index name and namespace.
Agentic AI
import pinecone pinecone.init(api_key=[1], environment=[2]) index = pinecone.Index(name=[3])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up environment and index name strings.
Using invalid API key formats.
✗ Incorrect
To use Pinecone, you initialize with your API key and environment string, then create an Index object with the index name.