vecdb
v1.7
ฐานข้อมูลการฝังเวกเตอร์ที่ง่ายมากคุณสามารถพูดได้ว่ามันเป็นตารางแฮชที่ให้คุณค้นหารายการที่คล้ายกับรายการที่คุณกำลังค้นหา
ฉันเป็นผู้ที่ชื่นชอบฐานข้อมูลและนี่เป็นโครงการเพื่อความสนุกสนานและการเรียนรู้ที่สามารถใช้ในการผลิต;)
PS : ฉันชอบคิดค้นล้อใหม่ในเวลาว่างเพราะมันเป็นเวลาว่างของฉัน!
ฉันใช้โมเดล
{key => value}
keyควรเป็นค่าที่ไม่ซ้ำกันซึ่งแสดงถึงรายการvalueควรเป็นเวกเตอร์เอง (รายการลอย)
โดยค่าเริ่มต้น
vecdbจะค้นหาconfig.ymlในไดเรกทอรีการทำงานปัจจุบัน แต่คุณสามารถแทนที่ได้โดยใช้--config /path/to/config.ymlFlag โดยการให้เส้นทางไฟล์ที่กำหนดเองของคุณเอง
# 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 เมื่อคุณมีเวกเตอร์และต้องการแสดงรายการคีย์/รหัสของเวกเตอร์ที่คล้ายกันทั้งหมดที่สั่งโดยความคล้ายคลึงกันของโคไซน์ในลำดับจากมากไปน้อยPOST /v1/embeddings/text/write เมื่อคุณมีข้อความและต้องการให้ vecdb สร้างและจัดเก็บเวกเตอร์สำหรับคุณโดยใช้ Embedder ที่กำหนดค่า (ราศีเมถุนตอนนี้)POST /v1/embeddings/text/search เมื่อคุณมีข้อความและต้องการให้ vecdb สร้างเวกเตอร์และค้นหากุญแจของเวกเตอร์ที่คล้ายกันสำหรับคุณที่สั่งโดยความคล้ายคลึงกันของโคไซน์ตามลำดับจากมากไปน้อย {
"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)
}