Vector Search, Knowledge Graph Storage, Unstructured JSON Storage, Metadata Filtering, all in one, with usage-based pricing and automatic scaling.
TiDB Serverless is a full-featured SQL database for all your AI application needs. One database to rule them all:
Say goodbye to data synchronization, duplication, or maintaining multiple data stores.
1# Define schema
2class Doc(Base):
3 __tablename__ = "doc"
4 id = Column(Integer, primary_key=True)
5 content = Column(Text)
6 embedding = Column(VectorType(dim=3))
7
8# Create table and index
9Base.metadata.create_all(engine)
10VectorAdaptor(engine).create_vector_index(
11 Doc.embedding, tidb_vector.DistanceMetric.L2
12)
13
14# Insert
15with Session(engine) as session:
16 session.add(Doc(content="dog", embedding=[1, 2, 1]))
17 session.add(Doc(content="fish", embedding=[1, 2, 4]))
18 session.commit()
19
20# Search nearest 1 embedding using L2 distance
21with Session(engine) as session:
22 results = session.execute(
23 select(Doc.content)
24 .order_by(Doc.embedding.l2_distance([1, 2, 3]))
25 .limit(1)
26 ).all()
27 print(results)
Build a knowledge graph and generates better answers by reasoning over it. Use OpenAI and DSPy.
Build a semantic search engine using OpenAI embeddings and vector search.
Search for similar images using OpenAI CLIP embeddings.
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh~/.tiup/bin/tiup playground nightly --tag my_vector_db
* Supported platforms: Linux (x64 / ARM64), MacOS (x64 / ARM64)
TiDB works seamlessly with your existing AI stack, serving as a Vector Database and more.
To begin, paste your Connection String into any of the listed integrations for a quick start.
We are in compliance with the latest industry standards: SOC2 Type II and SOC3 certified, EU CoC, PCI DSS and HIPAA compliant.
TiDB Serverless supports Role-based Access Control, Encryption at rest, Private Link, and more.
TiDB Serverless offers 99.9% uptime SLA and Zonal HA by default. Supports cross-AZ HA and automatic backups.