Turns of debug print.
Full context is no longer printed to console each time, now optional for debugging.pull/10/head
parent
2cca2e78ef
commit
048ca5dec7
|
@ -25,7 +25,7 @@ def create_chat_message(role, content):
|
||||||
"""
|
"""
|
||||||
return {"role": role, "content": content}
|
return {"role": role, "content": content}
|
||||||
|
|
||||||
def chat_with_ai(prompt, user_input, full_message_history, permanent_memory, token_limit):
|
def chat_with_ai(prompt, user_input, full_message_history, permanent_memory, token_limit, debug = False):
|
||||||
"""
|
"""
|
||||||
Interact with the OpenAI API, sending the prompt, user input, message history, and permanent memory.
|
Interact with the OpenAI API, sending the prompt, user input, message history, and permanent memory.
|
||||||
|
|
||||||
|
@ -44,13 +44,14 @@ def chat_with_ai(prompt, user_input, full_message_history, permanent_memory, tok
|
||||||
current_context.extend([create_chat_message("user", user_input)])
|
current_context.extend([create_chat_message("user", user_input)])
|
||||||
|
|
||||||
# Debug print the current context
|
# Debug print the current context
|
||||||
print("---------------------------")
|
if debug:
|
||||||
print("Current Context:")
|
print("------------ CONTEXT SENT TO AI ---------------")
|
||||||
for message in current_context:
|
for message in current_context:
|
||||||
# Skip printing the prompt
|
# Skip printing the prompt
|
||||||
if message["role"] == "system" and message["content"] == prompt:
|
if message["role"] == "system" and message["content"] == prompt:
|
||||||
continue
|
continue
|
||||||
print(f"{message['role'].capitalize()}: {message['content']}")
|
print(f"{message['role'].capitalize()}: {message['content']}")
|
||||||
|
print("----------- END OF CONTEXT ----------------")
|
||||||
|
|
||||||
response = openai.ChatCompletion.create(
|
response = openai.ChatCompletion.create(
|
||||||
model="gpt-4",
|
model="gpt-4",
|
||||||
|
|
Loading…
Reference in New Issue