-
Notifications
You must be signed in to change notification settings - Fork 16
chore: [OpenAI] Embedding type change to float[]
#353
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
Changes from 4 commits
41f926b
ecebadf
cb10d25
b5425ba
49d530e
53fb9f0
245d6cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,10 +20,8 @@ | |
| import com.fasterxml.jackson.annotation.JsonAnySetter; | ||
| import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import java.math.BigDecimal; | ||
| import java.util.ArrayList; | ||
| import java.util.Arrays; | ||
| import java.util.LinkedHashMap; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.NoSuchElementException; | ||
| import java.util.Objects; | ||
|
|
@@ -44,7 +42,7 @@ public class EmbeddingsCreate200ResponseDataInner | |
| private String _object; | ||
|
|
||
| @JsonProperty("embedding") | ||
| private List<BigDecimal> embedding = new ArrayList<>(); // | ||
| private float[] embedding; | ||
|
|
||
| @JsonAnySetter @JsonAnyGetter | ||
| private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>(); | ||
|
|
@@ -121,34 +119,18 @@ public void setObject(@Nonnull final String _object) { | |
| * @return The same instance of this {@link EmbeddingsCreate200ResponseDataInner} class | ||
| */ | ||
| @Nonnull | ||
| public EmbeddingsCreate200ResponseDataInner embedding(@Nonnull final List<BigDecimal> embedding) { | ||
| public EmbeddingsCreate200ResponseDataInner embedding(@Nonnull final float[] embedding) { | ||
| this.embedding = embedding; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Add one embedding instance to this {@link EmbeddingsCreate200ResponseDataInner}. | ||
| * | ||
| * @param embeddingItem The embedding that should be added | ||
| * @return The same instance of type {@link EmbeddingsCreate200ResponseDataInner} | ||
| */ | ||
| @Nonnull | ||
| public EmbeddingsCreate200ResponseDataInner addEmbeddingItem( | ||
| @Nonnull final BigDecimal embeddingItem) { | ||
| if (this.embedding == null) { | ||
| this.embedding = new ArrayList<>(); | ||
| } | ||
| this.embedding.add(embeddingItem); | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Get embedding | ||
| * | ||
| * @return embedding The embedding of this {@link EmbeddingsCreate200ResponseDataInner} instance. | ||
| */ | ||
| @Nonnull | ||
| public List<BigDecimal> getEmbedding() { | ||
| public float[] getEmbedding() { | ||
| return embedding; | ||
| } | ||
|
|
||
|
|
@@ -157,7 +139,7 @@ public List<BigDecimal> getEmbedding() { | |
| * | ||
| * @param embedding The embedding of this {@link EmbeddingsCreate200ResponseDataInner} | ||
| */ | ||
| public void setEmbedding(@Nonnull final List<BigDecimal> embedding) { | ||
| public void setEmbedding(@Nonnull final float[] embedding) { | ||
| this.embedding = embedding; | ||
| } | ||
|
|
||
|
|
@@ -217,12 +199,12 @@ public boolean equals(@Nullable final Object o) { | |
| this.cloudSdkCustomFields, embeddingsCreate200ResponseDataInner.cloudSdkCustomFields) | ||
| && Objects.equals(this.index, embeddingsCreate200ResponseDataInner.index) | ||
| && Objects.equals(this._object, embeddingsCreate200ResponseDataInner._object) | ||
| && Objects.equals(this.embedding, embeddingsCreate200ResponseDataInner.embedding); | ||
| && Arrays.equals(this.embedding, embeddingsCreate200ResponseDataInner.embedding); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(index, _object, embedding, cloudSdkCustomFields); | ||
| return Objects.hash(index, _object, Arrays.hashCode(embedding), cloudSdkCustomFields); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to above, may continue without
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (How) do you plan to realize that in the generator mustache files?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am going to take that as the case where there is no flag/indicator to distinguish between an array of primitive and object. So I will revert and stay consistent with all object type handling.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How exactly are you planning to do that? Are you currently working on a (the above) PR or is it a follow-up BLI? Establishing manual code changes without a clear path to solve it in the generator is creating problems in the future. Same applies e.g. for prompt-registry PoC PR.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We discussed and found a solution in Cloud SDK |
||
| } | ||
|
|
||
| @Override | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This equality check may continue withObjects.equals, especially if thats what the generator will doThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Object.equals will be flagged a bug.