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

Models, Files and Fine-Tuning APIs #20

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

thehappydinoa
Copy link
Contributor

@thehappydinoa thehappydinoa commented Jan 21, 2023

Refactored each API into it's own file and added three new APIs. I also removed the Engines API as it is now deprecated.

Changes

  • Implement Models API
  • Implement Files API
  • Implement Fine-Tune API
  • Write tests for the Models API
  • Write tests for the Files API
  • Write tests for the Fine-Tune API

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

⚠️ This pull request was not sent to the PullRequest network because the pull request is a draft.

@thehappydinoa thehappydinoa changed the title Files and Fine-Tuning APIs Models, Files and Fine-Tuning APIs Jan 21, 2023
@thehappydinoa thehappydinoa marked this pull request as ready for review January 26, 2023 17:17
Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

✅ This pull request was sent to the PullRequest network.


@thehappydinoa you can click here to see the review status or cancel the code review job.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

PullRequest Breakdown

Reviewable lines of change

+ 1,357
- 664

76% Go
23% Go (tests)
2% Ignore List

Type of change

Feature - These changes are adding a new feature or improvement to existing code.
1 Message
⚠️ Due to its size, this pull request will be reviewed by PullRequest staff before being sent to the reviewer network, and the team will reach out if there are any concerns. After this pull request is sent to the network, please be aware that it will likely have a longer turnaround time and require multiple passes from our reviewers.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

I've reviewed the first part of this PR and didn't find anything that needs to be addressed. I'll have to come back to it and review the rest later today.

Image of Andy W Andy W


Reviewed with ❤️ by PullRequest

@thehappydinoa
Copy link
Contributor Author

Thank you, I really appreciate it!

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

So, after further review I think there are some fundamental changes I would suggest.

I think the ClientOption function type is a little awkward and is maybe a case of engineering for problems you don't have yet. Most API Client libraries have a fixed set of options with their own getters and setters.

Your method naming is confusing at times and could be more explicit so that a developer knows what something does by looking at the name. GetFiles() vs. Files() for example.

I found this example of a well written golang API client library. It covers some basics about configuration and structure.

Image of Andy W Andy W


Reviewed with ❤️ by PullRequest

@thehappydinoa
Copy link
Contributor Author

thehappydinoa commented Jan 26, 2023

Understood. Just for context I didn't actually create the name scheme, I just copied in the one from gpt3.go. The same goes for the base client functionality. I am open to changing some of those, but I wanted to clarify if this MR is the right place. My main goal was to enable folks to use the new completion and fine tune endpoints. Please let me know how we should proceed, I would love to be able to use some of these features.

Also maybe @tylermann can weigh in here?

@tylermann
Copy link
Contributor

Understood. Just for context I didn't actually create the name scheme, I just copied in the one from gpt3.go. The same goes for the base client functionality. I am open to changing some of those, but I wanted to clarify if this MR is the right place. My main goal was to enable folks to use the new completion and fine tune endpoints. Please let me know how we should proceed, I would love to be able to use some of these features.

Also maybe @tylermann can weigh in here?

Yeah I would prefer as minimal changes as possible to the existing APIs since this is a publicly used/open source library and will break when people upgrade. Andy (pullrequest), would you mind taking another pass at this review with the mindset of preserving existing functionality? I believe the main goal here is to fulfill this issue: #12

Copy link
Contributor

@tylermann tylermann left a comment

Choose a reason for hiding this comment

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

@thehappydinoa , first off thank you for the work here to improve this library and update these APIs!

I am slightly worried about the size of this PR just because it does change a lot of lines at once even if many of them are just moved from other files. Perhaps we could split those things up next time if we want to reorder and do that in a separate PR so it easier to follow the actual changes.

I know there are some intentional breaking changes as a part of this PR as we are removing some deprecated methods. Although ideally we can try to preserve as much functionality as possible especially for the most likely used methods like the Completion ones.

I left some comments inline, but I'll also play around with this to help manually test it.

@thehappydinoa
Copy link
Contributor Author

Hey @tylermann thank you for taking the time to review my pr. Definitely something that should've split up. I will go your comments and try to implement what I can!

Thanks again!

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

Understood. Just for context I didn't actually create the name scheme, I just copied in the one from gpt3.go. The same goes for the base client functionality. I am open to changing some of those, but I wanted to clarify if this MR is the right place. My main goal was to enable folks to use the new completion and fine tune endpoints. Please let me know how we should proceed, I would love to be able to use some of these features.

Also maybe @tylermann can weigh in here?

Yeah I would prefer as minimal changes as possible to the existing APIs since this is a publicly used/open source library and will break when people upgrade. Andy (pullrequest), would you mind taking another pass at this review with the mindset of preserving existing functionality? I believe the main goal here is to fulfill this issue: #12

Understood. It was just a suggestion but it makes sense to keep things as is for compatibility reasons.

Image of Andy W Andy W

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

Reviewed feedback and agreed with comments on compatibility.

Image of Andy W Andy W


Reviewed with ❤️ by PullRequest

@thehappydinoa
Copy link
Contributor Author

Hey there,
Thank you both for taking the time to review my changes. I really appreciate the feedback and I implemented everything except the situation when the body is null as delete and a couple others have no response body. I hope that I addressed all your concerns.

Thanks again,
Aidan

Copy link
Contributor

@tylermann tylermann left a comment

Choose a reason for hiding this comment

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

thanks for the updates here @thehappydinoa , I was testing this branch locally and ran into a few errors. I will keep playing around with it but I think this current issue is preventing even the happy path for Completion requests from working for me.

if err != nil {
return nil, err
}
defer resp.Body.Close()
Copy link
Contributor

Choose a reason for hiding this comment

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

I was testing out the changes on this branch locally and was running into errors, that I believe are from this line. I don't think we used to do this defer/body close from the performRequest happy path, so it was giving me an error when trying to run go run cmd/test/main.go

invalid json response: http2: response body closed

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 let me fix that, I believe I was told to move it there, does this occur when there is no response body?

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

Due to inactivity, PullRequest has cancelled this review job. You can reactivate the code review job from the PullRequest dashboard.

Copy link

@Jekyle9444 Jekyle9444 left a comment

Choose a reason for hiding this comment

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

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.

3 participants