Nashex / gpt4-playground

Clone of OpenAI's ChatGPT and Playground environments to enable experimenting with API keys.
https://www.gpt4-playground.com/
MIT License
342 stars 110 forks source link

Changing the response message of the model #7

Open othmanelhoufi opened 1 year ago

othmanelhoufi commented 1 year ago

Hello,

Thanks for this great tool, I am actually trying to adapt your code for Azure OpenAI API, and I am using the chat completion models, here is the API Response :

{
 'id': 'chatcmpl-6p9XYPYSTTRi0xEviKjjilqrWU2Ve',
 'object': 'chat.completion',
 'created': 1677649420,
 'model': 'gpt-3.5-turbo',
 'usage': {'prompt_tokens': 56, 'completion_tokens': 31, 'total_tokens': 87},
 'choices': [
   {
    'message': {
      'role': 'assistant',
      'content': 'The 2020 World Series was played in Arlington, Texas at the Globe Life Field, which was the new home stadium for the Texas Rangers.'},
    'finish_reason': 'stop',
    'index': 0
   }
  ]
}

Can you please tell me how to modify the message object you wrote (id, role, content) so that it takes into account the new reponse.

Thanks,

Nashex commented 1 year ago

I can certainly take a look at that!