Home / GenAI Engineer practice test / Assembling and Deploying Applications / Question

Databricks Generative AI Engineer Associate · free practice question

A Python application needs to query a Databricks Vector Search index on a standard endpoint using its SDK. The application must retrieve a maximum of five…

Exam-style question on Assembling and Deploying Applications from the free GenAI Engineer practice test, with the answer and a full explanation below.

Updated November 11, 2026

Assembling and Deploying Applications

A Python application needs to query a Databricks Vector Search index on a standard endpoint using its SDK. The application must retrieve a maximum of five relevant items. A critical condition is that the retrieved items must also have their 'status' field equal to 'approved'. Which SDK method call correctly achieves these requirements?

  1. Aindex.similarity_search(query_text='customer query', columns=['id', 'text'], num_results=5, query_type='HYBRID')
  2. Bindex.similarity_search(query_text='customer query', columns=['id', 'text'], num_results=5, filters={'status': 'approved'})
  3. Cindex.similarity_search(query_text='customer query', columns=['id', 'text'], num_results=5, where_clause="status = 'approved'")
  4. Dindex.similarity_search(query_text='customer query', columns=['id', 'text'], top_k=5, metadata_filter={'status': 'approved'})
Answer & explanation

Correct answer: B

WHY B is correct: The Databricks Vector Search Python SDK's similarity_search() method accepts num_results for the result count limit and a filters parameter that takes a dictionary of column-value pairs for metadata filtering. {'status': 'approved'} restricts results to documents whose 'status' column equals 'approved'.

WHY NOT A: This call is missing the status filter. It will return the top-5 most similar documents regardless of their status column value, potentially returning non-approved documents.

WHY NOT C: where_clause is not a parameter in the Databricks Vector Search SDK's similarity_search() method. Filters are always passed through filters: a dictionary on standard endpoints, or a SQL-like filter string on storage-optimized endpoints.

WHY NOT D: top_k and metadata_filter are not the correct parameter names in the Databricks Vector Search SDK. The correct parameters are num_results and filters respectively. Calling the method with these names fails with an unexpected-keyword error.

Take the full GenAI Engineer practice test free →

Would you pass today?

This question is one of 45 in the free, timed Databricks Generative AI Engineer Associate practice test. Take it and get a section-by-section score.

Start the free test →