#Is ChatGPT 4o or o1 trained on old API documentation?

1 messages · Page 1 of 1 (latest)

neon owl
#

Is ChatGPT 4o or o1 trained on old API documentation? I am trying to get ChatGPT to give me python code for the openai API and code like openai.ChatCompletion.create is not working. This seems like old documentation that has been changed.

rain irisBOT
#

Hi @neon owl. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

The GPT-4o and o1 models are not specifically trained on API documentation. They are trained on a diverse range of internet text. However, they do not know specifics about which documents were in their training set or have access to any proprietary, confidential, or classified information.

The openai.ChatCompletion.create method you're trying to use is no longer supported in the OpenAI Python library version 1.0.0 and above. This is likely why you're encountering issues. Instead, you should use the client.chat.completions.create method. Here's an example of how to use it:

from openai import OpenAI
import os

client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY", "<your OpenAI API key if not set as env var>"))

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "user", "content": "Your prompt here"}
    ]
)
print(response.choices[0].message.content)

You can find more information about this in the OpenAI API documentation (https://platform.openai.com/docs/api-reference/introduction) and the OpenAI Python library GitHub repository (https://github.com/openai/openai-python).

Sources:


Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: