superlinked
v17.8.0
超級鏈接是AI工程師建立高性能搜索和建議應用程序的Python框架,這些應用程序結合了結構化和非結構化數據。檢查文檔以開始。
sentence-transformers , open-clip和自定義編碼器中構建自定義數據和查詢嵌入模型,以獲取數字,時間戳和分類數據。有關示例,請參見下面的功能和用例筆記本。如果您喜歡我們的工作,請給我們一顆星星!
您可以查看我們的功能和概念的完整列表。
深入了解每個用例如何從超級鏈接的框架中受益。
您可以在此處查看示例的完整列表。
讓我們構建一個電子商務產品搜索,以了解產品描述和評級:
%pip install superlinked
首次運行將需要一分鐘才能下載嵌入式模型。
import json
import os
from superlinked import framework as sl
class Product ( sl . Schema ):
id : sl . IdField
description : sl . String
rating : sl . Integer
product = Product ()
description_space = sl . TextSimilaritySpace (
text = product . description , model = "Alibaba-NLP/gte-large-en-v1.5"
)
rating_space = sl . NumberSpace (
number = product . rating , min_value = 1 , max_value = 5 , mode = sl . Mode . MAXIMUM
)
index = sl . Index ([ description_space , rating_space ], fields = [ product . rating ])
# Define your query and parameters to set them directly at query-time
# or let an LLM fill them in for you using the `natural_language_query` param.
# Don't forget to set your OpenAI API key to unlock this feature.
query = (
sl . Query (
index ,
weights = {
description_space : sl . Param ( "description_weight" ),
rating_space : sl . Param ( "rating_weight" ),
},
)
. find ( product )
. similar (
description_space ,
sl . Param (
"description_query" ,
description = "The text in the user's query that refers to product descriptions." ,
),
)
. limit ( sl . Param ( "limit" ))
. with_natural_query (
sl . Param ( "natural_language_query" ),
sl . OpenAIClientConfig ( api_key = os . environ [ "OPEN_AI_API_KEY" ], model = "gpt-4o" )
)
)
# Run the app in-memory (server & Apache Spark executors available too!).
source = sl . InMemorySource ( product )
executor = sl . InMemoryExecutor ( sources = [ source ], indices = [ index ])
app = executor . run ()
# Ingest data into the system - index updates and other processing happens automatically.
source . put ([
{
"id" : 1 ,
"description" : "Budget toothbrush in black color. Just what you need." ,
"rating" : 1 ,
},
{
"id" : 2 ,
"description" : "High-end toothbrush created with no compromises." ,
"rating" : 5 ,
},
{
"id" : 3 ,
"description" : "A toothbrush created for the smart 21st century man." ,
"rating" : 3 ,
},
])
result = app . query ( query , natural_query = "best toothbrushes" , limit = 1 )
# Examine the extracted parameters from your query
print ( json . dumps ( result . knn_params , indent = 2 ))
# The result is the 5-star rated product.
result . to_pandas ()使用單個命令,您可以在本地或使用超鏈接服務器的雲中作為REST API服務器運行超級鏈接。免費獲取數據攝入和查詢API,嵌入模型推理和Deep向量數據庫集成免費!
用單個聲明的Python代碼庫統一您的評估,攝入和服務堆棧。超級鏈接可以通過讓您定義數據模式,向量索引和Compute DAG來啟用此功能,以一次鏈接它們,然後選擇正確的執行程序來完成任務 - 內存或服務器。
如果您有興趣了解有關大規模運行的更多信息,請預訂演示,以儘早訪問我們的託管雲。
超級鏈接的向量存儲在矢量數據庫中,並深入集成:
一般來說,對矢量數據庫的利弊感到好奇嗎?我們的社區比較了30多個功能的44個矢量數據庫。
超鏈接框架日誌包括上下文信息,例如過程ID和軟件包範圍。默認情況下,默認將個人識別信息(PII)過濾掉,但可以使用SUPERLINKED_EXPOSE_PII環境變量將其暴露於true 。
需要幫助嗎?我們在這裡支持您:
請為每個主題創建單獨的問題/討論,以幫助我們更好地解決您的反饋。謝謝您的貢獻!