Shroominic commited on
Commit
de53269
·
1 Parent(s): abbbdd9

⬆️ update start/stop interface

Browse files
Files changed (1) hide show
  1. codeinterpreterapi/session.py +7 -7
codeinterpreterapi/session.py CHANGED
@@ -26,13 +26,10 @@ class CodeInterpreterSession:
26
  self.agent_executor: AgentExecutor = self._agent_executor()
27
  self.input_files: list[File] = []
28
  self.output_files: list[File] = []
29
-
30
- async def _init(self) -> None:
31
  await self.codebox.astart()
32
 
33
- async def _close(self) -> None:
34
- await self.codebox.astop()
35
-
36
  def _tools(self) -> list[StructuredTool]:
37
  return [
38
  StructuredTool(
@@ -185,9 +182,12 @@ class CodeInterpreterSession:
185
  "Please try again or restart the session."
186
  )
187
 
 
 
 
188
  async def __aenter__(self) -> "CodeInterpreterSession":
189
- await self._init()
190
  return self
191
 
192
  async def __aexit__(self, exc_type, exc_value, traceback) -> None:
193
- await self._close()
 
26
  self.agent_executor: AgentExecutor = self._agent_executor()
27
  self.input_files: list[File] = []
28
  self.output_files: list[File] = []
29
+
30
+ async def astart(self) -> None:
31
  await self.codebox.astart()
32
 
 
 
 
33
  def _tools(self) -> list[StructuredTool]:
34
  return [
35
  StructuredTool(
 
182
  "Please try again or restart the session."
183
  )
184
 
185
+ async def astop(self) -> None:
186
+ await self.codebox.astop()
187
+
188
  async def __aenter__(self) -> "CodeInterpreterSession":
189
+ await self.astart()
190
  return self
191
 
192
  async def __aexit__(self, exc_type, exc_value, traceback) -> None:
193
+ await self.astop()