|
1 | 1 | import logging |
2 | 2 | import httpx |
3 | 3 |
|
4 | | -from typing import Optional, Dict, overload, Literal, Union, List |
| 4 | +from typing import Optional, Dict, overload, Union, List |
5 | 5 | from httpx import Client |
6 | 6 | from e2b import Sandbox as BaseSandbox, InvalidArgumentException |
7 | 7 |
|
|
13 | 13 | from e2b_code_interpreter.models import ( |
14 | 14 | ExecutionError, |
15 | 15 | Execution, |
| 16 | + RunCodeLanguage, |
16 | 17 | Context, |
17 | 18 | Result, |
18 | 19 | extract_exception, |
@@ -65,11 +66,7 @@ def _client(self) -> Client: |
65 | 66 | def run_code( |
66 | 67 | self, |
67 | 68 | code: str, |
68 | | - language: Union[ |
69 | | - Literal["python", "javascript", "typescript", "r", "java", "bash"], |
70 | | - str, |
71 | | - None, |
72 | | - ] = None, |
| 69 | + language: RunCodeLanguage = None, |
73 | 70 | on_stdout: Optional[OutputHandler[OutputMessage]] = None, |
74 | 71 | on_stderr: Optional[OutputHandler[OutputMessage]] = None, |
75 | 72 | on_result: Optional[OutputHandler[Result]] = None, |
@@ -202,11 +199,7 @@ def run_code( |
202 | 199 | def create_code_context( |
203 | 200 | self, |
204 | 201 | cwd: Optional[str] = None, |
205 | | - language: Union[ |
206 | | - Literal["python", "javascript", "typescript", "r", "java", "bash"], |
207 | | - str, |
208 | | - None, |
209 | | - ] = None, |
| 202 | + language: RunCodeLanguage = None, |
210 | 203 | request_timeout: Optional[float] = None, |
211 | 204 | ) -> Context: |
212 | 205 | """ |
|
0 commit comments