Skip to content
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: 2 additions & 3 deletions chatgpt/ChatGPT_Flask_Demo_v2/ChatGPT_Flask_Demo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
import openai
import tiktoken

openai.api_key = os.getenv("OPENAI_API_KEY")
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.organization = os.getenv("OPENAI_ORGANIZATION")

system_message = {"role": "system", "content": "You are a helpful assistant."}
max_response_tokens = 250
token_limit= 4096
conversation=[]
conversation.append(system_message)
conversation = [system_message]
Comment on lines -6 to +12
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 6-13 refactored with the following changes:


def num_tokens_from_messages(messages, model="gpt-3.5-turbo-0301"):
encoding = tiktoken.encoding_for_model(model)
Expand Down