New

Parallel Exploration by AI Agents

This demo showcases parallel exploration by AI Agents, where agents build concurrently. This is made possible by TiDB’s ability to branch the entire application state database, memory, and context instantly and efficiently.

Key Capabilities Shown:

  • Concurrent Solution Exploration: Watch multiple AI agents build and iterate on solutions simultaneously.
  • Autonomous Pathfinding: See the system intelligently select the best paths for further refinement.
  • Instant State Forking & Time Travel: Instantly branch, compare, and revert to any version of the application state.

Explore What You Can Build with TiDB for AI

Feature-Based AI Use Cases

Explore fundamental patterns for AI applications. Each example includes the code you need to get started right away.

Semantic Search & RAG

Create AI assistants that understand context and meaning, not just keywords, using vector embeddings and retrieval-augmented generation.


class Chunk(TableModel):
    __tablename__ = "chunks"

    id: int = Field(primary_key=True)
    text: str = Field()
    text_vec: list[float] = text_embed.VectorField(
        source_field="text",
    )
    meta: dict = Field(sa_type=JSON)

table = db.create_table(schema=Chunk, if_exists="overwrite")

results = (
    table.search(query_text)
    .debug(True)
    .filter({"meta.language": language})
    .distance_threshold(distance_threshold)
    .limit(query_limit)
    .to_list()
)
                                                

Image & Text Search

Enable multimodal search experiences where users can find images using text descriptions or discover similar visual content effortlessly.


class Pet(TableModel):
    __tablename__ = "pets"

    id: int = Field(primary_key=True)
    breed: str = Field()
    image_uri: str = Field()
    image_name: str = Field()
    image_vec: Optional[List[float]] = embed_fn.VectorField(
        distance_metric=DistanceMetric.L2,
        source_field="image_uri",
        source_type="image",
    )

results = (
    table.search(query="fluffy orange cat")
    .distance_metric(DistanceMetric.L2)
    .limit(limit)
    .to_list()
)
                                                

Hybrid Search

Get the best of both worlds by merging traditional full-text search with modern vector similarity for comprehensive, accurate results.


# Define table schema
class Document(TableModel):
    __tablename__ = "documents"

    id: int = Field(primary_key=True)
    text: str = FullTextField()
    text_vec: list[float] = embed_fn.VectorField(
        source_field="text",
    )
    meta: dict = Field(sa_type=JSON)

query = (
    table.search(query_text, search_type="hybrid")
    .distance_threshold(0.8)
    .fusion(method="rrf")
    .limit(limit)
)
                                                

Auto Embedding

Transform your text, images, and documents into searchable vectors without manual preprocessing or complex embedding pipeline setup.


# Define embedding function
embed_func = EmbeddingFunction(
    model_name="tidbcloud_free/amazon/titan-embed-text-v2"
    # No API key required for TiDB Cloud free models
)

class Chunk(TableModel):
    __tablename__ = "chunks"

    id: int = Field(primary_key=True)
    text: str = Field(sa_type=TEXT)
    text_vec: list[float] = embed_func.VectorField(source_field="text")

table = db.create_table(schema=Chunk, if_exists="overwrite")

# Insert sample data - embeddings generated automatically
table.bulk_insert([
    Chunk(text="TiDB is a distributed database that supports OLTP, OLAP, HTAP and AI workloads."),
    Chunk(text="PyTiDB is a Python library for developers to connect to TiDB."),
    Chunk(text="LlamaIndex is a Python library for building AI-powered applications."),
])
                                                

Real-time Vector Search

Automatically embed product data and deliver personalized recommendations that update in real-time as your inventory changes, without complex pipelines.


class Product(TableModel):
    __tablename__ = "products"

    id: int = Field(primary_key=True)
    name: str = Field(sa_type=TEXT)
    description: str = Field(sa_type=TEXT)
    description_vec: list[float] = embed_func.VectorField(
        source_field="description"
    )
    category: str = Field(sa_type=TEXT)
    price: float = Field()

