Hi, I am quite new to API’s so please be understanding. So below code works fine (when my key is in as well as real instructions). I want to add code to output intermediate reasoning as well, so each time o1 model “reasons” it produces some output that it does not save or display but it is still there in the background. What do I need to add to my code to see that output displayed as it produces it?
from openai import OpenAI
def main():
client = OpenAI(api_key='mykey')
instructions_string = """sample instructions
"""
while True:
comment = input("Enter your question: ")
response = client.chat.completions.create(
model="o1",
messages=[
{"role": "system", "content": instructions_string},
{"role": "user", "content": comment}
]
)
answer = dict(response)['choices'][0].message.content
print(f"Bot's response: {answer}")
repeat = input("Would you like to ask another question? (yes/no): ").lower()
if repeat != 'yes':
print("Goodbye!")
break
if __name__ == "__main__":
main()```