load qdrant collection name from config

This commit is contained in:
Travis Shears 2026-03-12 12:12:48 +01:00
parent c1f984b8d0
commit b88f9f0297
Signed by: travisshears
GPG key ID: CB9BF1910F3F7469
2 changed files with 4 additions and 2 deletions

View file

@ -14,6 +14,7 @@
(defn get-config []
(->
(static-config)
(assoc-in-not-nil [:qdrant :collection] (env :qdrand-collection))
(assoc-in-not-nil [:datomic :storage-dir] (env :datomic-path))
(assoc-in-not-nil [:datomic :system] (env :datomic-env))
(assoc-in-not-nil [:jetty :host] (env :host))

View file

@ -8,6 +8,7 @@
(defn config []
(let [c (snippets.infra.config/get-config)]
(hash-map
:qdrant-collection (get-in c [:qdrant :collection])
:qdrant-host (get-in c [:qdrant :host])
:qdrant-api-key (get-in c [:qdrant :api-key]),
:mistral-api-key (get-in c [:mistral :api-key]))))
@ -55,7 +56,7 @@
[snippet embed]
(let [api-key (:qdrant-api-key (config))
id (db/slug-to-db-id (:slug snippet))
host (str (:qdrant-host (config)) "/collections/snippets-dev/points")]
host (str (:qdrant-host (config)) "/collections/" (:qdrant-collection (config)) "/points")]
(t/log! {:level :info :data {:slug (:slug snippet) :id id :host host}} "Saving embedding for snippet")
(http/put host
{:headers {"api-key" api-key}
@ -76,7 +77,7 @@
[slug]
(let [db-id (db/slug-to-db-id slug)
api-key (:qdrant-api-key (config))
host (str (:qdrant-host (config)) "/collections/snippets-dev/points/query")]
host (str (:qdrant-host (config)) "/collections/" (:qdrant-collection (config)) "/points/query")]
(t/log! {:level :info :data {:slug slug :db-id db-id}} "Searching Qdrant for similar snippets")
(when (nil? db-id)
(throw (ex-info "Invalid slug" {:slug slug})))