mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-31 14:34:40 +00:00
rename to enable_remote_services
Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
This commit is contained in:
parent
9c3a70ac9c
commit
654b806c69
@ -234,7 +234,7 @@ def convert(
|
||||
Optional[Path],
|
||||
typer.Option(..., help="If provided, the location of the model artifacts."),
|
||||
] = None,
|
||||
allow_remote_services: Annotated[
|
||||
enable_remote_services: Annotated[
|
||||
bool,
|
||||
typer.Option(
|
||||
..., help="Must be enabled when using models connecting to remote services."
|
||||
@ -386,7 +386,7 @@ def convert(
|
||||
|
||||
accelerator_options = AcceleratorOptions(num_threads=num_threads, device=device)
|
||||
pipeline_options = PdfPipelineOptions(
|
||||
allow_remote_services=allow_remote_services,
|
||||
enable_remote_services=enable_remote_services,
|
||||
accelerator_options=accelerator_options,
|
||||
do_ocr=ocr,
|
||||
ocr_options=ocr_options,
|
||||
|
@ -257,7 +257,7 @@ class PipelineOptions(BaseModel):
|
||||
)
|
||||
document_timeout: Optional[float] = None
|
||||
accelerator_options: AcceleratorOptions = AcceleratorOptions()
|
||||
allow_remote_services: bool = False
|
||||
enable_remote_services: bool = False
|
||||
|
||||
|
||||
class PdfPipelineOptions(PipelineOptions):
|
||||
|
@ -49,17 +49,17 @@ class PictureDescriptionApiModel(PictureDescriptionBaseModel):
|
||||
def __init__(
|
||||
self,
|
||||
enabled: bool,
|
||||
allow_remote_services: bool,
|
||||
enable_remote_services: bool,
|
||||
options: PictureDescriptionApiOptions,
|
||||
):
|
||||
super().__init__(enabled=enabled, options=options)
|
||||
self.options: PictureDescriptionApiOptions
|
||||
|
||||
if self.enabled:
|
||||
if not allow_remote_services:
|
||||
if not enable_remote_services:
|
||||
raise OperationNotAllowed(
|
||||
"Connections to remote services is only allowed when set explicitly. "
|
||||
"pipeline_options.allow_remote_services=True."
|
||||
"pipeline_options.enable_remote_services=True."
|
||||
)
|
||||
|
||||
def _annotate_images(self, images: Iterable[Image.Image]) -> Iterable[str]:
|
||||
|
@ -201,7 +201,7 @@ class StandardPdfPipeline(PaginatedPipeline):
|
||||
):
|
||||
return PictureDescriptionApiModel(
|
||||
enabled=self.pipeline_options.do_picture_description,
|
||||
allow_remote_services=self.pipeline_options.allow_remote_services,
|
||||
enable_remote_services=self.pipeline_options.enable_remote_services,
|
||||
options=self.pipeline_options.picture_description_options,
|
||||
)
|
||||
elif isinstance(
|
||||
|
@ -21,7 +21,7 @@ def main():
|
||||
# $ vllm serve "HuggingFaceTB/SmolVLM-256M-Instruct"
|
||||
|
||||
pipeline_options = PdfPipelineOptions(
|
||||
allow_remote_services=True # <-- this is required!
|
||||
enable_remote_services=True # <-- this is required!
|
||||
)
|
||||
pipeline_options.do_picture_description = True
|
||||
pipeline_options.picture_description_options = PictureDescriptionApiOptions(
|
||||
|
@ -83,7 +83,7 @@ from docling.datamodel.base_models import InputFormat
|
||||
from docling.datamodel.pipeline_options import PdfPipelineOptions
|
||||
from docling.document_converter import DocumentConverter, PdfFormatOption
|
||||
|
||||
pipeline_options = PdfPipelineOptions(allow_remote_services=True)
|
||||
pipeline_options = PdfPipelineOptions(enable_remote_services=True)
|
||||
doc_converter = DocumentConverter(
|
||||
format_options={
|
||||
InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)
|
||||
@ -91,13 +91,13 @@ doc_converter = DocumentConverter(
|
||||
)
|
||||
```
|
||||
|
||||
When the value `allow_remote_services=True` is not set, the system will raise an exception `OperationNotAllowed()`.
|
||||
When the value `enable_remote_services=True` is not set, the system will raise an exception `OperationNotAllowed()`.
|
||||
|
||||
_Note: This option is only related to the system sending user data to remote services. Control of pulling data (e.g. model weights) follows the logic described in [Model prefetching and offline usage](#model-prefetching-and-offline-usage)._
|
||||
|
||||
##### List of remote model services
|
||||
|
||||
The options in this list require the explicit `allow_remote_services=True` when processing the documents.
|
||||
The options in this list require the explicit `enable_remote_services=True` when processing the documents.
|
||||
|
||||
- `PictureDescriptionApiOptions`: Using vision models via API calls.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user