docling

package
v0.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncDoclingResponse

type AsyncDoclingResponse struct {
	TaskID       string `json:"task_id"`
	TaskStatus   string `json:"task_status"`
	TaskPosition int    `json:"task_position,omitempty"`
}

type Client

type Client struct {
	ClientConfig *ClientConfig `json:"client_config"`
}

func NewClientFromURL

func NewClientFromURL(clientConfig *ClientConfig) *Client

func (*Client) ConvertFile

func (c *Client) ConvertFile(
	ctx context.Context, fileURL string, doclingConfig DoclingConfig,
) (*AsyncDoclingResponse, error)

func (*Client) GetConvertedFile

func (c *Client) GetConvertedFile(ctx context.Context, taskID string) (TaskStatus, *DoclingResponse, error)

type ClientConfig

type ClientConfig struct {
	URL                   string
	Key                   string
	MaxConcurrentRequests int64
	HTTPTimeout           time.Duration
	// contains filtered or unexported fields
}

type DoclingConfig

type DoclingConfig struct {
	FromFormats                     []string               `json:"from_formats"`
	ToFormats                       []string               `json:"to_formats"`
	ImageExportMode                 string                 `json:"image_export_mode"`
	DoOCR                           bool                   `json:"do_ocr"`
	ForceOCR                        bool                   `json:"force_ocr"`
	OCREngine                       string                 `json:"ocr_engine,omitempty"`
	OCRLang                         []string               `json:"ocr_lang"`
	OCRPreset                       string                 `json:"ocr_preset,omitempty"`
	PDFBackend                      string                 `json:"pdf_backend"`
	Pipeline                        string                 `json:"pipeline,omitempty"`
	TableMode                       string                 `json:"table_mode"`
	TableCellMatching               *bool                  `json:"table_cell_matching,omitempty"`
	DoTableStructure                *bool                  `json:"do_table_structure,omitempty"`
	IncludeImages                   *bool                  `json:"include_images,omitempty"`
	ImagesScale                     *float64               `json:"images_scale,omitempty"`
	DoCodeEnrichment                bool                   `json:"do_code_enrichment,omitempty"`
	DoFormulaEnrichment             bool                   `json:"do_formula_enrichment,omitempty"`
	DoPictureClassification         bool                   `json:"do_picture_classification,omitempty"`
	DoPictureDescription            bool                   `json:"do_picture_description,omitempty"`
	DoChartExtraction               bool                   `json:"do_chart_extraction,omitempty"`
	PictureDescriptionAPI           *PictureDescriptionAPI `json:"picture_description_api,omitempty"`
	PictureDescriptionAreaThreshold *float64               `json:"picture_description_area_threshold,omitempty"`
	DocumentTimeout                 *float64               `json:"document_timeout,omitempty"`
	PageRange                       []int                  `json:"page_range,omitempty"`
	MdPageBreakPlaceholder          string                 `json:"md_page_break_placeholder,omitempty"`
	AbortOnError                    bool                   `json:"abort_on_error"`
}

type DoclingRequestPayload

type DoclingRequestPayload struct {
	Options *DoclingConfig  `json:"options"`
	Sources []DoclingSource `json:"sources"`
}

type DoclingResponse

type DoclingResponse struct {
	Document       DoclingResponseDocument `json:"document"`
	Status         TaskStatus              `json:"status"`
	ProcessingTime float64                 `json:"processing_time"`
	Errors         []string                `json:"errors"`
}

type DoclingResponseDocument

type DoclingResponseDocument struct {
	FileName       string `json:"filename"`
	MDContent      string `json:"md_content"`
	HTMLContent    string `json:"html_content"`
	TextContent    string `json:"text_content"`
	DocTagsContent string `json:"doctags_content"`
}

type DoclingSource

type DoclingSource struct {
	URL     string            `json:"url"`
	Kind    string            `json:"kind"`
	Headers map[string]string `json:"headers,omitempty"`
}

type PictureDescriptionAPI added in v0.12.0

type PictureDescriptionAPI struct {
	URL         string                      `json:"url"`
	Params      PictureDescriptionAPIParams `json:"params"`
	Prompt      string                      `json:"prompt,omitempty"`
	Timeout     float64                     `json:"timeout,omitempty"`
	Concurrency int                         `json:"concurrency,omitempty"`
	Headers     map[string]string           `json:"headers,omitempty"`
}

type PictureDescriptionAPIParams added in v0.12.0

type PictureDescriptionAPIParams struct {
	Model     string `json:"model"`
	MaxTokens int    `json:"max_tokens,omitempty"`
}

type TaskStatus

type TaskStatus string
const (
	TaskStatusPending TaskStatus = "pending" // this is returned by /v1/status/poll and /v1/result endpoint
	TaskStatusStarted TaskStatus = "started" // this is returned by /v1/status/poll and /v1/result endpoint
	TaskStatusSuccess TaskStatus = "success" // this is returned by /v1/status/poll and /v1/result endpoint
	TaskStatusFailure TaskStatus = "failure" // this is returned by /v1/status/poll and /v1/result endpoint

	TaskStatusPartialSuccess TaskStatus = "partial_success" // this is only returned by /v1/result endpoint
	TaskStatusSkipped        TaskStatus = "skipped"         // this is only returned by /v1/result endpoint

	SemaphoreAcquireError = "failed to acquire docling semaphore"
	SemaphorePanicError   = "semaphore: released more than held"
)

type TaskStatusResponse

type TaskStatusResponse struct {
	TaskID       string     `json:"task_id"`
	TaskStatus   TaskStatus `json:"task_status"`
	TaskPosition int        `json:"task_position"`
	ErrorMessage string     `json:"error_message,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL