Skip to content

Conversation

@aleskalfas
Copy link
Contributor

@aleskalfas aleskalfas commented Nov 26, 2025

Refs #1630

@aleskalfas aleskalfas requested a review from jezekra1 November 26, 2025 19:14
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Nov 26, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @aleskalfas, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant enhancement to the text extraction capabilities by enabling support for JSON output from the docling service. It provides a flexible mechanism for users to specify extraction preferences through an extras parameter, which is then propagated through the system to the docling backend. This change improves the versatility of the text extraction feature, allowing for both human-readable Markdown and machine-readable JSON outputs, and includes necessary updates to the API, data models, and underlying extraction logic.

Highlights

  • JSON Format Support for Docling Extraction: The text extraction functionality has been enhanced to support requesting output in JSON format from the docling service, in addition to the existing Markdown format. This allows for more structured data extraction.
  • API and Schema Updates: A new TextExtractionRequest schema has been introduced, allowing clients to specify extras (e.g., {"json_format": true}) when requesting text extraction. The TextExtraction model and its corresponding database table now include an extras field to store these additional options.
  • Dynamic Content Type Handling: The DoclingTextExtractionBackend now dynamically adjusts the requested output format (md or json) to the docling service based on the extras provided. It also sets the appropriate filename (.md or .json) and content type (text/markdown or application/json) for the extracted file.
  • Streaming JSON Extraction Utility: A new utility function, extract_object_value_stream, has been added to incrementally parse and extract JSON objects or arrays from a streaming response, ensuring efficient handling of potentially large JSON outputs.
  • Database Migration: A new Alembic migration has been added to include an extras column of type JSON in the text_extractions table, persisting the extraction request options.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for JSON output format from the Docling text extraction service. The changes correctly plumb the extras parameter from the API endpoint down to the service layer and Docling backend. My review has identified a critical runtime error in the Docling backend implementation due to an API mismatch, and a high-severity bug where extraction options are not updated when an extraction is retried. I've also included a medium-severity suggestion to improve code clarity in the streaming logic. Please address the critical and high severity issues.

@aleskalfas aleskalfas force-pushed the 1630-store-docling-document-when-extracting-text branch from 6c48588 to 20b2135 Compare December 2, 2025 20:42
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Dec 2, 2025
@aleskalfas aleskalfas marked this pull request as draft December 2, 2025 20:51
@aleskalfas aleskalfas marked this pull request as ready for review December 8, 2025 22:14
@jezekra1 jezekra1 force-pushed the 1630-store-docling-document-when-extracting-text branch 4 times, most recently from e953b50 to 1b81494 Compare December 11, 2025 12:00
Co-authored-by: Radek Ježek <[email protected]>
Signed-off-by: Aleš Kalfas <[email protected]>
Signed-off-by: Radek Ježek <[email protected]>
@jezekra1 jezekra1 force-pushed the 1630-store-docling-document-when-extracting-text branch from 1b81494 to 61cfdd8 Compare December 11, 2025 12:27
@jezekra1 jezekra1 merged commit dd0ecb2 into main Dec 11, 2025
12 of 14 checks passed
@jezekra1 jezekra1 deleted the 1630-store-docling-document-when-extracting-text branch December 11, 2025 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants