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

feat(config): add global document_timeout setting #46

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

Conversation

archasek
Copy link
Contributor

@archasek archasek commented Feb 18, 2025

  1. Add support for document_timeout docling setting. Can be set globally (env var) or in the request payload.
  2. Move .env from docling_serve folder to root.
  3. Fix error handling, as there was serialization problem with the old code.
    API - When there's timeout, this kind of response (500) is returned:
{
    "detail": {
        "errors": [
            {
                "component_type": "document_backend",
                "module_name": "NoneType",
                "error_message": "Page 4 failed to parse."
            },
            {
                "component_type": "document_backend",
                "module_name": "NoneType",
                "error_message": "Page 5 failed to parse."
            },
            ...

Gradio:
image

Logs:

WARNING:        2025-02-19 01:23:06,856 - docling.pipeline.base_pipeline - Document processing time (8.141 seconds) exceeded the specified timeout of 3.000 seconds
INFO:     127.0.0.1:53490 - "POST /v1alpha/convert/file HTTP/1.1" 500 Internal Server Error
ERROR:  2025-02-19 01:23:07,164 - docling_serve.gradio_ui - Error processing file: No documents were generated by Docling.

Copy link

mergify bot commented Feb 18, 2025

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

model_config = SettingsConfigDict(env_prefix="DOCLING_")
model_config = SettingsConfigDict(
env_prefix="DOCLING_",
env_file="docling_serve/.env",
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be simple .env? otherwise we force the user on the given location.

Copy link
Contributor Author

@archasek archasek Feb 18, 2025

Choose a reason for hiding this comment

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

Yeah, I also think there should be a single .env file in the root folder for the entire project. However, I noticed that there is already a .env.example file in the docling_serve folder. So, I decided not to change the current design at this point. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is better with a single .env. Let's align all options, and in case use prefixes.

Copy link
Contributor Author

@archasek archasek Feb 19, 2025

Choose a reason for hiding this comment

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

Done, please have a look dolfim. I also noticed an issue with error handling and fixed that (PR description updated). LMK if it's acceptable.

@@ -69,9 +72,13 @@ def _export_document_as_content(
if export_doctags:
document.doctags_content = new_doc.export_to_document_tokens()
elif conv_res.status == ConversionStatus.SKIPPED:
raise HTTPException(status_code=400, detail=conv_res.errors)
raise HTTPException(
Copy link
Contributor

Choose a reason for hiding this comment

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

On the single document, this makes perfect sense.
But this might not be the expected behavior when the user provides multiple document.

In this proposal, if 10 documents are provided and 1 fails, it will raise the error and produce no results.

In the latter, it would be better to have some manifest response file in the zip, where the system lists the result for each file.

@archasek archasek marked this pull request as draft February 25, 2025 19:26
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.

2 participants