Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to OpenAI’s GPT4 not working #731

Open
rafiyoeliaero opened this issue Jan 31, 2024 · 11 comments
Open

Access to OpenAI’s GPT4 not working #731

rafiyoeliaero opened this issue Jan 31, 2024 · 11 comments

Comments

@rafiyoeliaero
Copy link

I’m trying to hook onto GPT4 (of course I have an openAI key). A friend sent me the access code below but Pythonista does not seem to support (I get an error) on the second line ‘from openai import OpenAI’ . Any workarounds?
import openai
from openai import OpenAI
client = OpenAI(api_key="YOUR_KEY_HERE")
def chat():
prompt = input('Please write your prompt here\n')
completion = client.chat.completions.create(
model="gpt-4",
messages=[
{"role": "user", "content": prompt}
]
)
return(print(completion.choices[0].message.content))
def main():
chat()
if name == "main":
main()

please send copy of reply to: rafiyoeliaero@gmail.com (for some reason the OMZ forum doesn’t let me post this)

@rafiyoeliaero
Copy link
Author

Typo correction on the above: here’s the script (the error appears on: ‘
from openai import OpenAI‘)
import openai

from openai import OpenAI
client = OpenAI(api_key="YOUR_KEY_HERE")
def chat():
prompt = input('Please write your prompt here\n')
completion = client.chat.completions.create(
model="gpt-4",
messages=[
{"role": "user", "content": prompt}
]
)
return(print(completion.choices[0].message.content))
def main():
chat()
if name == "main":
main()

@ForceBru
Copy link

ForceBru commented Feb 6, 2024

I get an error

What is the error???? When asking questions about software that involve error messages, please always include the full error messages, always. Otherwise people won't be able to help because it's unclear what exactly is wrong with the code. Another important thing is to format you code properly. Reading the messy code you posted is infuriating. People are going to get mad and skip your question instead of answering.

@rafiyoeliaero
Copy link
Author

rafiyoeliaero commented Feb 7, 2024 via email

@rafiyoeliaero
Copy link
Author

Here’s the screenshot: Pythonista GPT4 error

@rafiyoeliaero
Copy link
Author

rafiyoeliaero commented Feb 10, 2024 via email

@rafiyoeliaero
Copy link
Author

rafiyoeliaero commented Feb 10, 2024 via email

@TFWol
Copy link

TFWol commented Mar 2, 2024

openai is not a Pythonista built-in module

Well that's confusing.

App documentation:
image

Website documentation:
image

@ChelsWin
Copy link

ChelsWin commented Mar 9, 2024

Try this:

import openai


openai.api_key = "YOUR_API_KEY_HERE"


def chat():
    prompt = input("Please write your prompt here\n")
    completion = openai.ChatCompletion.create(
        model="gpt-4", messages=[{"role": "user", "content": prompt}]
    )
    return print(completion.choices[0].message.content)


def main():
    chat()


if __name__ == "__main__":
    main()

@rafiyoeliaero
Copy link
Author

Thanks! It seems to work technically but here’s my first question:

are you GPT4?
No, I am not GPT4. I am an AI model created by OpenAI known as GPT-3. As of this conversation, a GPT-4 model does not exist.

Then I tried this (wanted to see if I’ll at least get Bard if not Gemini as an answer:

what is the name of Googe's Large Language Model that competes with OpenAI’s one?
Google's Large Language Model that competes with OpenAI’s model is called LaMDA.

So what do you think? I think I’m still on GPT-3 . Any further ideas?

@ChelsWin
Copy link

ChelsWin commented Mar 9, 2024

I just looked into it a bit and apparently it is normal for it to say that because of the data it has been trained on. The web GPT-4 doesn't say it, but the API does.

To answer your second question about not recognising Bard or Gemini, it will not recognise them because the dataset used is cut off at 2021 according to the link below.

You can read more about it here:
https://community.openai.com/t/gpt-4-through-api-says-its-gpt-3/286881

@rafiyoeliaero
Copy link
Author

Excellent. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants