distance score. We can query using a custom query:query = "What did the president say about Ketanji Brown Jackson"query_embedding = embedding_function.embed_query(query)nearest_neighbor_expression = "{targetHits: 4}nearestNeighbor(embedding, query_embedding)"custom_query = {    "yql": f"select * from sources * where {nearest_neighbor_expression} and userQuery()",    "query": query,    "type": "weakAnd",    "input.query(query_embedding)": query_embedding,    "ranking": "hybrid",    "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] ~= 2.897Native embedders in Vespa‚ÄãUp until this point we've used an embedding function in Python to provide
embeddings for the texts. Vespa supports embedding function natively, so
you can defer this calculation in to Vespa. One benefit is the ability to use
GPUs when embedding documents if you have a large collections.Please refer to Vespa embeddings
for more information.First, we need to modify our application package:from vespa.package import Component, Parameterapp_package.components = [    Component(id="hf-embedder", type="hugging-face-embedder",        parameters=[            Parameter("transformer-model", {"path": "..."}),            Parameter("tokenizer-model", {"url": "..."}),        ]    )]Field(name="hfembedding", type="tensor<float>(x[384])",      is_document_field=False,      indexing=["input text", "embed hf-embedder", "attribute", "summary"],      attribute=[f"distance-metric: angular"],      )app_package.schema.add_rank_profile(    RankProfile(name="hf_similarity",                first_phase="closeness(field, hfembedding)",                inputs=[("query(query_embedding)", "tensor<float>(x[384])")]                ))Please refer to the embeddings documentation on adding embedder models
and tokenizers to the application. Note that the hfembedding field
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. ->: distance score. We can query using a custom query:query = "What did the president say about Ketanji Brown Jackson"query_embedding = embedding_function.embed_query(query)nearest_neighbor_expression = "{targetHits: 4}nearestNeighbor(embedding, query_embedding)"custom_query = {    "yql": f"select * from sources * where {nearest_neighbor_expression} and userQuery()",    "query": query,    "type": "weakAnd",    "input.query(query_embedding)": query_embedding,    "ranking": "hybrid",    "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] ~= 2.897Native embedders in Vespa‚ÄãUp until this point we've used an embedding function in Python to provide
embeddings for the texts. Vespa supports embedding function natively, so
you can defer this calculation in to Vespa. One benefit is the ability to use
GPUs when embedding documents if you have a large collections.Please refer to Vespa embeddings
for more information.First, we need to modify our application package:from vespa.package import Component, Parameterapp_package.components = [    Component(id="hf-embedder", type="hugging-face-embedder",        parameters=[            Parameter("transformer-model", {"path": "..."}),            Parameter("tokenizer-model", {"url": "..."}),        ]    )]Field(name="hfembedding", type="tensor<float>(x[384])",      is_document_field=False,      indexing=["input text", "embed hf-embedder", "attribute", "summary"],      attribute=[f"distance-metric: angular"],      )app_package.schema.add_rank_profile(    RankProfile(name="hf_similarity",                first_phase="closeness(field, hfembedding)",                inputs=[("query(query_embedding)", "tensor<float>(x[384])")]                ))Please refer to the embeddings documentation on adding embedder models
and tokenizers to the application. Note that the hfembedding field