Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

1.4 KB
Raw Blame
(ns metabase-enterprise.search.semantic.env
  (:require
   [metabase-enterprise.search.semantic.db.datasource :as semantic.db.datasource]
   [metabase-enterprise.search.semantic.embedding :as semantic.embedding]
   [metabase-enterprise.search.semantic.index-metadata :as semantic.index-metadata]))

;; global configuration / state containment facility
;; only core and the task definitions (for which integration with metabase demands globals)
;; should need these

;; TODO: Probably remove completely, all occurrences should be using db.connection
(defn get-pgvector-datasource!
  "Returns the instances pgvector Datasource, initializing lazily if needed."
  []
  (semantic.db.datasource/ensure-initialized-data-source!))

(defn get-configured-embedding-model
  "Returns the currently configured embedding model from settings."
  []
  (semantic.embedding/get-configured-model))

(defn get-index-metadata
  "Returns this instances index metadata configuration.
  Currently, an instance only has one metadata root, so this will always have the same value in production:
  the schema-qualified configuration when sharing the application database, the bare default otherwise."
  []
  ;; still useful to indirect this for tests
  (if (= :app-db (semantic.db.datasource/pgvector-mode))
    semantic.index-metadata/app-db-index-metadata
    semantic.index-metadata/default-index-metadata))