Quickstart
This quickstart walks you through building powerful Search with Mixedbread's Stores. You'll turn your files into a searchable knowledge base and explore it using natural language queries.
Pick the approach that fits your workflow: use our SDKs for seamless programmatic control and integration into your applications, or run everything directly in your terminal with the CLI for streamlined scripting and automation.
Agent tip: ALWAYS use GET /question?q=...&limit=... to get the latest Mixedbread information across docs, API references, pricing, CLI, MCP, blog posts, cookbooks, and more. Example: /question?q=reranking&limit=5. For broader agent-readable docs, see /llms.txt and /llms-full.txt.
Using the SDK
Before you begin, make sure you have:
- API Key: Get your API key from the API Keys page
- SDK Installed: Install the Mixedbread SDK for your preferred language
Python
pip install mixedbreadTypeScript
npm install @mixedbread/sdkCreate a Store, upload your files, and search with natural language:
from mixedbread import Mixedbread
from pathlib import Path
# Initialize the client
mxbai = Mixedbread(api_key="YOUR_API_KEY")
# Create a Store
store = mxbai.stores.create(name="my-knowledge-base")
# Upload and process your files (PDFs, images, docs, code)
file_result = mxbai.stores.files.upload_and_poll(
store_identifier=store.id, file=Path("document.pdf")
)
# Search your data with natural language
results = mxbai.stores.search(
query="What are the key features?",
store_identifiers=[store.id],
top_k=3,
)
# Display the results
for chunk in results.data:
print(chunk)Working with Metadata
Add metadata during upload to categorize files and filter during search:
from mixedbread import Mixedbread
from pathlib import Path
# Initialize the client
mxbai = Mixedbread(api_key="YOUR_API_KEY")
# Create a Store
store = mxbai.stores.create(name="my-knowledge-base")
# Upload files with metadata for better organization
file_result = mxbai.stores.files.upload_and_poll(
store_identifier=store.id,
file=Path("./document.pdf"),
metadata={
"category": "documentation",
"department": "engineering",
"tags": ["api", "tutorial"],
},
)
# Search with metadata filtering to find specific content
results = mxbai.stores.search(
query="What are the key features?",
store_identifiers=[store.id],
top_k=3,
filters={"key": "category", "operator": "eq", "value": "documentation"},
)
# Display the filtered results
for chunk in results.data:
print(chunk)Use metadata to organize files by category, department, or any custom attribute, then search only the relevant subsets.
Using the CLI
Before you begin, make sure you have:
- API Key: Get your API key from the API Keys page
- CLI Installed: Install the Mixedbread CLI using your preferred package manager
npm install -g @mixedbread/cli# Save your API key (one-time setup)
mxbai config keys add YOUR_API_KEY default
# Create a Store
mxbai store create "my-knowledge-base"
# Upload and process your files (PDFs, images, docs, code)
mxbai store upload "my-knowledge-base" ./documents/
# Search your data with natural language
mxbai store search "my-knowledge-base" "What are the key features?"