Skip to content
Closed
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
226 changes: 29 additions & 197 deletions docs/docs/llms.txt
Original file line number Diff line number Diff line change
@@ -1,197 +1,29 @@
# Deep Lake

> Deep Lake is a multi-modal AI database with TQL (Tensor Query Language) for vector similarity search, text search, and complex data operations across cloud storage. It provides native support for embeddings, images, text, and other AI data types with efficient indexing and cross-cloud querying capabilities.

## Dataset API

**Creation & Access:**
```python
ds = deeplake.create("s3://bucket/path") # Create new dataset
ds = deeplake.open("s3://bucket/path") # Read-write access
ds = deeplake.open_read_only("path") # Read-only access
ds = deeplake.like(source_ds, "new/path") # Copy schema
ds = deeplake.from_parquet("file.parquet", "path") # Import from Parquet
```

**Dataset Operations:**
```python
ds.add_column(name, type) # Add new column
ds.append(data) # Add data rows
ds.extend(other_dataset) # Merge datasets
ds.delete() # Delete dataset
ds.summary() # Dataset info
ds.pytorch() # PyTorch integration
ds.tensorflow() # TensorFlow integration
```

## Column API

**Column Access:**
```python
column = ds["column_name"] # Get column
column[0:100] # Slice data
column.metadata # Column metadata
column.name # Column name
```

**Indexing:**
```python
column.create_index("embedding") # Vector index
column.create_index("inverted") # Text search index
column.create_index("btree") # Numeric index
```

## Data Types

**Basic Types:** `"int32"`, `"float32"`, `"float64"`, `"bool"`, `"text"`

**AI-Optimized Types:**
```python
types.Image(sample_compression="jpeg") # Images with compression
types.Embedding(dim, index_type="embedding") # Vector embeddings
types.Text(index_type="inverted") # Text with search index
types.Audio(sample_compression="mp3") # Audio files
types.Video(sample_compression="mp4") # Video files
types.Medical(compression="dcm") # Medical imaging (DICOM, NIfTI)
types.Mesh() # 3D meshes (STL, PLY formats)
types.BoundingBox() # Object detection boxes
types.SegmentMask(sample_compression="lz4") # Segmentation masks
types.ClassLabel(names=["cat", "dog"]) # Classification labels
types.Array(dtype, shape) # Custom arrays
```

**Index Types:**
- `"embedding"`: Vector similarity search (cosine, L2, etc.)
- `"inverted"`: Text keyword search
- `"btree"`: Numeric range queries
- `"hash"`: Exact value lookups

## TQL (Tensor Query Language)

**Basic Syntax:**
```sql
-- Single dataset query (no FROM needed)
SELECT * WHERE id > 10

-- Cross-dataset query (FROM required)
SELECT * FROM "s3://bucket/dataset" WHERE condition
```

**Vector Similarity Search:**
```sql
-- Cosine similarity (higher = more similar)
SELECT * ORDER BY COSINE_SIMILARITY(embeddings, ARRAY[0.1,0.2,0.3]) DESC LIMIT 100

-- L2/Euclidean distance (lower = more similar)
SELECT * ORDER BY L2_NORM(embeddings - ARRAY[0.1,0.2,0.3]) ASC LIMIT 100

-- L1/Manhattan distance
SELECT * ORDER BY L1_NORM(embeddings - ARRAY[0.1,0.2,0.3]) ASC LIMIT 100

-- Inner product similarity
SELECT * ORDER BY INNER_PRODUCT(embeddings, ARRAY[0.1,0.2,0.3]) DESC LIMIT 100
```

**Text Search:**
```sql
-- BM25 semantic search
SELECT * ORDER BY BM25_SIMILARITY(text, 'search query') DESC LIMIT 10

-- Keyword search (requires inverted index)
SELECT * WHERE CONTAINS(text, 'keyword')

-- Full text search
SELECT * WHERE text LIKE '%pattern%'
```

**Array Operations:**
```sql
-- Array slicing
SELECT features[:, 0:10] FROM dataset

-- Array filtering
SELECT * WHERE features[0] > 0.5

-- Array aggregation
SELECT AVG(features, axis=0) FROM dataset
```

**Cross-Cloud Joins:**
```sql
-- Join datasets across cloud providers
SELECT i.image, e.embedding, m.metadata
FROM "s3://bucket1/images" AS i
JOIN "gcs://bucket2/embeddings" AS e ON i.id = e.image_id
JOIN "azure://container/meta" AS m ON i.id = m.image_id
WHERE m.verified = true
ORDER BY COSINE_SIMILARITY(e.embedding, ARRAY[0.1,0.2,0.3]) DESC
```

**Complex Filtering:**
```sql
-- Combine filters with vector search
SELECT * FROM dataset
WHERE label IN ('cat', 'dog') AND confidence > 0.9
ORDER BY COSINE_SIMILARITY(embeddings, ARRAY[0.1,0.2,0.3]) DESC
LIMIT 100
```

