Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to initialize a Pinecone client with your API key.
Prompt Engineering / GenAI
import pinecone pinecone.init(api_key=[1])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put the API key inside quotes.
Using a variable name instead of the actual key string.
✗ Incorrect
You must provide your Pinecone API key as a string to initialize the client.
2fill in blank
mediumComplete the code to create a new index in Pinecone with dimension 128.
Prompt Engineering / GenAI
pinecone.create_index(name='example-index', dimension=[1])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a dimension that does not match the vector size.
Using a string instead of a number.
✗ Incorrect
The dimension must match the size of your vector embeddings, here 128.
3fill in blank
hardFix the error in the code to query a Pinecone index for the top 3 similar vectors.
Prompt Engineering / GenAI
index = pinecone.Index('example-index') query_result = index.query(queries=[query_vector], top_k=[1])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing '3' as a string instead of integer 3.
Passing a list like [3] instead of an integer.
✗ Incorrect
The top_k parameter must be an integer, not a string or list.
4fill in blank
hardFill both blanks to create a ChromaDB client and add a collection named 'my_collection'.
Prompt Engineering / GenAI
import chromadb client = chromadb.[1]() collection = client.[2]('my_collection')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using get_collection() instead of create_collection() to add a new collection.
Using Collection() instead of Client() to create the client.
✗ Incorrect
You create a ChromaDB client with Client(), then add a collection with create_collection().
5fill in blank
hardFill all three blanks to initialize a Weaviate client, create a schema, and add a data object.
Prompt Engineering / GenAI
import weaviate client = weaviate.Client([1]) schema = { 'classes': [{'class': [2], 'properties': [{'name': 'text', 'dataType': ['string']}]}] } client.schema.[3](schema)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using delete() instead of create() to add the schema.
Using wrong URL or missing quotes.
Using wrong class name or missing quotes.
✗ Incorrect
You connect to Weaviate at the URL, define a class named 'Document', and create the schema with create().