table = db.create_table(schema=Product, if_exists="overwrite")

# App-1 is inserting strings and vectors are auto-generated in real-time
table.insert(Product(
    name="Professional Basketball",
    description="High-quality basketball for professional and amateur players",
    category="Sports",
    price=29.99
))

# App-2 is searching at once using semantic similarity with user preferences
recommendations = (
    table.search(user_profile)
    .distance_threshold(distance_threshold)
    .limit(5)
    .to_list()
)
                                                

Semantic Search & RAG

Create AI assistants that understand context and meaning, not just keywords, using vector embeddings and retrieval-augmented generation.


class Chunk(TableModel):
    __tablename__ = "chunks"

    id: int = Field(primary_key=True)
    text: str = Field()
    text_vec: list[float] = text_embed.VectorField(
        source_field="text",
    )
    meta: dict = Field(sa_type=JSON)

table = db.create_table(schema=Chunk, if_exists="overwrite")

results = (
    table.search(query_text)
    .debug(True)
    .filter({"meta.language": language})
    .distance_threshold(distance_threshold)
    .limit(query_limit)
    .to_list()
)
                                    

Image & Text Search

Enable multimodal search experiences where users can find images using text descriptions or discover similar visual content effortlessly.


class Pet(TableModel):
    __tablename__ = "pets"

    id: int = Field(primary_key=True)
    breed: str = Field()
    image_uri: str = Field()
    image_name: str = Field()
    image_vec: Optional[List[float]] = embed_fn.VectorField(
        distance_metric=DistanceMetric.L2,
        source_field="image_uri",
        source_type="image",
    )

results = (
    table.search(query="fluffy orange cat")
    .distance_metric(DistanceMetric.L2)
    .limit(limit)
    .to_list()
)
                                    

Hybrid Search

Get the best of both worlds by merging traditional full-text search with modern vector similarity for comprehensive, accurate results.


# Define table schema
class Document(TableModel):
    __tablename__ = "documents"

    id: int = Field(primary_key=True)
    text: str = FullTextField()
    text_vec: list[float] = embed_fn.VectorField(
        source_field="text",
    )
    meta: dict = Field(sa_type=JSON)

query = (
    table.search(query_text, search_type="hybrid")
    .distance_threshold(0.8)
    .fusion(method="rrf")
    .limit(limit)
)
                                    

Auto Embedding

Transform your text, images, and documents into searchable vectors without manual preprocessing or complex embedding pipeline setup.


# Define embedding function
embed_func = EmbeddingFunction(
    model_name="tidbcloud_free/amazon/titan-embed-text-v2"
    # No API key required for TiDB Cloud free models
)

class Chunk(TableModel):
    __tablename__ = "chunks"

    id: int = Field(primary_key=True)
    text: str = Field(sa_type=TEXT)
    text_vec: list[float] = embed_func.VectorField(source_field="text")

table = db.create_table(schema=Chunk, if_exists="overwrite")

# Insert sample data - embeddings generated automatically
table.bulk_insert([
    Chunk(text="TiDB is a distributed database that supports OLTP, OLAP, HTAP and AI workloads."),
    Chunk(text="PyTiDB is a Python library for developers to connect to TiDB."),
    Chunk(text="LlamaIndex is a Python library for building AI-powered applications."),
])
                                    

Real-time Vector Search

Automatically embed product data and deliver personalized recommendations that update in real-time as your inventory changes, without complex pipelines.


class Product(TableModel):
    __tablename__ = "products"

    id: int = Field(primary_key=True)
    name: str = Field(sa_type=TEXT)
    description: str = Field(sa_type=TEXT)
    description_vec: list[float] = embed_func.VectorField(
        source_field="description"
    )
    category: str = Field(sa_type=TEXT)
    price: float = Field()

table = db.create_table(schema=Product, if_exists="overwrite")

# App-1 is inserting strings and vectors are auto-generated in real-time
table.insert(Product(
    name="Professional Basketball",
    description="High-quality basketball for professional and amateur players",
    category="Sports",
    price=29.99
))

