Skip to content

Commit

Permalink
🔖 new example chat history backend
Browse files Browse the repository at this point in the history
  • Loading branch information
shroominic committed Aug 9, 2023
1 parent c7ef317 commit 9cc650c
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions examples/chat_history_backend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import os

os.environ["HISTORY_BACKEND"] = "redis"
os.environ["REDIS_HOST"] = "redis://localhost:6379"

from codeinterpreterapi import CodeInterpreterSession # noqa: E402


def main():
session_id = None

session = CodeInterpreterSession()
session.start()

print("Session ID:", session.session_id)
session_id = session.session_id

response = session.generate_response_sync("Plot the bitcoin chart of 2023 YTD")
response.show()

del session

assert session_id is not None
session = CodeInterpreterSession.from_id(session_id)

response = session.generate_response_sync("Now for the last 5 years")
response.show()

session.stop()


if __name__ == "__main__":
main()

0 comments on commit 9cc650c

Please sign in to comment.