def pretty_raw_results(results): """ Convert the list of book results into readable text, One line per book. """ lines = [] for r in results: title = r.get('title', 'Unknown') author = r.get('author', 'Unknown') desc = r.get('desc', '') line = f"- {title} — {author} — {desc}" lines.append(line) return "\n".join(lines) # to test # from ai_agent import fetch_openlibrary_by_title_or_subject, pretty_raw_results res = fetch_openlibrary_by_title_or_subject("Atomic Habits") print(pretty_raw_results(res))