1616
1717package org .springframework .ai .zhipuai ;
1818
19- import com .fasterxml .jackson .annotation .JsonIgnore ;
2019import com .fasterxml .jackson .annotation .JsonInclude ;
2120import com .fasterxml .jackson .annotation .JsonInclude .Include ;
2221import com .fasterxml .jackson .annotation .JsonProperty ;
2827 *
2928 * @author Geng Rong
3029 * @author Thomas Vitale
30+ * @author Ilayaperumal Gopinathan
3131 * @since 1.0.0 M1
3232 */
3333@ JsonInclude (Include .NON_NULL )
@@ -38,6 +38,10 @@ public class ZhiPuAiEmbeddingOptions implements EmbeddingOptions {
3838 * ID of the model to use.
3939 */
4040 private @ JsonProperty ("model" ) String model ;
41+ /**
42+ * Dimension value of the model to use.
43+ */
44+ private @ JsonProperty ("dimensions" ) Integer dimensions ;
4145 // @formatter:on
4246
4347 public static Builder builder () {
@@ -53,10 +57,17 @@ public void setModel(String model) {
5357 this .model = model ;
5458 }
5559
60+ public void setDimensions (Integer dimensions ) {
61+ this .dimensions = dimensions ;
62+ }
63+
5664 @ Override
57- @ JsonIgnore
5865 public Integer getDimensions () {
59- return null ;
66+ return this .dimensions ;
67+ }
68+
69+ public void setDimensions (Integer dimensions ) {
70+ this .dimensions = dimensions ;
6071 }
6172
6273 public static class Builder {
@@ -67,11 +78,16 @@ public Builder() {
6778 this .options = new ZhiPuAiEmbeddingOptions ();
6879 }
6980
70- public Builder withModel (String model ) {
81+ public Builder model (String model ) {
7182 this .options .setModel (model );
7283 return this ;
7384 }
7485
86+ public Builder dimensions (Integer dimensions ) {
87+ this .options .setDimensions (dimensions );
88+ return this ;
89+ }
90+
7591 public ZhiPuAiEmbeddingOptions build () {
7692 return this .options ;
7793 }
0 commit comments