starfriend commited on
Commit
a4266f7
·
verified ·
1 Parent(s): 5fc889f

Update metadata_search/research_synthesis.py

Browse files
Files changed (1) hide show
  1. metadata_search/research_synthesis.py +31 -31
metadata_search/research_synthesis.py CHANGED
@@ -214,40 +214,40 @@ def _research_generate_answer(
214
  max_new_tokens,
215
  )
216
 
217
- # _generate_answer normally calls an imported agent_answer function.
218
- # Clone agent_answer and its run_agent dependency so the research-only
219
- # token override reaches the actual /agent_run call.
220
- original_agent_answer = generate_globals.get("agent_answer")
221
-
222
- if isinstance(original_agent_answer, types.FunctionType):
223
- agent_globals = _override_token_globals(
224
- original_agent_answer.__globals__,
225
- max_new_tokens,
226
- )
227
-
228
- # agent_answer() calls run_agent(), and run_agent() is where
229
- # WATERSCOPE_MAX_TOKENS is actually read.
230
- original_run_agent = agent_globals.get("run_agent")
231
-
232
- if isinstance(original_run_agent, types.FunctionType):
233
- run_agent_globals = _override_token_globals(
234
- original_run_agent.__globals__,
235
  max_new_tokens,
236
  )
237
-
238
- cloned_run_agent = _copy_function(
239
- original_run_agent,
240
- run_agent_globals,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  )
242
-
243
- agent_globals["run_agent"] = cloned_run_agent
244
-
245
- cloned_agent_answer = _copy_function(
246
- original_agent_answer,
247
- agent_globals,
248
- )
249
-
250
- generate_globals["agent_answer"] = cloned_agent_answer
251
 
252
 
253
  cloned_generate = _copy_function(
 
214
  max_new_tokens,
215
  )
216
 
217
+ # _generate_answer normally calls an imported agent_answer function.
218
+ # Clone agent_answer and its run_agent dependency so the research-only
219
+ # token override reaches the actual /agent_run call.
220
+ original_agent_answer = generate_globals.get("agent_answer")
221
+
222
+ if isinstance(original_agent_answer, types.FunctionType):
223
+ agent_globals = _override_token_globals(
224
+ original_agent_answer.__globals__,
 
 
 
 
 
 
 
 
 
 
225
  max_new_tokens,
226
  )
227
+
228
+ # agent_answer() calls run_agent(), and run_agent() is where
229
+ # WATERSCOPE_MAX_TOKENS is actually read.
230
+ original_run_agent = agent_globals.get("run_agent")
231
+
232
+ if isinstance(original_run_agent, types.FunctionType):
233
+ run_agent_globals = _override_token_globals(
234
+ original_run_agent.__globals__,
235
+ max_new_tokens,
236
+ )
237
+
238
+ cloned_run_agent = _copy_function(
239
+ original_run_agent,
240
+ run_agent_globals,
241
+ )
242
+
243
+ agent_globals["run_agent"] = cloned_run_agent
244
+
245
+ cloned_agent_answer = _copy_function(
246
+ original_agent_answer,
247
+ agent_globals,
248
  )
249
+
250
+ generate_globals["agent_answer"] = cloned_agent_answer
 
 
 
 
 
 
 
251
 
252
 
253
  cloned_generate = _copy_function(