The Most Advanced SQL-compatible Vector SolutionPublic Beta
TiDB is introducing a built-in vector search to the SQL database family, enabling support for your AI applications without requiring a new database or additional technical stacks. With vectors as a new data type in MySQL, you can now store and search for vectors directly using SQL.
Eliminate redundancy. Store vector embeddings alongside MySQL data directly. No new DB, no data duplication. Just SQL simplicity.
Leverage familiar SQL to join, index, and query operational and vector data together, enabling advanced semantic searches with ease.
Powering RAG, semantic searches and more, with integrations like OpenAI, Hugging Face, LangChain, and LlamaIndex, etc.
Comprehensive ecosystem of AI Integrations
Simplify your development process by leveraging TiDB's seamless integrations with leading AI vendors and frameworks
Experience Superior Search and AI Performance
with TiDB
Semantic search with high performance and accuracy
Leverage your existing MySQL expertise to seamlessly integrate advanced vector search
- Knowledge graph integration to improve query performance
- Auto scaling to support resource-intensive AI workloads
- Columnar data store
Unified database solution for enhanced developer experience
Simplify your tech stack with a single, scalable database for both traditional and AI workloads
- Serverless to get started instantly
- Supports transactional, analytical and vector search workloads
- Native integrations with OpenAI, LlamaIndex, HuggingFace etc.
MySQL compatible
Leverage your existing MySQL expertise to seamlessly integrate advanced vector search
- New “Vector” datatype and similarity search indexes
- Store data and vector embeddings together
- Join, index, and query both operational and vector data with SQL
Simplest way to create end-to-end
RAG-Enabled Search Apps
TiDB's vector search capabilities make it incredibly easy to integrate Retrieval-Augmented Generation (RAG) into your applications
Connect to a TiDB cloud cluster
engine = create_engine(your_tidb_url)
Create table and vector index
class Entity(Base):
__tablename__ = "entity"
id = Column(Integer, primary_key=True)
content = Column(Text)
content_vec = Column(
VectorType(dim=dim_of_embedding_model),
comment="hnsw(distance=l2)"
)
Base.metadata.create_all(engine)
Create embedding vector and save data
content = 'TiDB is an open-source distributed SQL database'
open_ai_client = openai.OpenAI(api_key=open_ai_api_key)
embedding = open_ai_client.embeddings.create(
input=[content], model=model_name).data[0].embedding
with Session(engine) as session:
session.add(Entity(content = content, content_vec = embedding))
session.commit()
Retrieve content
query = 'What is TiDB?'
embedding_query = open_ai_client.embeddings.create(
input=[query], model=model_name).data[0].embedding
with Session(engine) as session:
entity = session.query(Entity).order_by(
Entity.content_vec.cosine_distance(embedding_query)
).limit(1).first()
print(entity.content)
Discover More
Want to dive deeper into distributed SQL, TiDB, and TiDB Dedicated?