TiDB User Day 2024のアーカイブ動画を公開中!詳細を見る

MySQL & Vector All in One

Eliminate redundancy. Store vector embeddings alongside MySQL data directly. No new DB, no data duplication. Just SQL simplicity.

Join Multi-model Data with Ease

Leverage familiar SQL to join, index, and query operational and vector data together, enabling advanced semantic searches with ease.

Vast Array of Use Cases

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

llamaIndex
dify
leptonAI
langChain
jido
bentoML
npiAI
hugging
openAI
cohere

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
Create table and vector index
Create embedding vector and save data
Retrieve content
                                
engine = create_engine(your_tidb_url)
                                
                            
                                
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)
                                
                            
                                
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()
                                
                            
                                
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)
                                
                            
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)
                                
                            

Key Use Cases Where Scalability
and Vector Search Meet

Real-Time Recommendation Systems

Understand user preferences and similarities between products to deliver accurate recommendations

Chatbots and Virtual Assistants

Handle numerous concurrent customer interactions using vector search to provide quick and accurate responses

Image and Video Recognition

Implement robust image and video analysis for content moderation

NLP Applications

Perform sentiment analysis, language translation, and text summarization for more accurate processing

Ad Targeting and Personalization

Analyze user behavior and preferences to serve the most relevant ads

Discover More

Want to dive deeper into distributed SQL, TiDB, and TiDB Dedicated?
Access tutorials, guides, example applications, and much more.
Read
Peer under the hood and discover how TiDB works.
Learn
Stay connected, get help, and contribute.
Join
soc