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 new struct filed dimensions for embedding API #645

Merged
merged 3 commits into from
Jan 29, 2024

Conversation

chenhhA
Copy link
Contributor

@chenhhA chenhhA commented Jan 28, 2024

Describe the change
Add new struct field dimensions that support for shortening embeddings. Release in January 25, 2024

Provide OpenAI documentation link

Describe your solution
Add new struct filed

Tests
manual

Copy link

codecov bot commented Jan 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4c41f24) 98.43% compared to head (6084a02) 98.44%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #645   +/-   ##
=======================================
  Coverage   98.43%   98.44%           
=======================================
  Files          24       24           
  Lines        1345     1347    +2     
=======================================
+ Hits         1324     1326    +2     
  Misses         15       15           
  Partials        6        6           

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

embeddings.go Outdated
@@ -157,6 +157,9 @@ type EmbeddingRequest struct {
Model EmbeddingModel `json:"model"`
User string `json:"user"`
EncodingFormat EmbeddingEncodingFormat `json:"encoding_format,omitempty"`
// Dimensions The number of dimensions the resulting output embeddings should have.
// Only supported in text-embedding-3 and later models.
Dimensions *int `json:"dimensions,omitempty"`
Copy link
Owner

Choose a reason for hiding this comment

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

Thank you for the PR!

Wouldn't int work just as well here? 0 would be ignored and all other values be included

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks you sugguestion! I chang it type to int

@sashabaranov sashabaranov merged commit 06ff541 into sashabaranov:master Jan 29, 2024
3 checks passed
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.

None yet

2 participants