File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ import os
2
+
3
+ os .environ ["HISTORY_BACKEND" ] = "redis"
4
+ os .environ ["REDIS_HOST" ] = "redis://localhost:6379"
5
+
6
+ from codeinterpreterapi import CodeInterpreterSession # noqa: E402
7
+
8
+
9
+ def main ():
10
+ session_id = None
11
+
12
+ session = CodeInterpreterSession ()
13
+ session .start ()
14
+
15
+ print ("Session ID:" , session .session_id )
16
+ session_id = session .session_id
17
+
18
+ response = session .generate_response_sync ("Plot the bitcoin chart of 2023 YTD" )
19
+ response .show ()
20
+
21
+ del session
22
+
23
+ assert session_id is not None
24
+ session = CodeInterpreterSession .from_id (session_id )
25
+
26
+ response = session .generate_response_sync ("Now for the last 5 years" )
27
+ response .show ()
28
+
29
+ session .stop ()
30
+
31
+
32
+ if __name__ == "__main__" :
33
+ main ()
You can’t perform that action at this time.
0 commit comments