Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Development Guide

This guide covers the development setup and maintenance of the TiDB for AI documentation site.

## Quick Start

1. **Install UV** (fast dependency manager):

```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```

2. **Install dependencies**:

```bash
make install
```

3. **Start development server**:

```bash
make serve
```

## Project Structure

```
├── demos.yml # Demo Gallery configuration
├── scripts/generate_demos.py # Demo Gallery generation script
├── src/
│ ├── templates/ # Jinja2 templates
│ └── ai/examples/ # Generated demo pages
└── Makefile # Build commands
```

## Helpful Commands

```bash
# Dependencies
make check # Check dependencies and setup
make install # Install/update dependencies

# Development workflow
make serve # Start development server
make build # Build documentation site
make clean # Clean build artifacts

# Demo management
make generate-demos # Generate demo pages and gallery from demos.yml config
make generate-demo-pages # Only generate demo pages.
make generate-demo-gallery # Only generate demo gallery.

# Other
make help # Show all available commands
```

## Maintain the Demo Gallery

The Demo Gallery showcases AI demos of TiDB and is configured via [demos.yml](demos.yml).

To regenerate the demo gallery from configuration, run:

```bash
make generate-demos
```

### How to add a new demo

You can follow the steps below to add a new demo:

1. Add entry to `demos` array in `demos.yml` with unique `id`, title, description, and display properties

For example:

```yaml
demos:
- id: "basic"
title: "Basic Usage"
description: "Learn fundamental PyTiDB operations"
icon: "⚙️"
background: "linear-gradient(135deg, #10b981, var(--brand-color))"
link: "basic-with-pytidb/"
doc_link: "https://github.com/pingcap/pytidb/tree/main/examples/basic/README.md"
cover_image: null
```

2. Add the demo `id` to appropriate category's `demos` array

For example:

```yaml
categories:
- id: "featured"
title: "Search"
demos: ["image-search"]
```

3. Run `make generate-demos` to regenerate
4. Commit changes
47 changes: 47 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# TiDB for AI Documentation Site

.PHONY: help install generate-demos generate-demo-pages generate-demo-gallery serve build clean check

help:
@echo "TiDB for AI Documentation Site"
@echo "============================="
@echo "Available commands:"
@echo " install - Install dependencies using UV"
@echo " generate-demos - Generate demo pages and gallery from demos.yml config"
@echo " generate-demo-pages - Only generate demo pages."
@echo " generate-demo-gallery - Only generate demo gallery."
@echo " serve - Start the development server"
@echo " build - Build the documentation site"
@echo " clean - Clean build artifacts"
@echo " check - Check dependencies and project setup"
@echo ""
@echo "Demo gallery configuration:"
@echo " Edit demos.yml in the project root to manage gallery content"
@echo ""
@echo "Prerequisites:"
@echo " UV package manager - curl -LsSf https://astral.sh/uv/install.sh | sh"

install:
uv pip install -e .

generate-demos:
python scripts/generate_demos.py

generate-demo-pages:
python scripts/generate_demos.py --skip-gallery

generate-demo-gallery:
python scripts/generate_demos.py --skip-demos

serve:
mkdocs serve

build:
mkdocs build

clean:
rm -rf site/
rm -rf .mkdocs_cache/

