Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] new result object #650

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

logan-markewich
Copy link
Contributor

@logan-markewich logan-markewich commented Mar 18, 2025

Add a new method and result object

Example Usage:

parser = LlamaParse(
    take_screenshot=True,
    fast_mode=False,
    result_type="markdown",
)
result = await parser.aparse(file_path)

assert result.job_id is not None
assert result.file_name == file_path

assert result.get_text() is not None
assert len(result.get_text()) > 0

assert result.get_markdown() is not None
assert len(result.get_markdown()) > 0

assert result.get_markdown() != result.get_text()

assert len(result.get_image_names()) > 0
assert await result.aget_image_data(result.get_image_names()[0]) is not None

with tempfile.TemporaryDirectory() as temp_dir:
    file_names = await result.asave_all_images(temp_dir)
    assert len(file_names) > 0
    for file_name in file_names:
        assert os.path.exists(file_name)
        assert os.path.getsize(file_name) > 0

assert result.get_metadata() is not None

Still TODO

  • verify charts
  • verify tables
  • add get_documents (i.e. convert to llama-index documents)
  • ensure we like the syntax

@logan-markewich logan-markewich marked this pull request as draft March 18, 2025 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant