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

Add CompletionModel class - narrower scope #5

Merged

Conversation

maciej-cz
Copy link
Contributor

First of all, thanks for your effort of creating this project @StefanBratanov . It makes OpenAI usage much more convenient.

Now, to the point, the purpose of this change is to replace completion model parameter (currently String) with a value object with predefined values available.

I created 2 versions of this change (the other one is #4). This one is a bit narrower:

  • CompletionModel is an enum
  • String is still a valid model parameter

Please suggest, which version you prefer (if any).

In case of positive feedback, I can spread this change to other APIs' models.

Copy link
Owner

@StefanBratanov StefanBratanov left a comment

Choose a reason for hiding this comment

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

Hi, first of all thanks for raising a PR. Appreciate it a lot! I think the narrow scope is cleaner. As a design, I am thinking CompletionModel can be renamed to OpenAIModel and then all models can be put there and used by the different builders in future PRs. This way there would be no need to maintain several classes and would keep the library easier to maintain and to reason about. What do you think?

@StefanBratanov StefanBratanov force-pushed the completion-model-small branch 2 times, most recently from 3788acc to 86c8d63 Compare April 2, 2024 10:52
@maciej-cz
Copy link
Contributor Author

I am thinking CompletionModel can be renamed to OpenAIModel and then all models can be put there and used by the different builders in future PRs. This way there would be no need to maintain several classes and would keep the library easier to maintain and to reason about

My intention was to only allow suitable models per endpoint (e.g. to not be able to use dall-e model for completion). But this approach has the maintenance overhead drawback you mentioned.

I'll apply your suggestions (hopefully today) and propagate OpenAIModel to other places.

@maciej-cz maciej-cz force-pushed the completion-model-small branch 2 times, most recently from 12ea892 to 50fe106 Compare April 4, 2024 07:35
Copy link
Owner

@StefanBratanov StefanBratanov left a comment

Choose a reason for hiding this comment

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

Awesome. LGTM, only need to run spotlessApply to fix some formatting issues and have a green build. :)

@StefanBratanov
Copy link
Owner

Thanks for the fix. The failing tests are because pull request builds don't get access to secrets. Will merge this one and figure out how to do this for any future PRs.

@StefanBratanov StefanBratanov merged commit b9e8229 into StefanBratanov:master Apr 5, 2024
1 check failed
@StefanBratanov
Copy link
Owner

StefanBratanov commented Apr 5, 2024

Fixed it in fe32392. Future PRs should be able to have green builds and don't run the integration tests. Thanks again for this change. Will include it in the next release. Just need to finish off the Assistants streaming functionality first.

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.

2 participants