citrus
1.0.0
pip install citrusdb import citrusdb
# Initialize client
citrus = citrusdb . Client ()
# Create index
citrus . create_index (
name = "example" ,
max_elements = 1000 , # increases dynamically as you insert more vectors
) ids = [ 1 , 2 , 3 ]
documents = [
"Your time is limited, so don't waste it living someone else's life" ,
"I'd rather be optimistic and wrong than pessimistic and right." ,
"Running a start-up is like chewing glass and staring into the abyss."
]
citrus . add ( index = "example" , ids = ids , documents = documents )您也可以直接通過向量嵌入。如果您像我們在此處完成的字符串列表,請確保您在環境中擁有OPENAI_API_KEY 。默認情況下,我們使用OpenAI來生成嵌入。如果您正在尋求其他提供商的支持,請聯繫!
results = citrus . query (
index = "example" ,
documents = [ "What is it like to launch a startup" ],
k = 1 ,
include = [ "document" , "metadata" ]
)
print ( results )您可以指定是否要返回關聯的文本文檔和元數據。默認情況下,僅返回ID。
請啟動一個重錄,看看在運行查詢後獲得的結果! result將包含頂部k搜索命中的ids 。
聊天w/ reving ai播客
Pokedex搜索
隨時在此存儲庫上打開問題! Discord服務器即將推出!
PS:柑橘尚未完全分發。我們要到達那裡;)
特別感謝
Devkit-重要的開發人員工具包
DSOC 2023