Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Update docs

Vasek Mlejnsky41967283017f
diff --git a/apps/web/src/app/(docs)/docs/code-interpreting/create-charts-visualizations/interactive-charts/page.mdx b/apps/web/src/app/(docs)/docs/code-interpreting/create-charts-visualizations/interactive-charts/page.mdx
index c17bc41bd..09fb42051 100644
--- a/apps/web/src/app/(docs)/docs/code-interpreting/create-charts-visualizations/interactive-charts/page.mdx
+++ b/apps/web/src/app/(docs)/docs/code-interpreting/create-charts-visualizations/interactive-charts/page.mdx
@@ -4,12 +4,12 @@ E2B also allows you to create interactive charts with custom styling.
E2B automatically detects charts when executing Python code with `runCode()` in JavaScript or `run_code()` in Python. The Python code must include Matplotlib charts.
-When a chart is deteted, E2B sends the data of the chart back to the client. You can access the chart in the `execution.results` array where each item is a `Result` object with the `graph` property.
+When a chart is deteted, E2B sends the data of the chart back to the client. You can access the chart in the `execution.results` array where each item is a `Result` object with the `chart` property.
Here's a simple example of bar chart:
<CodeGroup>
```js
-import { Sandbox, BarGraph } from '@e2b/code-interpreter'
+import { Sandbox, BarChart } from '@e2b/code-interpreter'
const code = `
import matplotlib.pyplot as plt
@@ -18,29 +18,29 @@ import matplotlib.pyplot as plt
authors = ['Author A', 'Author B', 'Author C', 'Author D']
sales = [100, 200, 300, 400]
-# Create and customize the bar graph
+# Create and customize the bar chart
plt.figure(figsize=(10, 6))
plt.bar(authors, sales, label='Books Sold', color='blue')
plt.xlabel('Authors')
plt.ylabel('Number of Books Sold')
plt.title('Book Sales by Authors')
-# Display the graph
+# Display the chart
plt.tight_layout()
plt.show()
`
const sandbox = await Sandbox.create()
const result = await sandbox.runCode(code)
-const graph = result.results[0].graph as BarGraph
-
-console.log('Type:', graph.type)
-console.log('Title:', graph.title)
-console.log('X Label:', graph.x_label)
-console.log('Y Label:', graph.y_label)
-console.log('X Unit:', graph.x_unit)
-console.log('Y Unit:', graph.y_unit)
-console.log('Elements:', graph.elements)
+const chart = result.results[0].chart as BarChart
+
+console.log('Type:', chart.type)
+console.log('Title:', chart.title)
+console.log('X Label:', chart.x_label)
+console.log('Y Label:', chart.y_label)
+console.log('X Unit:', chart.x_unit)
+console.log('Y Unit:', chart.y_unit)
+console.log('Elements:', chart.elements)
```
```python
from e2b_code_interpreter import Sandbox
@@ -52,30 +52,30 @@ import matplotlib.pyplot as plt
authors = ['Author A', 'Author B', 'Author C', 'Author D']
sales = [100, 200, 300, 400]
-# Create and customize the bar graph
+# Create and customize the bar char
plt.figure(figsize=(10, 6))
plt.bar(authors, sales, label='Books Sold', color='blue')
plt.xlabel('Authors')
plt.ylabel('Number of Books Sold')
plt.title('Book Sales by Authors')
-# Display the graph
+# Display the chart
plt.tight_layout()
plt.show()
"""
sandbox = Sandbox()
execution = sandbox.run_code(code)
-graph = execution.results[0].graph
-
-print('Type:', graph.type)
-print('Title:', graph.title)
-print('X Label:', graph.x_label)
-print('Y Label:', graph.y_label)
-print('X Unit:', graph.x_unit)
-print('Y Unit:', graph.y_unit)
+chart = execution.results[0].chart
+
+print('Type:', chart.type)
+print('Title:', chart.title)
+print('X Label:', chart.x_label)
+print('Y Label:', chart.y_label)
+print('X Unit:', chart.x_unit)
+print('Y Unit:', chart.y_unit)
print('Elements:')
-for element in graph.elements:
+for element in chart.elements:
print('\n Label:', element.label)
print(' Value:', element.value)
print(' Group:', element.group)
@@ -113,7 +113,7 @@ Elements: [
]
```
```bash {{ language: 'python' }}
-Type: GraphType.BAR
+Type: ChartType.BAR
Title: Book Sales by Authors
X Label: Authors
Y Label: Number of Books Sold
@@ -144,8 +144,15 @@ You can then use this data to create an interactive chart with your favorite cha
---
## Supported intertactive charts
-
The following charts are currently supported:
+- Line chart
+- Bar chart
+- Scatter plot
+- Pie chart
+- Box and whisker plot
+
+
+{/* The following charts are currently supported:
- [Line chart](#line-chart)
- [Bar chart](#bar-chart)
- [Scatter plot](#scatter-plot)
@@ -161,4 +168,4 @@ The following charts are currently supported:
## Pie chart
-## Box and whisker plot
\ No newline at end of file
+## Box and whisker plot */}
\ No newline at end of file
diff --git a/apps/web/src/app/(docs)/docs/code-interpreting/supported-languages/java/page.mdx b/apps/web/src/app/(docs)/docs/code-interpreting/supported-languages/java/page.mdx
new file mode 100644
index 000000000..43461ba39
--- /dev/null
+++ b/apps/web/src/app/(docs)/docs/code-interpreting/supported-languages/java/page.mdx
@@ -0,0 +1,19 @@
+# Run Java code
+Use the `runCode`/`run_code` method to run Java code inside the sandbox.
+You'll need to pass the `language` parameter with value `java`.
+<CodeGroup>
+```js
+import { Sandbox } from '@e2b/code-interpreter'
+
+const sbx = await Sandbox.create()
+const execution = await sbx.runCode('System.out.println("Hello, world!");', { language: 'java' })
+console.log(execution)
+```
+```python
+from e2b_code_interpreter import Sandbox
+
+sbx = Sandbox()
+execution = sbx.run_code('System.out.println("Hello, world!");', { language: 'java' })
+print(execution)
+```
+</CodeGroup>
\ No newline at end of file
diff --git a/apps/web/src/app/(docs)/docs/code-interpreting/supported-languages/page.mdx b/apps/web/src/app/(docs)/docs/code-interpreting/supported-languages/page.mdx
index b1b77a598..41de57c46 100644
--- a/apps/web/src/app/(docs)/docs/code-interpreting/supported-languages/page.mdx
+++ b/apps/web/src/app/(docs)/docs/code-interpreting/supported-languages/page.mdx
@@ -6,6 +6,7 @@ Out of the box E2B Sandbox supports:
- [Python](/docs/code-interpreting/analyze-data/supported-languages/python)
- [JavaScript](/docs/code-interpreting/analyze-data/supported-languages/javascript)
- [R](/docs/code-interpreting/analyze-data/supported-languages/r)
+- [Java](/docs/code-interpreting/analyze-data/supported-languages/java)
- [Bash](/docs/code-interpreting/analyze-data/supported-languages/bash)
<Note>