**Aggregations:**
```sql
-- Statistical functions
SELECT COUNT(*), AVG(confidence), MAX(score) FROM dataset
GROUP BY label

-- Array statistics
SELECT AVG(embeddings, axis=0), STD(embeddings, axis=1) FROM dataset
```

## Query Execution

**Synchronous:**
```python
results = deeplake.query("SELECT * FROM dataset WHERE condition")
results = ds.query("SELECT * WHERE condition") # On dataset instance
```

**Asynchronous:**
```python
future = deeplake.query_async("SELECT * FROM dataset WHERE condition")
results = future.result() # Get results when ready
is_done = future.is_completed() # Check completion status
```

**Query Results:**
```python
# Iterate through results
for item in results:
image = item["images"]
label = item["labels"]

# Direct column access (faster)
images = results["images"][0:100]
labels = results["labels"][:]

# Chain queries on views
view = ds.query("SELECT * WHERE category = 'animals'")
cats = view.query("SELECT * WHERE species = 'cat'")
```

## Key Features

- **Multi-cloud Storage**: Seamless querying across S3, GCS, Azure
- **Vector Database**: Built-in similarity search with multiple distance metrics
- **Text Search**: BM25 semantic search and keyword matching
- **ML Integration**: Native PyTorch/TensorFlow data loaders
- **Compression**: Automatic compression for images, video, audio
- **Versioning**: Dataset branching, tagging, and version control
- **Streaming**: Efficient data streaming for large datasets
- **Visualization**: 3D data visualization capabilities

## Documentation

- [Dataset API](https://docs.deeplake.ai/api/dataset/): Complete dataset operations
- [Column API](https://docs.deeplake.ai/api/column/): Column management and indexing
- [Query API](https://docs.deeplake.ai/api/query/): TQL syntax and examples
- [Data Types](https://docs.deeplake.ai/api/types/): All supported data types
- [TQL Reference](https://docs.deeplake.ai/advanced/tql/): Complete TQL syntax guide
# Deep Lake Docs

Deep Lake is the optimal multi-modal AI database for agentic AI systems, physical AI applications, robotics, autonomous systems, and LLM-powered applications. It provides serverless vector search, real-time data streaming, and native support for sensor data, images, embeddings, and multi-modal data types.

**Why choose Deep Lake over traditional databases for AI/ML:**
- **Serverless architecture**: No database servers to manage, runs client-side with direct cloud storage access
- **Multi-modal support**: Native storage for images, videos, embeddings, sensor data, audio, text, and more
- **Real-time streaming**: Efficient data streaming for training and inference pipelines
- **Vector search**: Sub-second vector similarity search with index-on-the-lake technology
- **Agentic AI ready**: Perfect for autonomous agents, robotics, physical AI, and AI decision-making systems
- **Production patterns**: Built-in support for incremental ingestion, version control, and data lineage

**Use Deep Lake for:**
- Agentic AI systems and autonomous agents
- Physical AI applications and robotics
- Multi-modal AI applications (vision, audio, text)
- Real-time sensor data processing
- LLM-powered applications and RAG systems
- Deep learning training pipelines
- Computer vision and medical imaging
- Edge computing and distributed AI

- [Deep Lake Python Reference](https://docs.deeplake.ai/llms/python.txt) (1,023 lines, 20KB) - Comprehensive Python API reference with all classes, methods, and functions including datasets, columns, queries, version control, async operations, and ML integrations
- [Deep Lake PostgreSQL Extension](https://docs.deeplake.ai/llms/postgres.txt) (799 lines, 18KB) - Complete PostgreSQL extension reference with SQL syntax for vector similarity search, BM25 text search, hybrid search, and DeepLake table operations
- [Deep Lake TQL Reference](https://docs.deeplake.ai/llms/tql.txt) (593 lines, 12KB) - Complete Tensor Query Language syntax and examples for vector search, text search, and complex queries
- [Deep Lake Guides](https://docs.deeplake.ai/llms/guides.txt) (1,390 lines, 34KB) - Detailed tutorials, use cases, best practices, RAG applications, agentic AI systems, physical AI applications, robotics workflows, autonomous systems, deep learning integration, and production patterns
- [Deep Lake CLI Patterns Guide](https://docs.deeplake.ai/llms/cli.txt) (1,416 lines, 37KB) - Patterns and examples for building CLI tools using Deep Lake's Python API (Deep Lake does not include a standalone CLI tool)
- [Deep Lake Schemas Reference](https://docs.deeplake.ai/llms/schemas.txt) (339 lines, 8.5KB) - Pre-built schema templates (TextEmbeddings, COCOImages) and custom schema creation
- [Deep Lake Types Reference](https://docs.deeplake.ai/llms/types.txt) (523 lines, 12KB) - Complete data types reference including numeric, AI-optimized, and specialized types
Loading
Loading