Commit c0aa6b5
release: 2.19.0 (#553)
* docs: fix missing readme comment
* feat(client): support base64 embeddings and use as default (#519)
* Add EmbeddingValue union type and Base64 support for embeddings
This implementation adds support for Base64-encoded embeddings as the default response format, while maintaining complete backward compatibility with existing `List<Float>` usage.
### 1. Default Behavior Change
- **New Default**: Embedding requests now default to Base64 encoding format
- **Backward Compatibility**: Existing code using `embedding()` method continues to work unchanged
- **Performance**: Base64 encoding reduces network payload size significantly
Introduces the EmbeddingValue class to support both float list and base64-encoded embedding data, enabling efficient handling and backward compatibility. Embedding, EmbeddingCreateParams, and related classes are updated to use EmbeddingValue, with automatic decoding and encoding between formats. Adds EmbeddingDefaults for global default encoding configuration, and comprehensive tests for new behaviors and compatibility.
* Deleted invalid EmbeddingDefaults.kt
Deleted invalid EmbeddingDefaults.kt
* fix: actually add system properties
* Modified the field name for floats and base64
Modified the field name for floats and base64
* Deleted DebutTest
Deleted DebutTest
* Modified validate method and refactored apply scope function
* validate() methods validate anything the "shape" of the data being correct
* The code has been refactored to use Kotlin's apply scope function for improved conciseness and consistency.
* Modified default encoding
Modified default encoding
* Modified the implementation of default encoding
Modified the implementation of default encoding
* Modified format
Modified format
* Delete plan2.md
Delete plan2.md
* fix: set the default correctly
* fix: rename some things
* chore: EmbeddingValue refactor
* refactor: embedding data model
* chore: delete test with no asserts
* chore: test changes
* fix: little-endian
---------
Co-authored-by: Yoshio Terada <yoterada@microsoft.com>
Co-authored-by: Tomer Aberbach <tomer@stainless.com>
* release: 2.19.0
---------
Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
Co-authored-by: Yoshio Terada <tyoshio2002@yahoo.co.jp>
Co-authored-by: Yoshio Terada <yoterada@microsoft.com>
Co-authored-by: Tomer Aberbach <tomer@stainless.com>1 parent 3b809df commit c0aa6b5
File tree
9 files changed
+364
-28
lines changed- openai-java-core/src
- main/kotlin/com/openai/models/embeddings
- test/kotlin/com/openai/models/embeddings
9 files changed
+364
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
3 | 16 | | |
4 | 17 | | |
5 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
| 5 | + | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
1321 | 1321 | | |
1322 | 1322 | | |
1323 | 1323 | | |
1324 | | - | |
| 1324 | + | |
1325 | 1325 | | |
1326 | 1326 | | |
1327 | 1327 | | |
| |||
1330 | 1330 | | |
1331 | 1331 | | |
1332 | 1332 | | |
1333 | | - | |
| 1333 | + | |
1334 | 1334 | | |
1335 | 1335 | | |
1336 | 1336 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
Lines changed: 53 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| |||
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
24 | | - | |
| 23 | + | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| |||
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
34 | | - | |
| 33 | + | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
| |||
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
46 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
47 | 55 | | |
48 | 56 | | |
49 | 57 | | |
| |||
71 | 79 | | |
72 | 80 | | |
73 | 81 | | |
74 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
75 | 92 | | |
76 | 93 | | |
77 | 94 | | |
| |||
109 | 126 | | |
110 | 127 | | |
111 | 128 | | |
112 | | - | |
| 129 | + | |
| 130 | + | |
113 | 131 | | |
114 | 132 | | |
115 | 133 | | |
116 | 134 | | |
117 | 135 | | |
118 | 136 | | |
119 | | - | |
| 137 | + | |
120 | 138 | | |
121 | 139 | | |
122 | 140 | | |
123 | 141 | | |
124 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
125 | 149 | | |
126 | 150 | | |
127 | 151 | | |
128 | 152 | | |
129 | 153 | | |
130 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
131 | 161 | | |
132 | 162 | | |
133 | 163 | | |
| |||
136 | 166 | | |
137 | 167 | | |
138 | 168 | | |
139 | | - | |
140 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
141 | 172 | | |
142 | 173 | | |
143 | 174 | | |
| |||
146 | 177 | | |
147 | 178 | | |
148 | 179 | | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
153 | 186 | | |
154 | 187 | | |
155 | 188 | | |
| |||
211 | 244 | | |
212 | 245 | | |
213 | 246 | | |
214 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
215 | 251 | | |
216 | 252 | | |
217 | 253 | | |
| |||
225 | 261 | | |
226 | 262 | | |
227 | 263 | | |
228 | | - | |
| 264 | + | |
229 | 265 | | |
230 | 266 | | |
231 | 267 | | |
| |||
250 | 286 | | |
251 | 287 | | |
252 | 288 | | |
253 | | - | |
| 289 | + | |
254 | 290 | | |
255 | 291 | | |
256 | 292 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
581 | 581 | | |
582 | 582 | | |
583 | 583 | | |
584 | | - | |
| 584 | + | |
| 585 | + | |
585 | 586 | | |
586 | 587 | | |
587 | 588 | | |
| |||
0 commit comments