Brain by AIStack

Configuration

Customize search and indexing behavior

Configuration

Project Settings

Project settings are managed from the Settings page in the dashboard. These control how documents are indexed and how search queries are processed.

Embedding

SettingDefaultDescription
Embedding modeltext-embedding-3-smallModel used to embed documents and queries

Chunking

SettingDefaultDescription
Chunk size1024Maximum token count per chunk
Chunk overlap200Token overlap between adjacent chunks

Retrieval

SettingDefaultDescription
Match threshold0.3Minimum cosine similarity score (0-1)
Max results10Maximum number of results to return
BM25 searchoffEnable hybrid BM25 keyword search alongside vector search
RerankingoffEnable reranking of search results using a cross-encoder model

When BM25 search is enabled, both vector similarity search and BM25 keyword search run in parallel. Results are merged, deduplicated by document, and the higher score is kept. This improves recall for keyword-heavy queries while preserving semantic search quality.

Generation

SettingDefaultDescription
AI ProviderSelect a registered AI provider (configured at the team level)
Generation modelDepends on providerModel used to generate AI answers
System promptBuilt-inSystem prompt for the LLM

AI Providers are registered at the team level from the AI Providers page. Each provider has its own API credentials and supported models. Project settings reference these providers via dropdown — no API keys are stored at the project level.

Search Parameters

These parameters can be passed in the request body for /search and /ai-search to override project defaults per-request:

ParameterTypeDefaultDescription
querystringrequiredThe search query
max_num_resultsnumberProject settingMaximum chunks to return
score_thresholdnumberProject setting (0.3)Minimum similarity score (0-1)
include_stepsbooleanfalseInclude internal step trace in the response
filtersobjectnullMetadata filters (see Filtering)

AI Search Parameters

Additional parameters for /ai-search:

ParameterTypeDefaultDescription
streambooleanfalseEnable SSE streaming responses
include_stepsbooleanfalseInclude internal step trace

Filtering by Metadata

Filter results using document attributes:

{
  "query": "How do I deploy?",
  "filters": {
    "type": "and",
    "filters": [
      { "key": "folder", "value": "guides/" }
    ]
  }
}

Filter Types

TypeDescription
andAll conditions must match
orAny condition must match

Filter Conditions

KeyDescription
folderDocument folder path prefix (auto-generated from filename)
Custom keysAny attribute set during document upload

Document Attributes

Attach custom metadata when uploading documents:

curl -X POST https://brain.aistack.run/api/v1/documents \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@guide.md" \
  -F "filename=docs/guide.md" \
  -F 'attributes={"author":"alice","version":"2.0"}'

These attributes can then be used in search filters.

Upload Filtering

Upload filtering lets you automatically reject files based on glob patterns before they are stored or indexed. This is useful for keeping unwanted files (build artifacts, lock files, environment files, etc.) out of your project.

Default Ignore Patterns

The following patterns are always enforced and cannot be disabled. Files matching any of these are silently skipped:

**/node_modules/**    **/.git/**       **/.svn/**
**/.hg/**             **/.DS_Store     **/Thumbs.db
**/*.lock             **/package-lock.json
**/yarn.lock          **/pnpm-lock.yaml
**/bun.lockb          **/.env          **/.env.*
**/*.log              **/*.min.js      **/*.min.css
**/*.map              **/*.d.ts

Per-Project Patterns

You can configure additional patterns per project in the dashboard under Settings > Upload Filters:

  • Ignore patterns -- Additional glob patterns to reject. These work alongside the default patterns.
  • Allow patterns -- If set, only files matching at least one allow pattern are accepted. Leave empty to allow all non-ignored files.

Evaluation Order

1. Check default ignore patterns -> skip if matched
2. Check project ignore patterns -> skip if matched
3. If project allow patterns exist:
     File must match at least one -> skip if not
4. Allow upload

Ignore patterns always take precedence over allow patterns.

Skipped Response

When a file is filtered, the API returns HTTP 200 with:

{
  "skipped": true,
  "reason": "File matches default ignore pattern: **/.env"
}

No document is created, no storage is used, and no indexing is triggered.

On this page