abox-code-interpreter 0.1.0__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: abox-code-interpreter
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: AgentBox Code Interpreter - Stateful code execution
5
5
  Author: RetailDriver LLC
6
6
  License-Expression: MIT
@@ -11,12 +11,12 @@ Requires-Dist: attrs>=21.3.0
11
11
  Requires-Dist: abox-sdk>=0.1.0,<0.2.0
12
12
  Requires-Python: >=3.10
13
13
  Project-URL: Homepage, https://docs.agentbox.ru/en/sdk/code-interpreter/
14
- Project-URL: Documentation, https://docs.agentbox.ru/en/sdk/api-reference/python/code-interpreter/
14
+ Project-URL: Documentation, https://docs.agentbox.ru/en/sdk-reference/python/code-interpreter/
15
15
  Project-URL: Repository, https://github.com/abox-dev/sdk/tree/main/packages/code-interpreter-python
16
16
  Project-URL: Bug Tracker, https://github.com/abox-dev/sdk/issues
17
17
  Description-Content-Type: text/markdown
18
18
 
19
- <p align="center"><img src="https://raw.githubusercontent.com/abox-dev/sdk/main/readme-assets/agentbox-logo-email.png" alt="AgentBox" width="240"></p>
19
+ <p align="center"><a href="https://agentbox.ru"><img src="https://raw.githubusercontent.com/abox-dev/sdk/main/readme-assets/agentbox-logo-email.png" alt="AgentBox" width="240"></a></p>
20
20
 
21
21
  # `abox-code-interpreter`
22
22
 
@@ -36,4 +36,4 @@ with Sandbox.create() as sandbox:
36
36
  print(execution.text)
37
37
  ```
38
38
 
39
- `AsyncSandbox` provides the equivalent async API. See the [Code Interpreter guide](https://docs.agentbox.ru/en/sdk/code-interpreter/) and [API reference](https://docs.agentbox.ru/en/sdk/api-reference/python/code-interpreter/).
39
+ `AsyncSandbox` provides the equivalent async API. See the [Code Interpreter guide](https://docs.agentbox.ru/en/sdk/code-interpreter/) and [API reference](https://docs.agentbox.ru/en/sdk-reference/python/code-interpreter/).
@@ -1,4 +1,4 @@
1
- <p align="center"><img src="https://raw.githubusercontent.com/abox-dev/sdk/main/readme-assets/agentbox-logo-email.png" alt="AgentBox" width="240"></p>
1
+ <p align="center"><a href="https://agentbox.ru"><img src="https://raw.githubusercontent.com/abox-dev/sdk/main/readme-assets/agentbox-logo-email.png" alt="AgentBox" width="240"></a></p>
2
2
 
3
3
  # `abox-code-interpreter`
4
4
 
@@ -18,4 +18,4 @@ with Sandbox.create() as sandbox:
18
18
  print(execution.text)
19
19
  ```
20
20
 
