博客 / 詳情

返回

DocArray 0.21.0版本發佈!新增OpenSearch後端存儲,支持Redis後端存儲的多語言文本搜索!

github.com/docarray/docarray

DocArray 是一個用於處理、傳輸和存儲多模態數據的 Python 工具包。DocArray 提供便捷的多模態數據處理功能,具備基於 Protobuf 提供高性能的網絡傳輸性能,同時也為多種向量存儲方案提供統一的 API 接口。

💡 DocArray 於 2022 年 1 月在開源 Apache 許可證 2.0 下發布。目前,它是 LF AI \& Data Foundation 下的沙盒項目。
🌟 GitHub: https://github.com/docarray
🧑‍🤝‍🧑 Discord社區: https://discord.gg/WaMp6PVPgR
📖 官方文檔:https://docarray.jina.ai/

此版本包含 3 項新功能,7 項錯誤修正和 5 項文檔改進。

新功能

📦 OpenSearch 後端存儲(#853)

現在 DocArray 增加了一個新的後端存儲:OpenSearch!您可以使用 OpenSearch 後端存儲對 Document 進行索引,並對它們進行 ANN 搜索

from docarray import Document, DocumentArray  
import numpy as np  
  
# Connect to OpenSearch instance  
n_dim = 3  
  
da = DocumentArray(  
    storage='opensearch',  
    config={'n_dim': n_dim},  
)  
  
# Index Documents  
with da:  
    da.extend(  
        [  
            Document(id=f'r{i}', embedding=i * np.ones(n_dim))  
            for i in range(10)  
        ]  
    )  
  
# Perform ANN search  
np_query = np.ones(n_dim) * 8  
results = da.find(np_query, limit=10)  

此外,OpenSearch 後端存儲還支持 過濾查詢按文本搜索 和 按標籤搜索。有關其用法的更多信息,請參閲 官方文檔。

🎨 增加 Point Cloud 顯示的顏色(#961)

現在您可以在 point cloud 數據中包含顏色信息,可以使用 display_point_cloud_tensor()可視化:

`coords = np.load('a_red_motorbike/coords.npy')
colors = np.load('a_red_motorbike/coord_colors.npy')

doc = Document(
    tensor=coords,
    chunks=DocumentArray([Document(tensor=colors, name='point_cloud_colors')])
)
doc.display()
`

🌎 支持 Redis 後端存儲的多語言文本搜索(#953)

Redis 後端存儲現在支持各種支持的語言的文本搜索。要設置所需語言,請在 Redis 配置中更改語言參數:

da = DocumentArray(  
    storage='redis',  
    config={  
        'n_dim': 128,  
        'index_text': True,  
        'language': 'chinese',  
    },  
)  

錯誤修正 🐞

1. 用空格替換換行符來修復圖像中的顯示(#963)

當文檔字段中包含字符串'\n'時,doc.plot()會導致渲染錯誤。這次修復了這些錯誤,將'\n'渲染為空格。

2. 修正to_pydantic_model()中不需要的強制轉換(#949)

此錯誤導致當調用 to_pydantic_model()to_dict() 時,所有形式為 'Infinity' 的字符串都會被強制轉換為字符串 'inf'。現在已經修復,這些字符串將保留不變。

3. 在索引上而不是查詢上計算相關文檔(#950)

embed_and_evaluate()方法中,每個標籤的相關文檔數量原先是基於 document 自身計算的。這不一般正確,因此在此修復之後,根據索引數據中的文檔計算量。

4. 刪除列表類型偏移索引創建(#936)

當文檔存儲禁用了列表行為的功能時,它不再創建 id 映射的偏移量,這提高了性能。

5. 添加對遠程音頻文件的支持(#933)

從遠程 URL 加載音頻文件會導致 FileNotFoundError,現在已經修復。

6. 查詢運算符$exists與標籤不正確(#911)(#923)

在修復之前,$exists 會將 false-y 值(如 0[])視為不存在。現在已經修復。

7. 從單例列表中的數據類獲取文檔(#1018)

當使用 dataclass 創建多模態 Document 時,即使相應字段被註釋為 List[...],單例的列表也被視為單個元素。現在我們已經考慮了這種情況,即使對於單一輸入,訪問這樣的字段也將是產生 DocumentArray。

文檔改進 📗

  • 新增 DocArray Discord 社區鏈接(#1010)
  • 減少版本以避免部署超時(#977)
  • 修正數據管理部分在文檔中未出現(#967)
  • 在側邊欄中鏈接到 OpenSearch 文檔(#960)
  • 將“多模態”修改為“數據類型”(#934)

貢獻者 🤟

我們要感謝本次發佈的所有貢獻者!

  • Jay Bhambhani (@jay-bhambhani)
  • Alvin Prayuda (@alphinside)
  • Johannes Messner (@JohannesMessne)
  • samsja (@samsja)
  • Marco Luca Sbodio (@marcosbodio)
  • Anne Yang (@AnneYang720)
  • AlaeddineAbdessalem (@alaeddine-13)
  • Han Xiao (@hanxiao)
  • Alex Cureton-Griffiths (@alexcg1)
  • Charlotte Gerhaher (@anna-charlotte)

user avatar
0 位用戶收藏了這個故事!

發佈 評論

Some HTML is okay.