includes instructions for embedding using the hf-embedder.Now we can query with a custom query:query = "What did the president say about Ketanji Brown Jackson"nearest_neighbor_expression = "{targetHits: 4}nearestNeighbor(internalembedding, query_embedding)"custom_query = {    "yql": f"select * from sources * where {nearest_neighbor_expression}",    "input.query(query_embedding)": f"embed(hf-embedder, \"{query}\")",    "ranking": "internal_similarity",    "hits": 4}results = db.similarity_search_with_score(query, custom_query=custom_query)# results[0][0].metadata["id"], "id:testapp:testapp::32")# results[0][1] ~= 0.630Note that the query here includes an embed instruction to embed the query
using the same model as for the documents.Approximate nearest neighbor‚ÄãIn all of the above examples, we've used exact nearest neighbor to
find results. However, for large collections of documents this is
not feasible as one has to scan through all documents to find the
best matches. To avoid this, we can use
approximate nearest neighbors.First, we can change the embedding field to create a HNSW index:from vespa.package import HNSWapp_package.schema.add_fields(    Field(name="embedding", type="tensor<float>(x[384])",          indexing=["attribute", "summary", "index"],          ann=HNSW(distance_metric="angular", max_links_per_node=16, neighbors_to_explore_at_insert=200)          ))This creates a HNSW index on the embedding data which allows for efficient
searching. With this set, we can easily search using ANN by setting
Vespa is a fully featured search engine and vector database. It supports vector search (ANN), lexical search, and search in structured data, all in the same query.
Vespa is a fully featured search engine and vector database. It supports vector search (ANN), lexical search, and search in structured data, all in the same query. ->: includes instructions for embedding using the hf-embedder.Now we can query with a custom query:query = "What did the president say about Ketanji Brown Jackson"nearest_neighbor_expression = "{targetHits: 4}nearestNeighbor(internalembedding, query_embedding)"custom_query = {    "yql": f"select * from sources * where {nearest_neighbor_expression}",    "input.query(query_embedding)": f"embed(hf-embedder, \"{query}\")",    "ranking": "internal_similarity",    "hits": 4}results = db.similarity_search_with_score(query, custom_query=custom_query)# results[0][0].metadata["id"], "id:testapp:testapp::32")# results[0][1] ~= 0.630Note that the query here includes an embed instruction to embed the query
using the same model as for the documents.Approximate nearest neighbor‚ÄãIn all of the above examples, we've used exact nearest neighbor to
find results. However, for large collections of documents this is
not feasible as one has to scan through all documents to find the
best matches. To avoid this, we can use
approximate nearest neighbors.First, we can change the embedding field to create a HNSW index:from vespa.package import HNSWapp_package.schema.add_fields(    Field(name="embedding", type="tensor<float>(x[384])",          indexing=["attribute", "summary", "index"],          ann=HNSW(distance_metric="angular", max_links_per_node=16, neighbors_to_explore_at_insert=200)          ))This creates a HNSW index on the embedding data which allows for efficient
searching. With this set, we can easily search using ANN by setting