|
| 1 | +from agno.agent import Agent |
| 2 | +from agno.tools.docling import DoclingTools |
| 3 | + |
| 4 | +from paths import ( |
| 5 | + audio_video_path, |
| 6 | + docx_path, |
| 7 | + html_path, |
| 8 | + image_path, |
| 9 | + md_path, |
| 10 | + pdf_path, |
| 11 | + pptx_path, |
| 12 | + xlsx_path, |
| 13 | + xml_path, |
| 14 | +) |
| 15 | + |
| 16 | + |
| 17 | +def run_basic_examples() -> None: |
| 18 | + agent = Agent( |
| 19 | + tools=[DoclingTools(all=True)], |
| 20 | + description="You are an agent that converts documents from all Docling parsers and exports to all supported output formats.", |
| 21 | + ) |
| 22 | + |
| 23 | + agent.print_response( |
| 24 | + "List supported Docling input parsers and active allowed parsers.", |
| 25 | + markdown=True, |
| 26 | + ) |
| 27 | + |
| 28 | + agent.print_response( |
| 29 | + f"Convert to Markdown: {pdf_path}", |
| 30 | + markdown=True, |
| 31 | + ) |
| 32 | + agent.print_response( |
| 33 | + f"Convert to JSON and return the full JSON without summarizing: {pdf_path}", |
| 34 | + markdown=True, |
| 35 | + ) |
| 36 | + agent.print_response( |
| 37 | + f"Convert to YAML: {pdf_path}", |
| 38 | + markdown=True, |
| 39 | + ) |
| 40 | + agent.print_response( |
| 41 | + f"Convert to DocTags: {pdf_path}", |
| 42 | + markdown=True, |
| 43 | + ) |
| 44 | + agent.print_response( |
| 45 | + f"Convert to VTT: {pdf_path}", |
| 46 | + markdown=True, |
| 47 | + ) |
| 48 | + agent.print_response( |
| 49 | + f"Convert to HTML split page: {pdf_path}", |
| 50 | + markdown=True, |
| 51 | + ) |
| 52 | + |
| 53 | + # Additional parser examples based on static resources. |
| 54 | + agent.print_response( |
| 55 | + f"Convert to Markdown: {docx_path}", |
| 56 | + markdown=True, |
| 57 | + ) |
| 58 | + agent.print_response( |
| 59 | + f"Convert to Markdown: {md_path}", |
| 60 | + markdown=True, |
| 61 | + ) |
| 62 | + agent.print_response( |
| 63 | + f"Convert to Markdown: {html_path}", |
| 64 | + markdown=True, |
| 65 | + ) |
| 66 | + agent.print_response( |
| 67 | + f"Convert to Markdown: {xml_path}", |
| 68 | + markdown=True, |
| 69 | + ) |
| 70 | + agent.print_response( |
| 71 | + f"Convert to Markdown: {xlsx_path}", |
| 72 | + markdown=True, |
| 73 | + ) |
| 74 | + agent.print_response( |
| 75 | + f"Convert to Markdown: {pptx_path}", |
| 76 | + markdown=True, |
| 77 | + ) |
| 78 | + agent.print_response( |
| 79 | + f"Convert to Markdown: {image_path}", |
| 80 | + markdown=True, |
| 81 | + ) |
| 82 | + agent.print_response( |
| 83 | + f"Convert to VTT: {audio_video_path}", |
| 84 | + markdown=True, |
| 85 | + ) |
| 86 | + |
| 87 | + # convert_string is limited by Docling to Markdown and HTML source content. |
| 88 | + agent.print_response( |
| 89 | + "Use convert_string_content to convert this markdown string to JSON: # Inline Markdown\n\nThis is a parser test.", |
| 90 | + markdown=True, |
| 91 | + ) |
| 92 | + agent.print_response( |
| 93 | + "Use convert_string_content to convert this html string to Markdown: <h1>Inline HTML</h1><p>This is a parser test.</p>", |
| 94 | + markdown=True, |
| 95 | + ) |
0 commit comments