Difference between revisions of "Axis and Allies GPT"

From SaladFrosting
Jump to navigation Jump to search
m (add title)
Line 28: Line 28:
 
*https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
 
*https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
 
*https://platform.openai.com/docs/overview
 
*https://platform.openai.com/docs/overview
 +
 +
==The Manual==
 +
the PDF is kinda big... (47000KB).  Converted it to text (100KB) with an online tool.
 +
i uploaded (read) it using
 +
 +
# Read the contents of the text file (user manual)
 +
file_path = "axy.txt"  # Replace with your file path
 +
with open(file_path, "r", encoding="utf-8") as file:
 +
    user_manual_text = file.read()
 +
 +
and then fought the syntax here for way too long:
 +
 +
# Define a function to interact with ChatGPT
 +
def ask_chatgpt(question, context):
 +
response = openai.completions.create(
 +
  engine="text-davinci-002",
 +
    prompt=f"User Manual: {context}\nQuestion: {question}\nAnswer:",
 +
    max_tokens=150,  # Adjust based on your needs
 +
      temperature=0.7,  # Adjust for creativity vs. accuracy
 +
  )
 +
    return response.choices[0].text.strip()

Revision as of 23:05, 7 November 2023

A & A Gee Pee Tee solves the problem of "I want to play A&A but I don't want to read the rulebook". Solution: spin up an "AI Assistant" with a custom domain of knowledge concerning the board game.


Work Notes

echo %OPENAI_API_KEY%
  • re-run
python openai-test.py

SUCCESS.

okay, now on to XY...

The Manual

the PDF is kinda big... (47000KB). Converted it to text (100KB) with an online tool. i uploaded (read) it using

# Read the contents of the text file (user manual)
file_path = "axy.txt"  # Replace with your file path
with open(file_path, "r", encoding="utf-8") as file:
   user_manual_text = file.read()

and then fought the syntax here for way too long:

# Define a function to interact with ChatGPT
def ask_chatgpt(question, context):
response = openai.completions.create(
  engine="text-davinci-002",
   prompt=f"User Manual: {context}\nQuestion: {question}\nAnswer:",
    max_tokens=150,  # Adjust based on your needs
     temperature=0.7,  # Adjust for creativity vs. accuracy
  )
   return response.choices[0].text.strip()