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

Mark finish_reason and other properties as required #60

Merged
merged 2 commits into from
Jul 13, 2023

Conversation

rattrayalex
Copy link
Contributor

Attempts to resolve openai/openai-node#82

Note I am very uncertain whether these changes are correct; they are just guesses. Please audit them before merging.

Attempts to resolve openai/openai-node#82

Note I am very uncertain whether these changes are correct; they are just guesses. Please audit them before merging.
Copy link
Contributor Author

@rattrayalex rattrayalex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noting a few things I was particularly unsure of.

@@ -2155,6 +2159,8 @@ components:
type: array
items:
type: object
required:
- index
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I assume that index would always be present, but delta and finish_reason may not be here; I have not checked whether that tends to be the case.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delta and finish_reason are also always present, we can make this required.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, then presumably finish_reason should be marked as nullable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And is delta nullable, or would it be '' on the last chunk when it's just a finish reason?

Copy link
Collaborator

@athyuttamre athyuttamre Jul 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finish_reason is nullable, whereas delta is always a dictionary with every key (and sub key) optional.

openapi.yaml Outdated
required:
- text
- index
- logprobs
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if the logprobs key would always be present; it is marked as nullable.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bug — the v1/edits response doesn't support logprobs as a parameter or a response field. Can we remove from both request and response?

Copy link
Contributor Author

@rattrayalex rattrayalex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noting a few things I was particularly unsure of.

Copy link
Collaborator

@athyuttamre athyuttamre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of fixes, thanks for doing this!

@rattrayalex
Copy link
Contributor Author

Thanks Atty! Back to you – want to make sure we get the typing around delta right.

Copy link
Collaborator

@athyuttamre athyuttamre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarified about delta / finish_reason

@athyuttamre athyuttamre merged commit ec0b395 into openai:master Jul 13, 2023
1 check passed
@rattrayalex rattrayalex deleted the patch-6 branch July 13, 2023 21:58
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 this pull request may close these issues.

Incorrect TS typing for finish_reason
2 participants