The Superlinked vector computing library
Project description
Superlinked is a Python framework for AI Engineers building high-performance search & recommendation applications that combine structured and unstructured data.
Quickstart
%pip install superlinked
from superlinked import framework as sl
# Define schema for movie reviews
class Review(sl.Schema):
id: sl.IdField
text: sl.String
review = Review()
space = sl.TextSimilaritySpace(text=review.text, model="all-MiniLM-L6-v2")
index = sl.Index(space)
query = sl.Query(index).find(review).similar(space, sl.Param("search")).select_all()
# Setup and run
source = sl.InMemorySource(review)
app = sl.InMemoryExecutor(sources=[source], indices=[index]).run()
# Add data and search
source.put([
{"id": "1", "text": "Amazing acting and great story"},
{"id": "2", "text": "Boring plot with bad acting"}
])
result = app.query(query, search="excellent performance")
print(sl.PandasConverter.to_pandas(result))
Table of Contents
Overview
- WHY: Improve your vector search relevance by encoding metadata together with your unstructured data into vectors.
- WHAT: A framework and a self-hostable REST API server that connects your data, vector database and backend services.
- HOW: Construct custom data & query embedding models from pre-trained encoders from
sentence-transformers,open-clipand custom encoders for numbers, timestamps and categorical data. See the tutorials and use-case notebooks below for examples.
If you like what we do, give us a star! ⭐
Hands-on Tutorials
💡 Want even more? Browse the complete list of features & concepts in our docs →
https://docs.superlinked.com/concepts/overview
Experiment in a notebook
Let's build an e-commerce product search that understands product descriptions and ratings:
Run the notebook example:
First run will take a minute to download the embedding model.
%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.metadata, indent=2))
# The result is the 5-star rated product.
sl.PandasConverter.to_pandas(result)
Use-cases
Dive deeper with our notebooks into how each use-case benefits from the Superlinked framework.
- RAG: HR Knowledgebase
- Semantic Search: Movies, Business News, Product Images & Descriptions
- Recommendation Systems: E-commerce
- Analytics: User Acquisition, Keyword expansion
You can check a full list of examples here.
Run in production
With a single command you can run Superlinked as a REST API Server locally or in your cloud with Superlinked Server. Get data ingestion and query APIs, embedding model inference and deep vector database integrations for free!
Unify your evaluation, ingestion and serving stacks with a single declarative python codebase. Superlinked enables this by letting you define your data schema, vector indexes and the compute DAG that links them all at once and then choose the right executor for the task - in-memory or server.
If you are interested in learning more about running at scale, Book a demo for early access to our managed cloud.
Supported Vector Databases
Superlinked stores your vectors in your vector database, with deep integrations for:
Curious about vector database pros & cons in general? Our community compared 44 Vector Databases on 30+ features.
Logging
The Superlinked framework logs include contextual information, such as the process ID and package scope. Personally Identifiable Information (PII) is filtered out by default but can be exposed with the SUPERLINKED_EXPOSE_PII environment variable to true.
Resources
- Vector DB Comparison: Open-source collaborative comparison of vector databases by Superlinked.
- VectorHub: VectorHub is a free and open-sourced learning hub for people interested in adding vector retrieval to their ML stack
Support
Need help? We're here to support you:
- Report a bug by creating an issue
- Request a new feature here
- Start a discussion about your ideas or questions
Please create separate issues/discussions for each topic to help us better address your feedback. Thank you for contributing!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file superlinked-37.5.0.tar.gz.
File metadata
- Download URL: superlinked-37.5.0.tar.gz
- Upload date:
- Size: 241.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c567de5b014f05cf5f67d7ae58f7cfeaa6cee617786b35425525eec7ad2e59d
|
|
| MD5 |
0a3e227dbdfdb991371f619adf9dfea3
|
|
| BLAKE2b-256 |
5b29482b5e173f2373373d2fd7bdc43cb31ba445cf0a8b0e39ae39282ce098f4
|
Provenance
The following attestation bundles were made for superlinked-37.5.0.tar.gz:
Publisher:
python.yml on superlinked/superlinked-internal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
superlinked-37.5.0.tar.gz -
Subject digest:
6c567de5b014f05cf5f67d7ae58f7cfeaa6cee617786b35425525eec7ad2e59d - Sigstore transparency entry: 630014763
- Sigstore integration time:
-
Permalink:
superlinked/superlinked-internal@661a95d839abab0b4c4a29839a1ec17d1586bc95 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/superlinked
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
python.yml@661a95d839abab0b4c4a29839a1ec17d1586bc95 -
Trigger Event:
push
-
Statement type:
File details
Details for the file superlinked-37.5.0-py3-none-any.whl.
File metadata
- Download URL: superlinked-37.5.0-py3-none-any.whl
- Upload date:
- Size: 567.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21ab6365758e53e0bea96b1d3635fb50d9381565fe6b0f7795a5182dc71fb721
|
|
| MD5 |
9b8b5bfa4f6091c7d1a02caa72b9bb97
|
|
| BLAKE2b-256 |
f4636606f685aec51275900a5810b133ce1e8297a84e4744c579af9840785ae2
|
Provenance
The following attestation bundles were made for superlinked-37.5.0-py3-none-any.whl:
Publisher:
python.yml on superlinked/superlinked-internal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
superlinked-37.5.0-py3-none-any.whl -
Subject digest:
21ab6365758e53e0bea96b1d3635fb50d9381565fe6b0f7795a5182dc71fb721 - Sigstore transparency entry: 630014767
- Sigstore integration time:
-
Permalink:
superlinked/superlinked-internal@661a95d839abab0b4c4a29839a1ec17d1586bc95 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/superlinked
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
python.yml@661a95d839abab0b4c4a29839a1ec17d1586bc95 -
Trigger Event:
push
-
Statement type: