Skip to content

Commit

Permalink
Added use_text_expansion param
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikep86 committed May 6, 2024
1 parent 75830d5 commit bc116e3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions so_semantic_text/operations/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@
"param-source": "semantic-search",
"size": {{ semantic_search_page_size | default(20) | int }},
"use_pipelines": {{ p_use_pipelines | lower }},
"use_text_expansion": {{ p_use_text_expansion | lower }},
"model_id": "{{ p_inference_model_id }}"
}
1 change: 1 addition & 0 deletions so_semantic_text/track.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{% set p_task_type = (task_type | default("sparse_embedding")) %}
{% set p_calculate_body_vector = (calculate_body_vector | default(false)) %}
{% set p_enable_search = (enable_search | default(false)) %}
{% set p_use_text_expansion = (use_text_expansion | default(false)) %}

{
"version": 2,
Expand Down
14 changes: 14 additions & 0 deletions so_semantic_text/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ def params(self):
}
}
}
elif self._params["use_text_expansion"]:
es_query = {
"nested": {
"path": "title_semantic.inference.chunks",
"query": {
"text_expansion": {
"title_semantic.inference.chunks.embeddings": {
"model_id": self._params["model_id"],
"model_text": query
}
}
}
}
}
else:
es_query = {
"semantic": {
Expand Down

0 comments on commit bc116e3

Please sign in to comment.