org.openapitools.client.model.IndexMetric Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pinecone-client Show documentation
Show all versions of pinecone-client Show documentation
The Pinecone.io Java Client
/*
* Pinecone Control Plane API
* Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors.
*
* The version of the OpenAPI document: v1
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import com.google.gson.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'.
*/
@JsonAdapter(IndexMetric.Adapter.class)
public enum IndexMetric {
COSINE("cosine"),
EUCLIDEAN("euclidean"),
DOTPRODUCT("dotproduct");
private String value;
IndexMetric(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static IndexMetric fromValue(String value) {
for (IndexMetric b : IndexMetric.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter {
@Override
public void write(final JsonWriter jsonWriter, final IndexMetric enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public IndexMetric read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return IndexMetric.fromValue(value);
}
}
}