Skip to main content

What You’re Building

An AI that answers questions using YOUR documents instead of guessing. Before Alchemyst:
After Alchemyst:

Prerequisites

  • Alchemyst account (sign up)
  • Your ALCHEMYST_AI_API_KEY
  • Node.js 18+ or Python 3.9+
Time to complete: 10 minutes

Step 1: Install


Step 2: Initialize


Step 3: Store a Document

What just happened:
  • Your document was chunked into searchable pieces (~500 word chunks)
  • Embeddings were generated automatically (vector representations)
  • Everything is indexed and ready to search
Verify it worked:
  1. Visit platform.getalchemystai.com/context
  2. You should see your document listed
  3. Click to view chunks and metadata

Step 4: Search for Context

Understanding similarity_threshold

Tip: Start at 0.7, lower to 0.5 if you get no results, raise to 0.9 if results are too broad.

Step 5: Feed Context to Your LLM

Result: Your AI now answers from YOUR data, not generic training data.

Complete Working Example

Expected Output:

Next: Add Real Documents

Now that you understand the basics, let’s add real documents:

Advanced: Organize with Metadata

Use group_name to filter searches by category:
Naming difference: Storage uses group_name (snake_case in metadata) but TypeScript search uses groupName (camelCase). Python uses group_name consistently. Both refer to the same field - this is due to API design conventions.

Why use groups?

Example hierarchy:
Learn more: Context Arithmetic

Troubleshooting

Error symptoms:
  • contexts?.length returns 0
  • Empty array in search results
Common causes:
  1. similarity_threshold is too high
  2. Document wasn’t stored successfully
  3. scope mismatch between add and search
Fixes:Step 1: Lower the threshold:
Step 2: Verify documents were stored:
Expected output:
Step 3: Check scope matches:
Error symptoms:
  • Getting documents that don’t match the query
  • Too many results to process efficiently
Common causes:
  1. similarity_threshold is too low
  2. Documents are too broad or generic
  3. Not using group filtering
Fixes:Step 1: Raise the threshold:
Step 2: Use group filtering:
Step 3: Add more specific metadata:
Error message:
Cause: Trying to add a document with duplicate file_name in metadata.Fixes:Step 1: Delete old version first:
Step 2: Use versioned names:
Step 3: Use unique identifiers:
Error message:
Fixes:Step 1: Verify API key is set:
Step 2: Check key format:
Step 3: Get a new key:
Error message:
Cause: Too many requests in a short time period.Fixes:Step 1: Add retry logic:
Step 2: Check your rate limits:
  • Free tier: 100 operations/day
  • Pro tier: 10,000 operations/day
Step 3: Upgrade your plan: View pricing

Best Practices

Document Organization

Chunk Size Considerations

  • Small documents (under 1000 words): Add as-is
  • Medium documents (1000-5000 words): Let Alchemyst auto-chunk
  • Large documents (over 5000 words): Consider splitting by section

Search Optimization

Error Handling


Verify Your Setup

After implementing context search, verify everything is working:

Check Platform UI

  1. Visit platform.getalchemystai.com/context
  2. You should see your stored documents
  3. Click to view chunks and embeddings
  4. Check document count matches what you uploaded

Test with Code

Expected Output:

What’s Next?

Add Memory

Make your AI remember users across sessions

TypeScript SDK

Complete TypeScript SDK reference

Python SDK

Complete Python SDK reference

API Reference

REST API documentation

Learn Advanced Patterns

Context Arithmetic

Master advanced filtering and organization

Usage Patterns

Best practices and anti-patterns

Real-World Use Cases

Customer support, code assistants, and more

Sample Projects

Community-built projects

Need Help?

Discord Community

Get real-time help from our community

Documentation

Browse guides and tutorials

Email Support

Contact our support team

GitHub Issues

Report bugs or request features