Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vespa schema changes for query control & general quality of life #163

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
20 changes: 6 additions & 14 deletions tests/local_vespa/test_app/schemas/document_passage.sd
Original file line number Diff line number Diff line change
Expand Up @@ -197,27 +197,19 @@ schema document_passage {
rank-profile hybrid inherits default {
inputs {
query(query_embedding) tensor<float>(x[768])
query(passage_bm25_weight) double: 1.0
query(passage_closeness_weight) double: 1.0
}
function text_score() {
expression: attribute(passage_weight) * (bm25(text_block) + closeness(text_embedding))
expression: attribute(passage_weight) * (query(passage_bm25_weight) * bm25(text_block) + query(passage_closeness_weight) * closeness(text_embedding))
}
first-phase {
expression: text_score()
}
summary-features: text_score() bm25(text_block) closeness(text_embedding)
}

rank-profile hybrid_custom_weight inherits default {
inputs {
query(query_embedding) tensor<float>(x[768])
query(bm25_weight) double
}
function text_score() {
expression: attribute(passage_weight) * (query(bm25_weight) * bm25(text_block) + closeness(text_embedding))
}
first-phase {
expression: text_score()
}
summary-features: text_score() bm25(text_block) closeness(text_embedding)

rank-profile hybrid_no_embedding inherits hybrid {
}

}
40 changes: 7 additions & 33 deletions tests/local_vespa/test_app/schemas/family_document.sd
Original file line number Diff line number Diff line change
Expand Up @@ -201,53 +201,27 @@ schema family_document {
rank-profile hybrid inherits default {
inputs {
query(query_embedding) tensor<float>(x[768])
query(description_bm25_weight) double: 1.0
query(description_closeness_weight) double: 1.0
}
function name_score() {
expression: attribute(name_weight) * bm25(family_name_index)
expression: bm25(family_name_index)
}
function description_score() {
expression: attribute(description_weight) * (bm25(family_description_index) + closeness(family_description_embedding))
expression: query(description_bm25_weight) * bm25(family_description_index) + query(descriptione_closeness_weight) * closeness(family_description_embedding)
}
first-phase {
expression: name_score() + description_score()
expression: (attribute(name_weight) * name_score()) + (attribute(description_weight) * description_score())
}
summary-features: name_score() description_score()
}

rank-profile hybrid_no_description_embedding inherits default {
rank-profile hybrid_no_description_embedding inherits hybrid {
inputs {
query(query_embedding) tensor<float>(x[768])
}
function name_score() {
expression: attribute(name_weight) * bm25(family_name_index)
query(description_closeness_weight) double: 0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting my head around this, does setting this to 0.0 make it have no effect?

}
function description_score() {
expression: attribute(description_weight) * bm25(family_description_index)
}
first-phase {
expression: name_score() + description_score()
}
summary-features: name_score() description_score()
}

rank-profile hybrid_custom_weight inherits default {
inputs {
query(query_embedding) tensor<float>(x[768])
query(bm25_weight) double
}
function name_score() {
expression: attribute(name_weight) * bm25(family_name_index)
}
function description_score() {
expression: attribute(description_weight) * bm25(family_description_index)
}
first-phase {
expression: name_score() + description_score()
}
summary-features: name_score() description_score()
}


document-summary search_summary {
summary family_name {}
summary family_description {}
Expand Down