UNPKG

@neo4j/cypher-builder

Version:

A programmatic API for building Cypher queries for Neo4j

41 lines (40 loc) 2.05 kB
"use strict"; /* * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.encode = encode; exports.encodeBatch = encodeBatch; const CypherFunctions_1 = require("../../expressions/functions/CypherFunctions"); const CypherProcedure_1 = require("../../procedures/CypherProcedure"); const normalize_variable_1 = require("../../utils/normalize-variable"); const GENAI_VECTOR_NAMESPACE = "genai.vector"; /** Encode a given resource as a vector using the named provider. * @see [Neo4j Documentation](https://neo4j.com/docs/cypher-manual/current/functions/#header-query-functions-genai) * @group Functions */ function encode(resource, provider, configuration) { return new CypherFunctions_1.CypherFunction("encode", [resource, (0, normalize_variable_1.normalizeVariable)(provider), (0, normalize_variable_1.normalizeMap)(configuration)], GENAI_VECTOR_NAMESPACE); } /** Encode a given batch of resources as vectors using the named provider. * @see [Neo4j Documentation](https://neo4j.com/docs/operations-manual/current/reference/procedures/#procedure_genai_vector_encodeBatch) * @group Procedures */ function encodeBatch(resources, provider, configuration) { return new CypherProcedure_1.CypherProcedure("encodeBatch", [resources, (0, normalize_variable_1.normalizeVariable)(provider), (0, normalize_variable_1.normalizeMap)(configuration)], GENAI_VECTOR_NAMESPACE); }