Sha256: 8b92c7fe6debfce55c12425906a8890651bf43343cd9b7127b72fe2e1ecb4848
Contents?: true
Size: 1020 Bytes
Versions: 1
Compression:
Stored size: 1020 Bytes
Contents
# frozen_string_literal: true module Manifold module Services # Handles the loading of vector schemas from configuration files class VectorService def initialize(logger) @logger = logger end def load_vector_schema(vector_name) path = config_path(vector_name) unless path.file? @logger.error("Vector configuration not found: #{path}") return nil end config = YAML.safe_load_file(path) fields = transform_attributes_to_schema(config["attributes"]) { "name" => vector_name.downcase, "type" => "RECORD", "fields" => fields } end private def transform_attributes_to_schema(attributes) attributes.map do |name, type| { "name" => name, "type" => type.upcase, "mode" => "NULLABLE" } end end def config_path(vector_name) Pathname.pwd.join("vectors", "#{vector_name.downcase}.yml") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
manifold-cli-0.0.7 | lib/manifold/services/vector_service.rb |