🌻 AI answers panel#

Requires an AI subscription

You can open this panel by clicking the corresponding tab lower down on the right-hand side of the app.

πŸ€– What you can do here: Ask questions about your data in plain English and get AI-powered answers. Type questions like "What are the main barriers to education?" and the AI will search through your currently selected sources to provide relevant answers with supporting quotes. Perfect for exploring themes and getting quick insights from large amounts of text.

Main Features:

Bookmarking & restore:

Search Modes#

AI Answers offers two search modes, automatically optimized based on your data size:

Full Sources Mode#

Searches the complete text of your sources (documents/interviews).

How it works:

  1. Type a question about the text of the currently selected sources
  2. System automatically chunks sources into searchable segments (if not already done)
  3. Searches through document chunks using AI embeddings and semantic similarity
  4. Most relevant chunks are sent to AI for analysis
  5. AI generates answers with supporting quotes from your sources

Question expansion and HyDE (Hypothetical Document Embeddings)

This is now optional:

When expansions are provided, we match each phrase against chunks and sum scores per chunk, then select the top \(n\) by the max_chunks slider.

So for example if the user asks what is the connection between money and happiness, the AI produces question variants like:

And answer variants like:

Best for: Exploratory questions about raw text, finding themes not yet coded, discovering new patterns.

Searches only through your coded causal links and their surrounding context (the quote + 3 sentences before/after).

How it works:

  1. Gets filtered links from your current filter pipeline (respects Sources dropdown and all Source Groups filters)
  2. For each link, extracts the selected quote plus surrounding context
  3. Organizes contexts by source, with source metadata (title, custom columns)
  4. For ≀500 links: Sends all contexts directly to AI
  5. For >500 links: Same pattern as SRP β€” RPC + client-triggered embedding creation, no long-running Edge Function
  6. Client gets query embedding (one call), then calls RPC find_relevant_link_contexts(project_name, link_ids, query_embedding, top_k, threshold)
  7. RPC fetches links from DB, builds a normalized key per link (see Normalization note below), checks embeddings; if any missing (or embedding IS NULL) returns needs_embeddings + missing_texts
  8. Client calls DataService.createEmbeddingsBatch(missing_texts, ..., { useProvidedKeys: true }) (server-side generation + DB upsert), then retries RPC
  9. RPC runs similarity in Postgres (pgvector), returns relevant_link_ids + similarities (and may include a debug block); no embedding vectors to frontend
  10. Selection is source-diversified (round-robin: best link per source first), and avoids identical contexts within a source (exact de-dupe on the normalized key)
  11. Prompt to AI uses full chunk_text (quote + surrounding 3 sentences) built on the client
  12. AI analyzes contexts showing cause β†’ effect relationships
  13. AI is instructed to use the coded factor labels as the vocabulary (wrap labels in backticks like this) and to be sceptical about evidence coverage and alternative narratives.

Context format sent to AI:

'## Source: Interview with Participant 001
ID: ABC-123
custom_Country: Kenya | custom_Gender: Female | custom_Age: 34

Links from this source:

[ABC-123-1] Lack of resources β†’ Poor school performance
Context: "We don't have enough books or supplies. The children struggle because..."

[ABC-123-2] Teacher training β†’ Better outcomes
Context: "When teachers receive proper training, we see improvements in..."

Best for: Questions about causal relationships you've already coded, comparing patterns across sources, analyzing specific demographic groups using Source Groups filters.

Key advantages of Link Contexts mode:

etc etc

Use Sources for source rows, Links for link rows, and Factors for factor labels.

Why this exists: it lets you do fast, repeatable coding/scoring in bulk instead of editing one row at a time.

Each subtab now has two modes:

How Create/Modify mode works:

  1. Type an instruction in Your Question (for example, β€œscore each row 0–3 for frustration”).
  2. Choose a subtab and click Run.
  3. The app only processes rows currently included by filters.
  4. AI returns one value per requested target column per row.
  5. The app writes those values back.

Per-subtab write behavior:

Links + Factors switches (Create/Modify mode):

Choose payload columns (optional):

Safety behavior (Create/Modify mode):

Label-transform filters note: