We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c7ef317 commit 9cc650cCopy full SHA for 9cc650c
examples/chat_history_backend.py
@@ -0,0 +1,33 @@
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
28
29
+ session.stop()
30
31
32
+if __name__ == "__main__":
33
+ main()
0 commit comments