# App-2 is searching at once using semantic similarity with user preferences
recommendations = (
    table.search(user_profile)
    .distance_threshold(distance_threshold)
    .limit(5)
    .to_list()
)
                                    

Real-World Implementation Cases

Business build with TiDB for the problems that matter most.

Conversational BI

"To democratize data access, we need semantic understanding and SQL precision. TiDB makes real conversational analytics possible."

AI Sales Employee

"With TiDB's unified data automation, we created a truly intelligent digital employee that helps our users win."

GraphRAG System

"With GraphRAG on TiDB, we moved from simple keyword search to true contextual understanding. The operational impact was immediate."

Real-Time Analytics

"We used to store raw survey data then aggregate separately. Now we use one process to store and aggregate on the fly."

Hands-On Labs & Tutorials

Get hands-on with TiDB through our curated sandbox projects. Deploy complete applications in minutes and explore AI-powered database capabilities.

60 Min
Beginner
Vector Search with Jupyter

Learn to build AI apps with vector embeddings, RAG, hybrid search, and GraphRAG using TiDB Cloud Starter in 60 minutes.

Python
Jupyter
Vector Search
RAG
90 Min
Intermediate
RAG + Text2SQL with OpenAI

Build intelligent apps that retrieve information and translate natural language to SQL using OpenAI models and TiDB Cloud Starter.

Python
OpenAI
Streamlit
Text2SQL
60 Min
Advanced
GraphRAG AI Agent with OpenAI

Create advanced AI agents with graph-enhanced retrieval and tool calling capabilities using OpenAI and TiDB Cloud Starter integration.

Python
OpenAI
DSPy
GraphRAG
90 Min
Intermediate
RAG + Text2SQL with Bedrock

Develop AI applications with Amazon Bedrock models for retrieval-augmented generation and natural language query translation capabilities.

Python
AWS Bedrock
Streamlit
Text2SQL
90 Min
Intermediate
Unified AI Storage (Amazon Bedrock)

Experience the simplicity of using TiDB as single storage solution versus managing multiple databases for GenAI applications.

Python
AWS Bedrock
PyTiDB
90 Min
Intermediate
Unified AI Storage (OpenAI)

Compare multi-database complexity with TiDB's unified approach for GenAI applications using OpenAI models and simplified development workflows.

Python
OpenAI
OpenAI
CTA
Don't See Your Use Case Here?

Get hands-on help from our experts to prototype your specific AI application with TiDB Cloud Starter.

Community Contributions

Discover amazing projects built by our community. From developer tools to production applications, see what's possible with TiDB's AI-powered capabilities.

FamCare
By Pratik Sharma

AI-powered RAG for healthcare management. Uses TiDB to organize documents, create smart schedules, and power family health chat.

React, TypeScript, Python
healthcare
RAG
AutoIR: Agentic Incident Response
By Younes Laaroussi

Serverless incident response system using TiDB vector search to ingest logs, triage incidents, and generate explainable reports.

Node.js, TypeScript
devops
AWS
vector-search
AI Member of Parliament
By Jianzhi Wang

Event-driven agentic system that automates workflows by finding similar past cases with TiDB vector search and generating appeal letters.

Python
government
ai-agents
vector-search
Heydesk
By Manasseh Zwane

Agentic customer support platform using a custom .NET SDK for TiDB Vector Search to power intelligent ticket routing and real-time chat.

C#, .NET 9, React, TypeScript
customer-support
real-time chat
vector-search
ElitOrcAI
By N DIVIJ

AI clinical decision support that analyzes medical images and uses TiDB for vector similarity search on cases to provide diagnostic guidance.

TypeScript, Next.js
healthcare
medical-imaging
ai-diagnosis

Join Our Growing Community

Connect with developers building the future with TiDB.

Github stars
39K

GitHub stars

Community Members
25K

Community Members

Contributor
900+

Contributors

Projects
500+

Projects