Skip to content

mosaic ask ​

Answers a question from your indexed papers: it retrieves the most relevant ones and asks the configured LLM to answer from them alone, citing them as [n].

Usage ​

bash
mosaic ask "What causes anomalous electron transport in Hall thrusters?"
mosaic ask "What is still unexplained about the breathing mode?" --mode gaps
mosaic ask "PIC versus fluid models of the discharge" --mode compare --show-sources
mosaic ask "Which codes simulate the plume?" --mode extract --year 2015-2025
mosaic ask "wall effects on electron mobility" -q "hall thruster" -n 20
mosaic ask "anomalous transport" --from refs.bib -o answer.md

Behaviour ​

ModeAnswer
synthesis (default)a state-of-the-art summary
gapsopen problems, contradictions, methodological limits
comparemethods, datasets, metrics and results side by side
extractper paper: task, method, dataset, metric, key result

Retrieval returns rag.top_k papers (default 10; -n overrides it). --query and --from restrict it to the papers matching a query, or listed in a .bib/.csv file; --year filters them by year.

--output writes Markdown (.md: the question, the mode, the answer and the references) or JSON (.json).

Needs the index (mosaic index) and an LLM (mosaic config --llm-provider ...). Exit code 1 for an unknown mode, or when retrieval or the LLM call fails.

See also: tutorial 9, asking your library, AI recipes.

Options ​

mosaic ask [OPTIONS] QUESTION
ArgumentValueDescription
QUESTIONTEXTQuestion or topic to analyse
OptionValueDefaultDescription
--modeTEXTsynthesissynthesis (default), gaps, compare, extract
--query, -qTEXTPre-filter: restrict to papers matching this FTS query
--fromPATHPre-filter: restrict to papers from a .bib or .csv file
--year, -yTEXTYear or range filter (e.g. 2020-2024)
-n, --topINTEGEROverride rag.top_k for this query
--output, -oPATHWrite answer to file (.md or .json)
--show-sourcesPrint retrieved papers before the answer

Released under GPL-3.0-or-later, BSD-2-Clause, BSD-3-Clause or MIT, at your choice.