Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to insert a vector into the database.
Prompt Engineering / GenAI
db.[1](vector_id='vec1', vector=[0.1, 0.2, 0.3])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'delete' instead of 'insert' will remove data instead of adding.
Using 'update' tries to change existing data, not add new.
Using 'search' is for finding vectors, not adding.
✗ Incorrect
The 'insert' method is used to add a new vector to the database.
2fill in blank
mediumComplete the code to retrieve a vector by its ID.
Prompt Engineering / GenAI
result = db.[1](vector_id='vec1')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'insert' tries to add data instead of retrieving.
Using 'delete' removes data instead of fetching.
Using 'update' modifies data instead of fetching.
✗ Incorrect
The 'get' method retrieves a vector by its ID from the database.
3fill in blank
hardFix the error in the code to update a vector's values.
Prompt Engineering / GenAI
db.[1](vector_id='vec1', vector=[0.4, 0.5, 0.6])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'insert' will add a new vector instead of updating.
Using 'get' only retrieves data, does not change it.
Using 'search' finds vectors but does not update.
✗ Incorrect
The 'update' method changes the vector data for the given ID.
4fill in blank
hardFill both blanks to delete a vector and confirm its removal.
Prompt Engineering / GenAI
db.[1](vector_id='vec2') exists = db.[2](vector_id='vec2')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'insert' instead of 'delete' will add data instead of removing.
Using 'update' does not remove data.
Using 'insert' or 'update' to check existence is incorrect.
✗ Incorrect
Use 'delete' to remove the vector and 'get' to check if it still exists (should return None or similar).
5fill in blank
hardFill all three blanks to perform a search, update a vector, and then retrieve it.
Prompt Engineering / GenAI
results = db.[1](query_vector=[0.1, 0.2, 0.3], top_k=5) db.[2](vector_id='vec3', vector=[0.7, 0.8, 0.9]) updated_vector = db.[3](vector_id='vec3')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'insert' instead of 'search' will add data instead of finding.
Using 'get' instead of 'update' will not change the vector.
Using 'delete' in any step will remove data unexpectedly.
✗ Incorrect
First, 'search' finds similar vectors; then 'update' changes the vector; finally, 'get' retrieves the updated vector.