sema-unstructured 0.1.0

API reference · 4 exports

Source declarations and literal docstrings from this release. Package code was not executed.

unstructured/client

(unstructured/client . opts)
Build an Unstructured client map. Options: :api-key (default: UNSTRUCTURED_API_KEY env var), :base-url (default "https://api.unstructuredapp.io"), :timeout in ms (default 120000). Errors if no API key is found.

Source: package.sema:48

unstructured/partition

(unstructured/partition client source . opts)
Partition a document into element maps via POST /general/v0/general. source is either a file path string or a {:bytes <bytevector> :filename "name.ext"} map (bytes are uploaded verbatim). Options map: :strategy (e.g. "auto", "hi_res", "fast", "ocr_only", "vlm"; omitted → API default), :chunking-strategy (e.g. "by_title", "basic"; omitted → no chunking), :params (map of any other form fields, keyword or string keys, e.g. {:languages "eng" :coordinates #t}). Returns a list of element maps ({:type .. :element_id .. :text .. :metadata ..}).

Source: package.sema:138

unstructured/request

(unstructured/request client method path opts)
Make a raw Unstructured API request; the escape hatch every wrapper uses. method is "GET"/"POST"/..., path an API path ("/general/v0/general") or full URL. opts is a map: :multipart (list of {:name .. :content <string|bytevector> :filename ..?} parts) for form uploads, :body (map → JSON body) otherwise. Returns the decoded JSON body (nil when empty); raises on non-2xx with method, path, status, and the API message.

Source: package.sema:88

unstructured/text-of

(unstructured/text-of elements)
Join the :text of a partition element list into a single newline-separated string. Elements missing :text contribute nothing. Accepts nil or an empty list (→ "").

Source: package.sema:149