microsoft / semantic-kernel

Integrate cutting-edge LLM technology quickly and easily into your apps
https://aka.ms/semantic-kernel
MIT License
21.31k stars 3.13k forks source link

Python: gpt-4 not available for chat_gpt_api.py #1983

Closed xieliaing closed 1 year ago

xieliaing commented 1 year ago

Describe the bug changed "gpt-3.5-turbo" to "gpt-4" in chat_gpt_api.py file at line 21:

kernel.add_chat_service( "chat-gpt", sk_oai.OpenAIChatCompletion("gpt-3.5-turbo", api_key, org_id) )

To Reproduce Steps to reproduce the behavior:

  1. Go to 'chat_gpt_api.py' example
  2. Click on line 21, change "gpt-3.5-turbo" to "gpt-4"
  3. in CLI, type in "python chat_gpt_api.py" to execute the file
  4. You will see User:> and type some messages to start the chat
  5. The system will return the following message:
    Mosscap:> Error: (<ErrorCodes.ServiceError: 6>, 'OpenAI service failed to complete the chat', InvalidRequestError(message='The model: `gpt-4` does not exist', param=None, code='model_not_found', http_status=404, request_id=None))

Expected behavior Expect the chatbot return message from OpenAI's gpt4 model

Screenshots image

Platform

Additional context tried "gpt-4", "gpt-4-0613", "gpt-4-32k" and "gpt-4-32k-0613", none of them work. Based on OpenAI GPT guideline, gpt-4 shares the same end point with gpt-3-turbo, so I expect gpt-4 should be working in the example as well.

PawelStadnicki commented 1 year ago

I encountered the same in C# notebook. GPT-4 is generally available since 6 July but for all API paying customers. Not sure if it does not work because of that or there must be some update on SK level

xieliaing commented 1 year ago

I am a paying customer of OpenAI for both API and ChatGPT, and I can use GPT4 using OpenAI's API in python.

nacharya1 commented 1 year ago

@xieliaing - thanks for raising this we will investigate to see if can repo this behaviour.

awharrison-28 commented 1 year ago

Hi @xieliaing I am unable to repro your issue. I changed my lines 19-21 of chat_gpt_api.py to

api_key, org_id = sk.openai_settings_from_dot_env()
kernel.add_chat_service(
    "gpt-4", sk_oai.OpenAIChatCompletion("gpt-4", api_key, org_id)
)

Is this still an issue for you?

xieliaing commented 1 year ago

Hi @xieliaing I am unable to repro your issue. I changed my lines 19-21 of chat_gpt_api.py to

api_key, org_id = sk.openai_settings_from_dot_env()
kernel.add_chat_service(
    "gpt-4", sk_oai.OpenAIChatCompletion("gpt-4", api_key, org_id)
)

Is this still an issue for you?

interesting, I still encounter the same ERROR message as before. "gpt-3.5-turbo" works, but not "gpt-4".

[follow up] Below is a screenshot of running the script today:

image

xieliaing commented 1 year ago

Just got notice from OpenAI that as part of GA of GPT-4, I can now use GPT-4 from API. So even if GPT-4 API has been available to paying customers since July 6th, it is not available at once for all paying customer. Just tried and the sample works under GPT-4 now, closing the issue. Thanks for the team's effort.

(base) D:\Temp\semantic-kernel-xl\python\samples\kernel-syntax-examples>python chat_gpt4_api.py
User:> hello
Mosscap:> Greetings, kind soul! It is indeed a pleasure to make your acquaintance on this fine occasion. How might the humble Mosscap be of service to you today? Is there a particular query that has brought you to my digital doorstep, or perhaps a need for guidance that has led you to seek my counsel? Regardless of the reason, rest assured that I am here to assist you to the best of my abilities.