Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added 'time' to imports #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions chatgpt_core.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Note that this file was not purpose-made for the reddit history thing, I use it for other conversation scripts I've made and have removed a bunch of functions that aren't relevant.

import os
import time
import json
import openai
import pandas as pd
Expand All @@ -19,7 +20,7 @@ def __init__(self, instructions="You are a helpful assistant.", model="gpt-3.5-t
self.filename = filename
self.inserts = inserts if inserts else {}
self.messages = pd.DataFrame(columns=["actor", "message", "sendable"])

if filename:
try:
with open(filename, 'r') as f:
Expand Down Expand Up @@ -91,7 +92,7 @@ def generate_response(self, message=None, store_message=True, retries=5):
assistant_message = response.choices[0].message['content']
if store_message:
self.add_message(assistant_message, actor="assistant")

if self.filename:
self.save_chat()

Expand Down