vecdb
v1.7
非常にシンプルなベクトル埋め込みデータベースは、検索しているアイテムに似たアイテムを見つけることができるハッシュテーブルであると言えます。
私はデータベース愛好家であり、これは生産で使用できる楽しく学習プロジェクトのためのものです;)。
PS :自由時間にホイールを再発明するのが好きです。それは私の自由な時間だからです!
{key => value}モデルを使用しています。
keyアイテムを表す一意の値である必要があります。valueベクトル自体(フロートのリスト)でなければなりません。
デフォルトでは、現在の作業ディレクトリの
config.ymlをvecdb検索します。ただし、独自のカスタムファイルパスを提供することにより、--config /path/to/config.ymlフラグを使用してオーバーライドできます。
# http server related configs
server :
# the address to listen on in the form of '[host]:port'
listen : " 0.0.0.0:3000 "
# storage related configs
store :
# the driver you want to use
# currently vecdb supports "bolt" which is based on boltdb the in process embedded the database
driver : " bolt "
# the arguments required by the driver
# for bolt, it requires a key called `database` points to the path you want to store the data in.
args :
database : " ./vec.db "
# embeddings related configs
embedder :
# whether to enable the embedder and all endpoints using it or not
enabled : true
# the driver you want to use, currently vecdb supports gemini
driver : gemini
# the arguments required by the driver
# currently gemini driver requires `api_key` and `text_embedding_model`
args :
# by default vecdb will replace anything between ${..} with the actual value from the ENV var
api_key : " ${GEMINI_API_KEY} "
text_embedding_model : " text-embedding-004 "POST /v1/vectors/writeに送信して、ベクトルがあり、どこかに保管したい場合。POST /v1/vectors/searchに送信し、ベクトルがあり、COSINEの類似性によって注文されたすべての類似のベクターのキー/IDを降順で並べ替えたい場合。vecdbベクトルを構築および保存したい場合は、textembeddingWriterequestをPOST /v1/embeddings/text/writeに送信します。vecdbベクトルを構築し、並べ替え順序でCosineの類似性によって注文された同様のベクターのキーを検索する場合、テキストPOST /v1/embeddings/text/search textembeddingsearchRequestを投稿して/v1/embeddings/text/searchに送信します。 {
"bucket" : "BUCKET_NAME" , // consider it a collection or a table
"key" : "product-id-1" , // should be unique and represents a valid value in your main data store (example: the row id in your mysql/postgres ... etc)
"vector" : [ 1.929292 , 0.3848484 , - 1.9383838383 , ... ] // the vector you want to store
} {
"bucket" : "BUCKET_NAME" , // consider it a collection or a table
"vector" : [ 1.929292 , 0.3848484 , - 1.9383838383 , ... ] , // you will get a list ordered by cosine-similarity in descending order
"min_cosine_similarity" : 0.0 , // the more you increase, the fewer data you will get
"max_result_count" : 10 // max vectors to return (vecdb will first order by cosine similarity then apply the limit)
}
embedder.enabledをtrueに設定した場合。
{
"bucket" : "BUCKET_NAME" , // consider it a collection or a table
"key" : "product-id-1" , // should be unique and represents a valid value in your main data store (example: the row id in your mysql/postgres ... etc)
"content" : "This is some text representing the product" // this will be converted to a vector using the configured embedder
}
embedder.enabledをtrueに設定した場合。
{
"bucket" : "BUCKET_NAME" , // consider it a collection or a table
"content" : "A Product Text" , // you will get a list ordered by cosine-similarity in descending order
"min_cosine_similarity" : 0.0 , // the more you increase, the fewer data you will get
"max_result_count" : 10 // max vectors to return (vecdb will first order by cosine similarity then apply the limit)
}