You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"this method requires either one positional or one keyword argument only"
1110
+
)
1111
+
super().__init__(parent)
1112
+
self._query=query
1113
+
self._named_query=named_query
1114
+
self._fields: Optional[Tuple[str]] =None
1115
+
self._inference_id: Optional[str] =None
1116
+
1117
+
defon(self, *fields) ->"Rerank":
1118
+
self._fields=fields
1119
+
returnself
1120
+
1121
+
defwith_(self, inference_id: str) ->"Rerank":
1122
+
"""Continuation of the `COMPLETION` command.
1123
+
1124
+
:param inference_id: The ID of the inference endpoint to use for the task. The
1125
+
inference endpoint must be configured with the completion
1126
+
task type.
1127
+
"""
1128
+
self._inference_id=inference_id
1129
+
returnself
1130
+
1131
+
def_render_internal(self) ->str:
1132
+
ifself._fieldsisNone:
1133
+
raiseValueError("The rerank command requires one or more fields to rerank on")
1134
+
ifself._inference_idisNone:
1135
+
raiseValueError("The completion command requires an inference ID")
1136
+
with_= {"inference_id": self._inference_id}
1137
+
ifself._named_query:
1138
+
column=list(self._named_query.keys())[0]
1139
+
query=list(self._named_query.values())[0]
1140
+
returnf"RERANK {self._format_id(column)} = {json.dumps(query)} ON {', '.join([self._format_id(field) forfieldinself._fields])} WITH {json.dumps(with_)}"
1141
+
else:
1142
+
print('***', self._format_expr(self._query[0]))
1143
+
returnf"RERANK {json.dumps(self._query[0])} ON {', '.join([self._format_id(field) forfieldinself._fields])} WITH {json.dumps(with_)}"
1144
+
1049
1145
classSample(ESQLBase):
1050
1146
"""Implementation of the ``SAMPLE`` processing command.
0 commit comments