check:
python scripts/check_dependencies.py
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,25 @@ To install the TiDB Python SDK, run the following command:
pip install pytidb
```

Examples:

- Getting Started: [Quickstart](https://pingcap.github.io/ai/examples/quickstart-with-pytidb/), [Basic Usage](https://pingcap.github.io/ai/examples/basic-with-pytidb/)
- Search & Retrieval: [Vector Search](https://pingcap.github.io/ai/examples/vector-search-with-pytidb/), [Fulltext Search](https://pingcap.github.io/ai/examples/fulltext-search-with-pytidb/), [Hybrid Search](https://pingcap.github.io/ai/examples/hybrid-search-with-pytidb/)
- AI Applications: [RAG](https://pingcap.github.io/ai/examples/rag-with-pytidb/), [Text2SQL](https://pingcap.github.io/ai/examples/text2sql-with-pytidb/), [Memory](https://pingcap.github.io/ai/examples/memory-with-pytidb/)
- Advanced Features: [Auto Embedding](https://pingcap.github.io/ai/examples/auto-embedding-with-pytidb/), [Image Search](https://pingcap.github.io/ai/examples/image-search-with-pytidb/)


Integrations:

- AI Frameworks: [LlamaIndex](https://docs.pingcap.com/tidbcloud/vector-search-integrate-with-llamaindex/), [LangChain](https://docs.pingcap.com/tidbcloud/vector-search-integrate-with-langchain/)
- ORM Libraries: [SQLAlchemy](https://docs.pingcap.com/tidbcloud/vector-search-integrate-with-sqlalchemy/), [Django-ORM](https://docs.pingcap.com/tidbcloud/vector-search-integrate-with-django-orm/), [Peewee](https://docs.pingcap.com/tidbcloud/vector-search-integrate-with-peewee/)
- AI Services: [Bedrock](https://docs.pingcap.com/tidbcloud/vector-search-integrate-with-amazon-bedrock/)
- Embedding Models/Services: [JinaAI](https://docs.pingcap.com/tidbcloud/vector-search-integrate-with-jinaai-embedding/)

## Contribute

We welcome contributions to improve the TiDB for AI documentation! For development setup, maintenance scripts, and detailed contribution guidelines, please see [DEVELOPMENT.md](DEVELOPMENT.md).

## FAQ

### How can I get support?
Expand Down
131 changes: 131 additions & 0 deletions demos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Demo Gallery Configuration
title: "Demo Gallery"
description: |
Explore hands-on demos showcasing how TiDB empowers AI applications.<br>
Get started quickly with <a href='https://tidbcloud.com/?utm_source=github&utm_medium=referral&utm_campaign=demo_gallery' target='_blank' rel='noopener noreferrer' class='gallery-cta-link'><b>TiDB Cloud Serverless</b></a> to build your own AI-powered solutions.

meta:
description: "Explore hands-on demos showcasing how TiDB empowers AI applications. Get started quickly with TiDB Cloud Serverless to build your own AI-powered solutions."

categories:
- id: "featured"
title: "⭐ Featured"
demos: ["image-search", "rag", "memory"]

- id: "getting-started"
title: "🚀 Getting Started"
demos: ["basic", "auto-embedding"]

- id: "search"
title: "🔍 Search & Retrieval"
demos: ["vector-search", "fulltext-search", "hybrid-search", "image-search"]

- id: "ai-apps"
title: "🤖 AI Applications"
demos: ["rag", "memory", "text2sql"]

demos:

- id: "image-search"
title: "Image Search"
description: "Build an image search application using multimodal embeddings for both text-to-image and image-to-image search."
category: "search"
icon: null
background: null
link: "image-search-with-pytidb/"
doc_link: "https://github.com/pingcap/pytidb/tree/main/examples/image_search/README.md"
cover_image: "https://github.com/user-attachments/assets/7ba9733a-4d1f-4094-8edb-58731ebd08e9"

- id: "rag"
title: "RAG"
description: "Build a RAG application that combines document retrieval with language generation."
category: "ai-apps"
icon: null
background: null
link: "rag-with-pytidb/"
doc_link: "https://github.com/pingcap/pytidb/tree/main/examples/rag/README.md"
cover_image: "https://github.com/user-attachments/assets/dfd85672-65ce-4a46-8dd2-9f77d826363e"

- id: "basic"
title: "Basic Usage"
description: "Learn fundamental PyTiDB operations including database connection, table creation, and data manipulation."
category: "getting-started"
icon: "⚙️"
background: "linear-gradient(135deg, #10b981, var(--brand-color))"
link: "basic-with-pytidb/"
doc_link: "https://github.com/pingcap/pytidb/tree/main/examples/basic/README.md"
cover_image: null

- id: "auto-embedding"
title: "Auto Embedding"
description: "Automatically generate embeddings for your text data using built-in embedding models."
category: "getting-started"
icon: "🤖"
background: "radial-gradient(circle at center, #8b5cf6 0%, var(--brand-color) 100%)"
link: "auto-embedding-with-pytidb/"
doc_link: "https://github.com/pingcap/pytidb/tree/main/examples/auto_embedding/README.md"
cover_image: null

- id: "vector-search"
title: "Vector Search"
description: "Implement semantic search using vector embeddings to find similar content."
category: "search"
icon: null
gradient_class: null
link: "vector-search-with-pytidb/"
doc_link: "https://github.com/pingcap/pytidb/tree/main/examples/vector_search/README.md"
cover_image: "https://github.com/user-attachments/assets/6d7783a5-ce9c-4dcc-8b95-49d5f0ca735a"

- id: "fulltext-search"
title: "Fulltext Search"
description: "Perform traditional text search using MySQL fulltext search capabilities."
category: "search"
icon: null
gradient_class: null
link: "fulltext-search-with-pytidb/"
doc_link: "https://github.com/pingcap/pytidb/tree/main/examples/fulltext_search/README.md"
cover_image: "https://github.com/user-attachments/assets/c81ddad4-f996-4b1f-85c0-5cbb55bc2a3a"

- id: "hybrid-search"
title: "Hybrid Search"
description: "Combine vector search and fulltext search for more comprehensive results."
category: "search"
icon: null
gradient_class: null
link: "hybrid-search-with-pytidb/"
doc_link: "https://github.com/pingcap/pytidb/tree/main/examples/hybrid_search/README.md"
cover_image: "https://github.com/user-attachments/assets/6e1c639d-2160-44c8-86b4-958913b9eca5"

- id: "memory"
title: "Memory"
description: "Implement conversation memory for chatbots and conversational AI applications."
category: "ai-apps"
icon: "💭"
background: "linear-gradient(135deg, #8b5cf6, var(--brand-color))"
link: "memory-with-pytidb/"
doc_link: "https://github.com/pingcap/pytidb/tree/main/examples/memory/README.md"
cover_image: null

- id: "text2sql"
title: "Text2SQL"
description: "Convert natural language queries into SQL statements using AI models."
category: "ai-apps"
icon: "💬"
background: "linear-gradient(135deg, #06b6d4, var(--brand-color))"
link: "text2sql-with-pytidb/"
doc_link: "https://github.com/pingcap/pytidb/tree/main/examples/text2sql/README.md"
cover_image: null

# CTA section configuration
cta:
title: "Ready to build your AI application?"
description: "Start your AI journey with TiDB Cloud Serverless. Follow our quickstart guide to build your first AI-powered application in minutes, or explore specific examples for your use case."
buttons:
- text: "Try TiDB Cloud Serverless"
url: "https://tidbcloud.com/?utm_source=github&utm_medium=referral&utm_campaign=pytidb_readme"
type: "primary"
external: true
- text: "View Quickstart Guide"
url: "quickstart-with-pytidb/"
type: "secondary"
external: false
23 changes: 22 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ nav:
- Auto Embedding: ai/guides/auto-embedding.md
- Reranking: ai/guides/reranking.md
- Filtering: ai/guides/filtering.md
- 💡 Demos:
- Gallery: ai/examples/index.md
- Basic Usage: ai/examples/basic-with-pytidb.md
- Auto Embedding: ai/examples/auto-embedding-with-pytidb.md
- Vector Search: ai/examples/vector-search-with-pytidb.md
- Fulltext Search: ai/examples/fulltext-search-with-pytidb.md
- Hybrid Search: ai/examples/hybrid-search-with-pytidb.md
- Image Search: ai/examples/image-search-with-pytidb.md
- RAG: ai/examples/rag-with-pytidb.md
- Memory: ai/examples/memory-with-pytidb.md
- Text2SQL: ai/examples/text2sql-with-pytidb.md
- 🔌 Integrations:
- MCP Integration:
- TiDB MCP Server: ai/integrations/tidb-mcp-server.md
Expand All @@ -128,6 +139,17 @@ nav:
- Transaction: ai/guides/transaction.md
- Raw Queries: ai/guides/raw-queries.md
- Multiple Table Joins: ai/guides/joins.md
- Demos:
- Gallery: ai/examples/index.md
- Basic Usage: ai/examples/basic-with-pytidb.md
- Auto Embedding: ai/examples/auto-embedding-with-pytidb.md
- Vector Search: ai/examples/vector-search-with-pytidb.md
- Fulltext Search: ai/examples/fulltext-search-with-pytidb.md
- Hybrid Search: ai/examples/hybrid-search-with-pytidb.md
- Image Search: ai/examples/image-search-with-pytidb.md
- RAG: ai/examples/rag-with-pytidb.md
- Memory: ai/examples/memory-with-pytidb.md
- Text2SQL: ai/examples/text2sql-with-pytidb.md
- Integrations:
- MCP Integration:
- TiDB MCP Server: ai/integrations/tidb-mcp-server.md
Expand All @@ -136,7 +158,6 @@ nav:
- Claude Desktop: ai/integrations/tidb-mcp-claude-desktop.md
- LlamaIndex: ai/integrations/llamaindex.md
- LangChain: ai/integrations/langchain.md
# - Examples:


extra:
Expand Down
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# TiDB for AI Documentation
# This project uses UV for fast dependency management
# Install UV: curl -LsSf https://astral.sh/uv/install.sh | sh
# Install deps: make install (which runs: uv pip install -e .)

[project]
name = "docs"
version = "0.1.0"
Expand All @@ -10,4 +15,8 @@ dependencies = [
"mkdocstrings[python]>=0.29.1",
"mkdocs>=1.6.1",
"mkdocs-redirects>=1.2.2",
"requests>=2.31.0",
"PyYAML>=6.0",
"Jinja2>=3.1.0",
"click>=8.0.0",
]
Loading