"""Prepare a question with source notes that all three seats can read.""" import argparse from pathlib import Path from reference import retrieve def brief(root, question): sections = [] for database in sorted((root / "sources").glob("*/references.sqlite")): hits = retrieve(database, question) if hits: notes = "\n\n".join(f"{h['title']}\n{h['url']}\n{h['body']}" for h in hits) sections.append(f"{database.parent.name}\n{notes}") if not sections: return question return ( "Reference notes for all participants and the synthesizer. " "For the final answer, cover each part of the question. Use the relevant passages " "to resolve conflicts between drafts, cite their documentation, and identify " "any dispute the sources do not settle.\n\n" + "\n\n".join(sections) + "\n\nQuestion: " + question ) if __name__ == "__main__": parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("question") args = parser.parse_args() print(brief(Path(__file__).resolve().parent, args.question))