@pinecone-database/pinecone
Version:
This is the official Node.js SDK for [Pinecone](https://www.pinecone.io), written in TypeScript.
54 lines • 2.06 kB
JavaScript
;
/* tslint:disable */
/* eslint-disable */
/**
* Pinecone Inference 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: 2025-04
* Contact: support@pinecone.io
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.EmbeddingToJSON = exports.EmbeddingFromJSONTyped = exports.EmbeddingFromJSON = void 0;
const DenseEmbedding_1 = require("./DenseEmbedding");
const SparseEmbedding_1 = require("./SparseEmbedding");
function EmbeddingFromJSON(json) {
return EmbeddingFromJSONTyped(json, false);
}
exports.EmbeddingFromJSON = EmbeddingFromJSON;
function EmbeddingFromJSONTyped(json, ignoreDiscriminator) {
if ((json === undefined) || (json === null)) {
return json;
}
switch (json['vector_type']) {
case 'dense':
return { ...(0, DenseEmbedding_1.DenseEmbeddingFromJSONTyped)(json, true), vectorType: 'dense' };
case 'sparse':
return { ...(0, SparseEmbedding_1.SparseEmbeddingFromJSONTyped)(json, true), vectorType: 'sparse' };
default:
throw new Error(`No variant of Embedding exists with 'vectorType=${json['vectorType']}'`);
}
}
exports.EmbeddingFromJSONTyped = EmbeddingFromJSONTyped;
function EmbeddingToJSON(value) {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
switch (value['vectorType']) {
case 'dense':
return (0, DenseEmbedding_1.DenseEmbeddingToJSON)(value);
case 'sparse':
return (0, SparseEmbedding_1.SparseEmbeddingToJSON)(value);
default:
throw new Error(`No variant of Embedding exists with 'vectorType=${value['vectorType']}'`);
}
}
exports.EmbeddingToJSON = EmbeddingToJSON;
//# sourceMappingURL=Embedding.js.map