3fbbd7970c
Code Quality / Python Lint & Format (push) Has been cancelled
Code Quality / Python Tests (push) Has been cancelled
Code Quality / JavaScript/TypeScript Lint (advisory) (push) Has been cancelled
Security Scan / CodeQL Analysis (python) (push) Has been cancelled
Security Scan / Dependency Review (push) Has been cancelled
Security Scan / CodeQL Analysis (javascript-typescript) (push) Has been cancelled
30 lines
966 B
Python
30 lines
966 B
Python
from openai import OpenAI
|
|
import os
|
|
from dotenv import load_dotenv
|
|
|
|
# load environment variables from .env file
|
|
load_dotenv()
|
|
|
|
# configure OpenAI service client
|
|
client = OpenAI()
|
|
deployment="gpt-4o-mini"
|
|
|
|
# add your completion code
|
|
persona = input("Tell me the historical character I want to be: ")
|
|
question = input("Ask your question about the historical character: ")
|
|
prompt = f"""
|
|
You are going to play as a historical character {persona}.
|
|
|
|
Whenever certain questions are asked, you need to remember facts about the timelines and incidents and respond the accurate answer only. Don't create content yourself. If you don't know something, tell that you don't remember.
|
|
|
|
Provide answer for the question: {question}
|
|
"""
|
|
# make a request using the Responses API
|
|
response = client.responses.create(model=deployment, input=prompt, store=False)
|
|
|
|
# print response
|
|
print(response.output_text)
|
|
|
|
# very unhappy _____.
|
|
|
|
# Once upon a time there was a very unhappy mermaid. |