Added GPT-4!

This commit is contained in:
Roger Gonzalez 2023-07-26 22:44:12 -03:00
parent 62ad0c1607
commit 2f62afca60
Signed by: rogs
GPG Key ID: C7ECE9C6C36EC2E6
2 changed files with 7 additions and 4 deletions

View File

@ -10,6 +10,8 @@ from htmls import prompt_html_template
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
DEFAULT_MODEL = "gpt-4"
def format_message(message: str, role: str) -> list:
"""
@ -74,7 +76,7 @@ async def get_random_topic() -> str:
"""
try:
completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
model=DEFAULT_MODEL,
messages=format_message(
"Give me a random list of 10 topics to talk about in a comma separated list. Each topic should be less "
"than 5 words long and should not contain commas. Be as creative as possible and choose topics from "
@ -113,7 +115,7 @@ async def generate_topic_image(topic: str) -> str:
"""
try:
completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
model=DEFAULT_MODEL,
messages=format_message(
f"Generate a prompt for dall-e about {topic}. Use less than 10 words and only return the prompt",
"You are a dall-e expert",
@ -157,11 +159,11 @@ async def get_chatgpt_html_response(topic: str = None, count: int = 0) -> str:
try:
completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
model=DEFAULT_MODEL,
messages=format_message(
f"""
You are going to add information to this: {html}.
- Add 5 parragraphs talking about {topic} in the "information-container" div.
- Add 5 parragraphs talking about {topic} in the "information-container" div Add only the information.
- Add 5 links for related topics in the "related-topics-container" div. The href should be
"/infinite?topic=(slugified_related_topic_name)" and the text should be "(related_topic_name).
- Add 5 links for new random topics not related to {topic} in the "new-topics-container" div. The href

View File

@ -14,6 +14,7 @@ index_html = """
<footer>
<i>
<b>Remember this is autogenerated by ChatGPT so it is VERY slow. Be patient!</b>
<b>Now with GPT-4 🤖</b>
</i>
</footer>
</html>