File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -235,7 +235,13 @@ def make_tools(self) -> list[Tool]:
235
235
embedding_model = self ._embedding_model ,
236
236
)
237
237
238
- def make_initial_state (self ) -> EnvironmentState :
238
+ async def _reset_docs (self ) -> None :
239
+ """Hook to reset the docs when creating the initial state."""
240
+ self ._docs .clear_docs ()
241
+
242
+ async def make_initial_state (self ) -> EnvironmentState :
243
+ await self ._reset_docs ()
244
+
239
245
status_fn = None
240
246
241
247
if ClinicalTrialsSearch .TOOL_FN_NAME in (
@@ -264,8 +270,7 @@ async def reset(self) -> tuple[list[Message], list[Tool]]:
264
270
# NOTE: don't build the index here, as sometimes we asyncio.gather over this
265
271
# method, and our current design (as of v5.0.10) could hit race conditions
266
272
# because index building does not use file locks
267
- self ._docs .clear_docs ()
268
- self .state , self .tools = self .make_initial_state (), self .make_tools ()
273
+ self .state , self .tools = (await self .make_initial_state ()), self .make_tools ()
269
274
return (
270
275
[
271
276
Message (
You can’t perform that action at this time.
0 commit comments