@@ -18,23 +18,23 @@ npm install @e2b/code-interpreter
1818### Minimal example with the sharing context  
1919
2020``` js 
21- import  { CodeInterpreter  } from  ' @e2b/code-interpreter' 
21+ import  { Sandbox  } from  ' @e2b/code-interpreter' 
2222
23- const  sandbox  =  await  CodeInterpreter .create ()
24- await  sandbox .notebook . execCell (' x = 1' 
23+ const  sandbox  =  await  Sandbox .create ()
24+ await  sandbox .runCode (' x = 1' 
2525
26- const  execution  =  await  sandbox .notebook . execCell (' x+=1; x' 
26+ const  execution  =  await  sandbox .runCode (' x+=1; x' 
2727console .log (execution .text ) //  outputs 2
2828
29- await  sandbox .close ()
29+ await  sandbox .kill ()
3030``` 
3131
3232### Get charts and any display-able data  
3333
3434``` js 
35- import  { CodeInterpreter  } from  ' @e2b/code-interpreter' 
35+ import  { Sandbox  } from  ' @e2b/code-interpreter' 
3636
37- const  sandbox  =  await  CodeInterpreter .create ()
37+ const  sandbox  =  await  Sandbox .create ()
3838
3939const  code  =  ` 
4040import matplotlib.pyplot as plt 
@@ -48,20 +48,20 @@ plt.show()
4848` 
4949
5050//  you can install dependencies in "jupyter notebook style"
51- await  sandbox .notebook . execCell (' !pip install matplotlib' 
51+ await  sandbox .runCode (' !pip install matplotlib' 
5252
53- const  execution  =  await  sandbox .notebook . execCell (code)
53+ const  execution  =  await  sandbox .runCode (code)
5454
5555//  this contains the image data, you can e.g. save it to file or send to frontend
5656execution .results [0 ].png 
5757
58- await  sandbox .close ()
58+ await  sandbox .kill ()
5959``` 
6060
6161### Streaming code output  
6262
6363``` js 
64- import  { CodeInterpreter  } from  ' @e2b/code-interpreter' 
64+ import  { Sandbox  } from  ' @e2b/code-interpreter' 
6565
6666const  code  =  ` 
6767import time 
@@ -75,13 +75,13 @@ time.sleep(3)
7575print("world") 
7676` 
7777
78- const  sandbox  =  await  CodeInterpreter .create ()
78+ const  sandbox  =  await  Sandbox .create ()
7979
80- await  sandbox .notebook . execCell (code, {
80+ await  sandbox .runCode (code, {
8181  onStdout :  (out ) =>  console .log (out),
8282  onStderr :  (outErr ) =>  console .error (outErr),
8383  onResult :  (result ) =>  console .log (result .text ),
8484})
8585
86- await  sandbox .close ()
86+ await  sandbox .kill ()
8787``` 
0 commit comments