Created
November 4, 2024 12:55
-
-
Save pdenno/afecebd31ef721710408884945e00b3d to your computer and use it in GitHub Desktop.
vector store for openai-clojure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Vector stores (beta) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(defn create-vector-store | |
"Create a vector store. | |
Example: | |
``` | |
(create-vector-store {:name \"Support FAQ\" :file-ids [\"file-id-123\"]}) | |
``` | |
Also see the [OpenAI documentation](https://platform.openai.com/docs/api-reference/vector-stores/create) | |
" | |
([params] | |
(create-vector-store params nil)) | |
([params options] | |
(let [opts (assoc-in options [:openai-beta] ASSISTANTS_HTTP_HEADER_STR)] | |
(core/response-for :create-vector-store params opts)))) | |
(defn list-vector-stores | |
"Returns a list of vector stores. | |
Example: | |
``` | |
(list-vector-stores) | |
``` | |
Also see the [OpenAI documentation](https://platform.openai.com/docs/api-reference/vector-stores/list) | |
" | |
([params] | |
(list-vector-stores params nil)) | |
([params options] | |
(let [opts (assoc-in options [:openai-beta] ASSISTANTS_HTTP_HEADER_STR)] | |
(core/response-for :list-vector-stores params opts)))) | |
;;; This raises an error "Could not find route :retrieve-vector-store" | |
;;; Instead of calling this function, I think you can call modify-vector-store with params specifying just :vector_store_id. | |
#_(defn retrieve-vector-store | |
"Retrieves a vector store. | |
Example: | |
``` | |
(retrieve-vector-store {:vector_store_id \"vs_abc123\"}) | |
``` | |
Also see the [OpenAI documentation](https://platform.openai.com/docs/api-reference/vector-stores/retrieve) | |
" | |
([params] | |
(retrieve-vector-store params nil)) | |
([params options] | |
(let [opts (assoc-in options [:openai-beta] ASSISTANTS_HTTP_HEADER_STR)] | |
(core/response-for :retrieve-vector-store params opts)))) | |
(defn modify-vector-store | |
"Modifies a vector store. | |
Example: | |
``` | |
(modify-vector-store {:vector_store_id \"vs_abc123\" :name \"Support FAQ\"}) | |
``` | |
Also see the [OpenAI documentation](https://platform.openai.com/docs/api-reference/vector-stores/modify) | |
" | |
([params] | |
(modify-vector-store params nil)) | |
([params options] | |
(let [opts (assoc-in options [:openai-beta] ASSISTANTS_HTTP_HEADER_STR)] | |
(core/response-for :modify-vector-store params opts)))) | |
(defn delete-vector-store | |
"Deletes a vector store. | |
Example: | |
``` | |
(delete-vector-store {:vector_store_id \"vs_abc123\"}) | |
``` | |
Also see the [OpenAI documentation](https://platform.openai.com/docs/api-reference/vector-stores/delete) | |
" | |
([params] | |
(delete-vector-store params nil)) | |
([params options] | |
(let [opts (assoc-in options [:openai-beta] ASSISTANTS_HTTP_HEADER_STR)] | |
(core/response-for :delete-vector-store params opts)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment