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

Use the new API URLs and deprecate the old endpoints #27

Closed
RobotSail opened this issue Aug 1, 2022 · 2 comments · Fixed by #28
Closed

Use the new API URLs and deprecate the old endpoints #27

RobotSail opened this issue Aug 1, 2022 · 2 comments · Fixed by #28

Comments

@RobotSail
Copy link
Contributor

OpenAI's API has recently changed so API calls are made to endpoints such as /v1/completions for completions instead of /v1/engines/${engineID}/completions.

I'm currently migrating to using go-gpt3 instead of my own client, and would like to incorporate a mock server for simulating responses. This would be incredibly helpful to avoid handling the old API.

@galpt
Copy link
Contributor

galpt commented Aug 2, 2022

Hi @RobotSail, are you going to update the moderation.go too?
If you have the time, could you please also handle that one too?
So that it can be merged into only 1 pull request.
If you don't really have the opportunity , it's okay, I can update it later after your pull request got approved. :)

I got an email from OpenAI this morning about the changes they made:

Hi there,

Thanks for being a user of OpenAI’s moderations endpoint!

I’m writing to inform you about the following breaking change in our API.

Starting Friday, August 5th 2022, the type of moderation endpoint response fields flagged and each field in categories will change from Integer to Boolean. Return values of 1 will now be true and return values of 0 will be false. Below is an example output of the updated endpoint.

If your application relies on these fields being integers, please update your code to rely on booleans. Otherwise no action is required on your end.

Please reach out to support@openai.com if you have any concerns with this change. Thanks!

{
  "id": "modr-XXXXX",
  "model": "text-moderation-001",
  "results": [
    {
      "categories": {
        "hate": false,
        "hate/threatening": false,
        "self-harm": false,
        "sexual": false,
        "sexual/minors": false,
        "violence": false,
        "violence/graphic": false
      },
      "category_scores": {
        "hate": 0.18805529177188873,
        "hate/threatening": 0.0001250059431185946,
        "self-harm": 0.0003706029092427343,
        "sexual": 0.0008735615410842001,
        "sexual/minors": 0.0007470346172340214,
        "violence": 0.0041268812492489815,
        "violence/graphic": 0.00023186142789199948
      },
      "flagged": false
    }
  ]
}

Best,
Angela

@sashabaranov
Copy link
Owner

@RobotSail thank you for the PR! 🙌🏻 The mock server is also really welcome here. Previously this repo was declined from the awesome-go list due to a lack of mock server testing.

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

Successfully merging a pull request may close this issue.

3 participants