83
83
def stream_answer_objects (
84
84
query_req : DirectQARequest ,
85
85
user : User | None ,
86
- temporary_persona : Persona | None ,
87
86
# These need to be passed in because in Web UI one shot flow,
88
87
# we can have much more document as there is no history.
89
88
# For Slack flow, we need to save more tokens for the thread context
@@ -99,6 +98,7 @@ def stream_answer_objects(
99
98
retrieval_metrics_callback : (
100
99
Callable [[RetrievalMetricsContainer ], None ] | None
101
100
) = None ,
101
+ temporary_persona : Persona | None = None ,
102
102
rerank_metrics_callback : Callable [[RerankMetricsContainer ], None ] | None = None ,
103
103
) -> AnswerObjectIterator :
104
104
"""Streams in order:
@@ -184,33 +184,27 @@ def stream_answer_objects(
184
184
max_tokens = max_document_tokens ,
185
185
)
186
186
187
- contains_tool = True
188
187
if temporary_persona :
189
- contains_tool = False
190
188
for tool in temporary_persona .tools :
191
189
if tool .in_code_tool_id == "SearchTool" :
192
- contains_tool = True
190
+ pass
193
191
194
- search_tool = (
195
- SearchTool (
196
- db_session = db_session ,
197
- user = user ,
198
- evaluation_type = LLMEvaluationType .SKIP
199
- if DISABLE_LLM_DOC_RELEVANCE
200
- else query_req .evaluation_type ,
201
- persona = persona ,
202
- retrieval_options = query_req .retrieval_options ,
203
- prompt_config = prompt_config ,
204
- llm = llm ,
205
- fast_llm = fast_llm ,
206
- pruning_config = document_pruning_config ,
207
- bypass_acl = bypass_acl ,
208
- chunks_above = query_req .chunks_above ,
209
- chunks_below = query_req .chunks_below ,
210
- full_doc = query_req .full_doc ,
211
- )
212
- if contains_tool
213
- else None
192
+ search_tool = SearchTool (
193
+ db_session = db_session ,
194
+ user = user ,
195
+ evaluation_type = LLMEvaluationType .SKIP
196
+ if DISABLE_LLM_DOC_RELEVANCE
197
+ else query_req .evaluation_type ,
198
+ persona = persona ,
199
+ retrieval_options = query_req .retrieval_options ,
200
+ prompt_config = prompt_config ,
201
+ llm = llm ,
202
+ fast_llm = fast_llm ,
203
+ pruning_config = document_pruning_config ,
204
+ bypass_acl = bypass_acl ,
205
+ chunks_above = query_req .chunks_above ,
206
+ chunks_below = query_req .chunks_below ,
207
+ full_doc = query_req .full_doc ,
214
208
)
215
209
216
210
answer_config = AnswerStyleConfig (
@@ -230,9 +224,8 @@ def stream_answer_objects(
230
224
ForceUseTool (
231
225
tool_name = search_tool .name ,
232
226
args = {"query" : rephrased_query },
227
+ force_use = True ,
233
228
)
234
- if search_tool
235
- else None
236
229
),
237
230
# for now, don't use tool calling for this flow, as we haven't
238
231
# tested quotes with tool calling too much yet
0 commit comments