docling

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 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 Client

type Client struct {
	// contains filtered or unexported fields
}

Client calls a running docling-serve instance to convert documents to markdown.

func NewClient

func NewClient(baseURL string) *Client

NewClient creates a client pointing at a docling-serve base URL. baseURL is typically "http://localhost:5001".

func (*Client) ConvertBytes

func (c *Client) ConvertBytes(ctx context.Context, data []byte, filename string) (*ConversionResult, error)

ConvertBytes converts an in-memory document without writing it to disk first. filename is used only to hint the MIME type to docling (e.g. "report.pdf").

func (*Client) ConvertFile

func (c *Client) ConvertFile(ctx context.Context, filePath string) (*ConversionResult, error)

ConvertFile sends filePath to docling-serve and returns the markdown + images.

func (*Client) ConvertURL

func (c *Client) ConvertURL(ctx context.Context, docURL string) (*ConversionResult, error)

ConvertURL fetches and converts a remote document (e.g. an arXiv PDF URL).

func (*Client) IsAvailable

func (c *Client) IsAvailable(ctx context.Context) bool

IsAvailable does a cheap health check against the running service.

type ConversionResult

type ConversionResult struct {
	// Markdown is the full document rendered as Markdown.
	Markdown string

	// Images are the pictures extracted from the document (inline figures, diagrams).
	// Each image carries a base64-encoded data URI so the agent can view them.
	Images []ExtractedImage

	// PageCount is the number of pages (0 if unknown).
	PageCount int
}

ConversionResult is what we get back from docling-serve for a single file.

type ExtractedImage

type ExtractedImage struct {
	// Filename is the suggested on-disk name (e.g. "image_0001.png").
	Filename string
	// MimeType is the image MIME type (e.g. "image/png").
	MimeType string
	// Base64 is the raw base64-encoded image bytes (no data-URI prefix).
	Base64 string
}

ExtractedImage is one picture found inside the converted document.

Jump to

Keyboard shortcuts

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