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 File purposes as constants #577

Merged

Conversation

revett
Copy link
Contributor

@revett revett commented Nov 14, 2023

Describe the change

  • When uploading a File, you need to define a .Purpose
  • Currently this is a string that is passed to the FileRequest type
  • It would be nicer to have these as constants
image

See: https://platform.openai.com/docs/api-reference/files

Describe your solution

Add a constant for each supported purpose as defined in the OpenAI API.

Tests

No tests needed.

Additional context

Not related to an issue, just something I saw when using the new Assistants API.

@revett revett marked this pull request as draft November 14, 2023 12:43
Copy link

codecov bot commented Nov 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1846572) 98.38% compared to head (aa3560d) 98.38%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #577   +/-   ##
=======================================
  Coverage   98.38%   98.38%           
=======================================
  Files          24       24           
  Lines        1300     1300           
=======================================
  Hits         1279     1279           
  Misses         15       15           
  Partials        6        6           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@revett revett marked this pull request as ready for review November 14, 2023 12:44
@floodfx
Copy link
Contributor

floodfx commented Nov 14, 2023

I added something similar in #568 but with more type safety. We should probably merge these efforts? I can add the additional types to #568. I am unclear whether the type safe approach I used is typical of this project though?

@revett
Copy link
Contributor Author

revett commented Nov 16, 2023

I added something similar in #568 but with more type safety. We should probably merge these efforts? I can add the additional types to #568. I am unclear whether the type safe approach I used is typical of this project though?

Thanks! I've rebased your merged changes in to this PR. Looks like we still need two more purposes added.

@sashabaranov This is ready for review 👍

Copy link
Contributor

@floodfx floodfx left a comment

Choose a reason for hiding this comment

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

Looks great to me!

Copy link
Owner

@sashabaranov sashabaranov left a comment

Choose a reason for hiding this comment

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

Thank you!

@sashabaranov sashabaranov merged commit 4fd904c into sashabaranov:master Nov 18, 2023
maerlyn5 pushed a commit to prassoai/go-openai that referenced this pull request Nov 22, 2023
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