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

Adding types for models accepted by OpenAI API endpoints #123

Closed
wants to merge 3 commits into from

Conversation

mbukeRepo
Copy link

@mbukeRepo mbukeRepo commented Mar 30, 2023

This pull request adds types for the models accepted by OpenAI API endpoints. By providing type annotations for these models, developers can more easily understand the structure of the data being passed to the API. Additionally, this will enable better error checking and help to prevent unexpected issues that could arise due to not knowing the available models.

The models were obtained from the OpenAI API documentation at the following URL

I have created corresponding TypeScript types for accepted models for each endpoint, which have been added to the api.ts file in the root directory and api.d.ts in dist directory. The types have been named according to their corresponding endpoints, and all required fields have been included.

Thank you for considering this pull request.

@mbukeRepo mbukeRepo changed the title Adding types for modals accepted by OpenAI API endpoints Adding types for models accepted by OpenAI API endpoints Mar 30, 2023
@chkpcc1a035
Copy link

Is this fixing the v1/chat/completions path update from v1/completions for #132 ?

@mbukeRepo
Copy link
Author

Is this fixing the v1/chat/completions path update from v1/completions for #132 ?

Yes, this fixes any issue that may arise from not knowing models available for openai api endpoints.

@Yaronglp
Copy link

Nice :)

@rattrayalex
Copy link
Collaborator

Thank you for adding these types @mbukeRepo ! They look very helpful.

We have an upcoming v4 of the library which adds better types, including some model enums, eg;

https://github.com/openai/openai-node/blob/v4/src/resources/chat/completions.ts#L181
https://github.com/openai/openai-node/blob/v4/src/resources/completions.ts#L86

We may add more such enums in the future; the place to suggest these changes would be in our openapi spec.

@rattrayalex rattrayalex added the fixed in v4 Issues addressed by v4 label Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in v4 Issues addressed by v4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants