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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useState } from 'react';
|
| 2 |
+
import { Play, Database, Search, Layers } from 'lucide-react';
|
| 3 |
+
|
| 4 |
+
export default function TechnicalDemo() {
|
| 5 |
+
const [activeTab, setActiveTab] = useState('overview');
|
| 6 |
+
|
| 7 |
+
const codeExamples = {
|
| 8 |
+
python: `import chromadb
|
| 9 |
+
|
| 10 |
+
# Initialize client
|
| 11 |
+
client = chromadb.Client()
|
| 12 |
+
|
| 13 |
+
# Create collection
|
| 14 |
+
collection = client.create_collection("documents")
|
| 15 |
+
|
| 16 |
+
# Add documents with embeddings
|
| 17 |
+
collection.add(
|
| 18 |
+
documents=["doc1", "doc2", "doc3"],
|
| 19 |
+
embeddings=[[1.1, 2.3], [4.5, 6.9], [7.1, 8.2]],
|
| 20 |
+
ids=["id1", "id2", "id3"]
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
# Search
|
| 24 |
+
results = collection.query(
|
| 25 |
+
query_embeddings=[[1.1, 2.3]],
|
| 26 |
+
n_results=2
|
| 27 |
+
)`,
|
| 28 |
+
javascript: `const { ChromaClient } = require('chromadb');
|
| 29 |
+
|
| 30 |
+
// Initialize client
|
| 31 |
+
const client = new ChromaClient();
|
| 32 |
+
|
| 33 |
+
// Create collection
|
| 34 |
+
const collection = await client.createCollection("documents");
|
| 35 |
+
|
| 36 |
+
// Add documents
|
| 37 |
+
await collection.add({
|
| 38 |
+
ids: ["id1", "id2", "id3"],
|
| 39 |
+
embeddings: [[1.1, 2.3], [4.5, 6.9], [7.1, 8.2]],
|
| 40 |
+
documents: ["doc1", "doc2", "doc3"]
|
| 41 |
+
});
|
| 42 |
+
|
| 43 |
+
// Search
|
| 44 |
+
const results = await collection.query({
|
| 45 |
+
queryEmbeddings: [[1.1, 2.3]],
|
| 46 |
+
nResults: 2
|
| 47 |
+
});`
|
| 48 |
+
};
|
| 49 |
+
|
| 50 |
+
return (
|
| 51 |
+
<section id="demo" className="py-20 bg-gray-50">
|
| 52 |
+
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
| 53 |
+
<div className="text-center mb-16">
|
| 54 |
+
<h2 className="text-3xl sm:text-4xl font-bold text-gray-900 mb-4">
|
| 55 |
+
See Chroma in Action
|
| 56 |
+
</h2>
|
| 57 |
+
<p className="text-xl text-gray-600 max-w-3xl mx-auto">
|
| 58 |
+
Experience the simplicity and power of Chroma vector database through our interactive demo
|
| 59 |
+
</p>
|
| 60 |
+
</div>
|
| 61 |
+
<div className="bg-white rounded-lg shadow-lg overflow-hidden">
|
| 62 |
+
<div className="border-b border-gray-200">
|
| 63 |
+
<nav className="flex space-x-8 px-8">
|
| 64 |
+
{['overview', 'code', 'performance'].map((tab) => (
|
| 65 |
+
<button
|
| 66 |
+
key={tab}
|
| 67 |
+
onClick={() => setActiveTab(tab)}
|
| 68 |
+
className={`py-4 px-1 border-b-2 font-medium text-sm capitalize ${
|
| 69 |
+
activeTab === tab
|
| 70 |
+
? 'border-primary-600 text-primary-600'
|
| 71 |
+
: 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'
|
| 72 |
+
}`}
|
| 73 |
+
>
|
| 74 |
+
{tab}
|
| 75 |
+
</button>
|
| 76 |
+
))}
|
| 77 |
+
</nav>
|
| 78 |
+
</div>
|
| 79 |
+
<div className="p-8">
|
| 80 |
+
{activeTab === 'overview' && (
|
| 81 |
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-8">
|
| 82 |
+
<div className="text-center">
|
| 83 |
+
<Database className="w-16 h-16 text-primary-600 mx-auto mb-4" />
|
| 84 |
+
<h3 className="text-lg font-semibold mb-2">Easy Setup</h3>
|
| 85 |
+
<p className="text-gray-600">Get started in minutes with simple API</p>
|
| 86 |
+
</div>
|
| 87 |
+
<div className="text-center">
|
| 88 |
+
<Search className="w-16 h-16 text-primary-600 mx-auto mb-4" />
|
| 89 |
+
<h3 className="text-lg font-semibold mb-2">Fast Search</h3>
|
| 90 |
+
<p className="text-gray-600">Sub-100ms query latency at scale</p>
|
| 91 |
+
</div>
|
| 92 |
+
<div className="text-center">
|
| 93 |
+
<Layers className="w-16 h-16 text-primary-600 mx-auto mb-4" />
|
| 94 |
+
<h3 className="text-lg font-semibold mb-2">Multi-modal</h3>
|
| 95 |
+
<p className="text-gray-600">Support for text, images, and more</p>
|
| 96 |
+
</div>
|
| 97 |
+
</div>
|
| 98 |
+
)}
|
| 99 |
+
{activeTab === 'code' && (
|
| 100 |
+
<div className="space-y-6">
|
| 101 |
+
<div className="flex space-x-4 mb-4">
|
| 102 |
+
<button className="px-4 py-2 bg-primary-600 text-white rounded-lg">Python</button>
|
| 103 |
+
<button className="px-4 py-2 bg-gray-200 text-gray-700 rounded-lg">JavaScript</button>
|
| 104 |
+
</div>
|
| 105 |
+
<pre className="bg-gray-900 text-gray-100 p-6 rounded-lg overflow-x-auto">
|
| 106 |
+
<code>{codeExamples.python}</code>
|
| 107 |
+
</pre>
|
| 108 |
+
</div>
|
| 109 |
+
)}
|
| 110 |
+
{activeTab === 'performance' && (
|
| 111 |
+
<div className="space-y-6">
|
| 112 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-8">
|
| 113 |
+
<div>
|
| 114 |
+
<h3 className="text-lg font-semibold mb-4">Query Performance</h3>
|
| 115 |
+
<div className="space-y-3">
|
| 116 |
+
<div className="flex justify-between items-center">
|
| 117 |
+
<span className="text-gray-600">1M vectors</span>
|
| 118 |
+
<span className="font-semibold text-green-600">< 50ms</span>
|
| 119 |
+
</div>
|
| 120 |
+
<div className="flex justify-between items-center">
|
| 121 |
+
<span className="text-gray-600">10M vectors</span>
|
| 122 |
+
<span className="font-semibold text-green-600">< 100ms</span>
|
| 123 |
+
</div>
|
| 124 |
+
<div className="flex justify-between items-center">
|
| 125 |
+
<span className="text-gray-600">100M vectors</span>
|
| 126 |
+
<span className="font-semibold text-green-600">< 200ms</span>
|
| 127 |
+
</div>
|
| 128 |
+
</div>
|
| 129 |
+
</div>
|
| 130 |
+
<div>
|
| 131 |
+
<h3 className="text-lg font-semibold mb-4">Scalability</h3>
|
| 132 |
+
<div className="space-y-3">
|
| 133 |
+
<div className="flex justify-between items-center">
|
| 134 |
+
<span className="text-gray-600">Horizontal scaling</span>
|
| 135 |
+
<span className="font-semibold text-primary-600">✓</span>
|
| 136 |
+
</div>
|
| 137 |
+
<div className="flex justify-between items-center">
|
| 138 |
+
<span className="text-gray-600">Auto-sharding</span>
|
| 139 |
+
<span className="font-semibold text-primary-600">✓</span>
|
| 140 |
+
</div>
|
| 141 |
+
<div className="flex justify-between items-center">
|
| 142 |
+
<span className="text-gray-600">Replication</span>
|
| 143 |
+
<span className="font-semibold text-primary-600">✓</span>
|
| 144 |
+
</div>
|
| 145 |
+
</div>
|
| 146 |
+
</div>
|
| 147 |
+
</div>
|
| 148 |
+
</div>
|
| 149 |
+
)}
|
| 150 |
+
</div>
|
| 151 |
+
</div>
|
| 152 |
+
<div className="mt-8 text-center">
|
| 153 |
+
<button className="bg-primary-600 text-white px-8 py-3 rounded-lg font-semibold hover:bg-primary-700 transition-colors inline-flex items-center gap-2">
|
| 154 |
+
<Play className="w-5 h-5" />
|
| 155 |
+
Start Free Trial
|
| 156 |
+
</button>
|
| 157 |
+
</div>
|
| 158 |
+
</div>
|
| 159 |
+
</section>
|
| 160 |
+
);
|
| 161 |
+
}
|