21
- `AsyncSandbox` provides the equivalent async API. See the [Code Interpreter guide](https://docs.agentbox.ru/en/sdk/code-interpreter/) and [API reference](https://docs.agentbox.ru/en/sdk/api-reference/python/code-interpreter/).
21
+ `AsyncSandbox` provides the equivalent async API. See the [Code Interpreter guide](https://docs.agentbox.ru/en/sdk/code-interpreter/) and [API reference](https://docs.agentbox.ru/en/sdk-reference/python/code-interpreter/).
@@ -61,12 +61,11 @@ class AsyncSandbox(BaseAsyncSandbox):
61
61
 
62
62
  @property
63
63
  def _jupyter_url(self) -> str:
64
- # Honors the `sandbox_url` option and the `AGENTBOX_SANDBOX_URL` environment
65
- # variable, same as the base SDK does for envd requests.
66
- sandbox_url = cast(Optional[str], self.connection_config._sandbox_url)
67
- if sandbox_url:
68
- return sandbox_url
69
- return f"{'http' if self.connection_config.debug else 'https'}://{self.get_host(JUPYTER_PORT)}"
64
+ return self.connection_config.get_sandbox_direct_url(
65
+ self.sandbox_id,
66
+ self.sandbox_domain,
67
+ JUPYTER_PORT,
68
+ )
70
69
 
71
70
  @property
72
71
  def _client(self) -> AsyncClient:
@@ -178,7 +177,7 @@ class AsyncSandbox(BaseAsyncSandbox):
178
177
  async def run_code(
179
178
  self,
180
179
  code: str,
181
- language: Optional[str] = None,
180
+ language: Optional[RunCodeLanguage] = None,
182
181
  context: Optional[Context] = None,
183
182
  on_stdout: Optional[OutputHandlerWithAsync[OutputMessage]] = None,
184
183
  on_stderr: Optional[OutputHandlerWithAsync[OutputMessage]] = None,
@@ -58,12 +58,11 @@ class Sandbox(BaseSandbox):
58
58
 
59
59
  @property
60
60
  def _jupyter_url(self) -> str:
61
- # Honors the `sandbox_url` option and the `AGENTBOX_SANDBOX_URL` environment
62
- # variable, same as the base SDK does for envd requests.
63
- sandbox_url = cast(Optional[str], self.connection_config._sandbox_url)
64
- if sandbox_url:
65
- return sandbox_url
66
- return f"{'http' if self.connection_config.debug else 'https'}://{self.get_host(JUPYTER_PORT)}"
61
+ return self.connection_config.get_sandbox_direct_url(
62
+ self.sandbox_id,
63
+ self.sandbox_domain,
64
+ JUPYTER_PORT,
65
+ )
67
66
 
68
67
  @property
69
68
  def _client(self) -> Client:
@@ -172,7 +171,7 @@ class Sandbox(BaseSandbox):
172
171
  def run_code(
173
172
  self,
174
173
  code: str,
175
- language: Optional[str] = None,
174
+ language: Optional[RunCodeLanguage] = None,
176
175
  context: Optional[Context] = None,
177
176
  on_stdout: Optional[OutputHandler[OutputMessage]] = None,
178
177
  on_stderr: Optional[OutputHandler[OutputMessage]] = None,
@@ -1,3 +1,3 @@
1
- DEFAULT_TEMPLATE = "code-interpreter-v1"
1
+ DEFAULT_TEMPLATE = "code-interpreter"
2
2
  JUPYTER_PORT = 49999
3
3
  DEFAULT_TIMEOUT = 300
@@ -21,10 +21,7 @@ from httpx import Response
21
21
 
22
22
  from .charts import Chart, _deserialize_chart
23
23
 
24
- RunCodeLanguage = Union[
25
- Literal["python", "javascript", "typescript", "r", "java", "bash"],
26
- str,
27
- ]
24
+ RunCodeLanguage = Literal["python", "javascript", "typescript", "js", "ts"]
28
25
 
29
26
  T = TypeVar("T")
30
27
  OutputHandler = Union[Callable[[T], Any],]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "abox-code-interpreter"
3
- version = "0.1.0"
3
+ version = "0.1.2"
4
4
  description = "AgentBox Code Interpreter - Stateful code execution"
5
5
  authors = [{ name = "RetailDriver LLC" }]
6
6
  license = "MIT"
@@ -15,7 +15,7 @@ dependencies = [
15
15
 
16
16
  [project.urls]
17
17
  Homepage = "https://docs.agentbox.ru/en/sdk/code-interpreter/"
18
- Documentation = "https://docs.agentbox.ru/en/sdk/api-reference/python/code-interpreter/"
18
+ Documentation = "https://docs.agentbox.ru/en/sdk-reference/python/code-interpreter/"
19
19
  Repository = "https://github.com/abox-dev/sdk/tree/main/packages/code-interpreter-python"
20
20
  "Bug Tracker" = "https://github.com/abox-dev/sdk/issues"
21
21