Documentation
¶
Index ¶
- type Client
- func (c *Client) ConvertBytes(ctx context.Context, data []byte, filename string) (*ConversionResult, error)
- func (c *Client) ConvertFile(ctx context.Context, filePath string) (*ConversionResult, error)
- func (c *Client) ConvertURL(ctx context.Context, docURL string) (*ConversionResult, error)
- func (c *Client) IsAvailable(ctx context.Context) bool
- type ConversionResult
- type ExtractedImage
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 ¶
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 ¶
ConvertFile sends filePath to docling-serve and returns the markdown + images.
func (*Client) ConvertURL ¶
ConvertURL fetches and converts a remote document (e.g. an arXiv PDF URL).
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.