Documentation
¶
Index ¶
- Constants
- func DocumentParseDefinition() types.Tool
- func DocumentSpecRecommendDefinition() types.Tool
- func IsBuiltinCoreTool(name string) bool
- func IsPDFSpecialistToolName(name string) bool
- func IsPDFUnifiedToolName(name string) bool
- func NormalizePDFSurface(raw string) string
- func PDFAllToolNames() []string
- func PDFDefinition(name string, unifiedAvailable bool) (types.Tool, bool)
- func PDFSpecialistToolNames() []string
- func PDFSurfaceFallbackEntrypoint(surface string) string
- func PDFSurfaceForToolName(name string) string
- func PDFToolMetadata(defs []types.Tool) map[string]ToolMetadata
- func PDFUnifiedToolNames() []string
- func RegisterDocumentParseTools(reg toolcontract.Registrar, opts DocumentParseToolOptions) error
- func RegisterPDFTools(reg toolcontract.Registrar, opts PDFToolOptions) error
- func ResolvePDFSurface(surface string, entrypoint string) (string, string)
- type ArtifactLister
- type ArtifactListerFunc
- type DocumentHost
- type DocumentParseToolOptions
- type DocumentParser
- type DocumentParserFunc
- type DocumentTextLoader
- type DocumentTextLoaderFunc
- type DocumentTextRequest
- type ErrorProjector
- type ErrorProjectorFuncs
- type PDFBackend
- type PDFBackendAvailability
- type PDFBackendAvailabilityDetails
- type PDFFont
- type PDFHost
- type PDFInputRequest
- type PDFInputResolver
- type PDFInputResolverFunc
- type PDFLayoutBackend
- type PDFMetadataResult
- type PDFModelCandidate
- type PDFNativeRequest
- type PDFOCRRequest
- type PDFOutline
- type PDFPageText
- type PDFRenderedPage
- type PDFTextResult
- type PDFToolOptions
- type PathRequest
- type PathResolver
- type PathResolverFunc
- type ResolvedPDFInput
- type ResolvedPath
- type ToolMetadata
Constants ¶
const ( PDFSurfaceUnified = "pdf_unified" PDFSurfaceSpecialist = "pdf_specialist" )
const ToolSourceBuiltin = agentxtools.ToolSourceBuiltin
Variables ¶
This section is empty.
Functions ¶
func DocumentParseDefinition ¶
DocumentParseDefinition returns the model-facing document_parse contract.
func DocumentSpecRecommendDefinition ¶
DocumentSpecRecommendDefinition returns the read-only recommendation contract.
func IsBuiltinCoreTool ¶
func IsPDFSpecialistToolName ¶
func IsPDFUnifiedToolName ¶
func NormalizePDFSurface ¶
func PDFAllToolNames ¶
func PDFAllToolNames() []string
func PDFDefinition ¶
PDFDefinition returns one model-facing PDF tool declaration. The boolean controls only specialist guidance text and never enables execution.
func PDFSpecialistToolNames ¶
func PDFSpecialistToolNames() []string
func PDFSurfaceForToolName ¶
func PDFToolMetadata ¶
func PDFToolMetadata(defs []types.Tool) map[string]ToolMetadata
func PDFUnifiedToolNames ¶
func PDFUnifiedToolNames() []string
func RegisterDocumentParseTools ¶
func RegisterDocumentParseTools(reg toolcontract.Registrar, opts DocumentParseToolOptions) error
func RegisterPDFTools ¶
func RegisterPDFTools(reg toolcontract.Registrar, opts PDFToolOptions) error
Types ¶
type ArtifactLister ¶
ArtifactLister returns display-safe files written by an already authorized output directory.
type ArtifactListerFunc ¶
ArtifactListerFunc adapts a function to ArtifactLister.
func (ArtifactListerFunc) ListArtifacts ¶
type DocumentHost ¶
type DocumentHost struct {
Runtime DocumentParser
Paths PathResolver
Text DocumentTextLoader
Artifacts ArtifactLister
Errors ErrorProjector
LoadSpec func(string) (*configs.DocSpec, error)
RecommendSpec func(string, []*configs.DocSpec) []configs.SpecRecommendation
}
DocumentHost is the explicit construction seam for document_parse and document_spec_recommend. Runtime owns the portable parsing implementation; the remaining ports own authorization and concrete file access.
type DocumentParseToolOptions ¶
type DocumentParseToolOptions struct {
Root string
DefaultModel string
DefaultArtifactPolicy pipeline.ArtifactPolicy
DefaultExtractionMode pipeline.DocumentExtractionMode
DefaultTimeoutMs int
MaxResponseBytes int
Host DocumentHost
// EnabledTools is intentionally required for registration. document_parse
// is a specialist surface and must not become visible by helper defaults.
EnabledTools []string
}
type DocumentParser ¶
type DocumentParser interface {
Run(context.Context, pipeline.ParseRequest) (*types.DocumentResult, error)
}
DocumentParser is the narrow execution seam consumed by document_parse. *pipeline.Runtime satisfies it directly; compatibility Hosts can adapt an existing entry point without exposing their construction graph.
type DocumentParserFunc ¶
type DocumentParserFunc func(context.Context, pipeline.ParseRequest) (*types.DocumentResult, error)
DocumentParserFunc adapts a function to DocumentParser.
func (DocumentParserFunc) Run ¶
func (f DocumentParserFunc) Run(ctx context.Context, request pipeline.ParseRequest) (*types.DocumentResult, error)
type DocumentTextLoader ¶
type DocumentTextLoader interface {
LoadDocumentText(context.Context, DocumentTextRequest) ([]string, error)
}
DocumentTextLoader owns concrete file decoding, OCR routing and filesystem access used by document_spec_recommend.
type DocumentTextLoaderFunc ¶
type DocumentTextLoaderFunc func(context.Context, DocumentTextRequest) ([]string, error)
DocumentTextLoaderFunc adapts a function to DocumentTextLoader.
func (DocumentTextLoaderFunc) LoadDocumentText ¶
func (f DocumentTextLoaderFunc) LoadDocumentText(ctx context.Context, request DocumentTextRequest) ([]string, error)
type DocumentTextRequest ¶
type DocumentTextRequest struct {
Path string
PageLimit int
PDFParseMode pipeline.PDFParseMode
ExtractionMode pipeline.DocumentExtractionMode
}
DocumentTextRequest asks the Host for a bounded page representation.
type ErrorProjector ¶
ErrorProjector maps Host errors to stable, display-safe tool output.
type ErrorProjectorFuncs ¶
type ErrorProjectorFuncs struct {
ClassifyFunc func(error) string
DisplayFunc func(error, string, string) string
}
ErrorProjectorFuncs is the function adapter for ErrorProjector.
func (ErrorProjectorFuncs) Classify ¶
func (p ErrorProjectorFuncs) Classify(err error) string
type PDFBackend ¶
type PDFBackend interface {
Name() string
Availability(context.Context) PDFBackendAvailability
ExtractAllText(context.Context, string) (PDFTextResult, error)
ExtractPageText(context.Context, string, []int) (PDFTextResult, error)
ReadMetadata(context.Context, string, bool) (PDFMetadataResult, error)
}
PDFBackend owns concrete PDF extraction and metadata access.
type PDFBackendAvailability ¶
type PDFBackendAvailability struct {
Name string `json:"name"`
Available bool `json:"available"`
Reason string `json:"reason,omitempty"`
}
PDFBackendAvailability is an explicit Host probe result. Canonical tools do not discover binaries, Python installations or commercial SDK licenses.
type PDFBackendAvailabilityDetails ¶
type PDFBackendAvailabilityDetails struct {
Primary PDFBackendAvailability `json:"primary"`
Fallback PDFBackendAvailability `json:"fallback"`
}
PDFBackendAvailabilityDetails describes the configured primary/fallback pair.
type PDFHost ¶
type PDFHost struct {
Inputs PDFInputResolver
LayoutName string
Layout func(context.Context, string, []int) (PDFTextResult, error)
Chat func(context.Context, llm.ChatInput) (*llm.ChatResponse, error)
Vision func(context.Context, llm.VisionInput) (*llm.VisualResponse, error)
Native func(context.Context, PDFNativeRequest) (string, error)
OCR func(context.Context, PDFOCRRequest) ([]PDFPageText, error)
Render func(context.Context, string, []int, int) ([]PDFRenderedPage, func() error, error)
PublishRendered func(context.Context, string, string, []PDFRenderedPage) ([]mediaartifact.Descriptor, error)
}
PDFHost contains every side-effecting/model capability needed by the portable PDF implementation. Nil optional capabilities fail closed or follow the existing deterministic fallback path.
type PDFInputRequest ¶
type PDFInputRequest struct {
Root string
Reference string
TimeoutMS int
MaxBytes int
Parameters map[string]any
}
PDFInputRequest asks the Host to authorize and materialize one local, file-URL or remote reference. Remote fetch policy belongs entirely to Host.
type PDFInputResolver ¶
type PDFInputResolver interface {
ResolvePDFInput(context.Context, PDFInputRequest) (ResolvedPDFInput, error)
}
PDFInputResolver is the only local/remote input access used by PDF tools.
type PDFInputResolverFunc ¶
type PDFInputResolverFunc func(context.Context, PDFInputRequest) (ResolvedPDFInput, error)
PDFInputResolverFunc adapts a function to PDFInputResolver.
func (PDFInputResolverFunc) ResolvePDFInput ¶
func (f PDFInputResolverFunc) ResolvePDFInput(ctx context.Context, request PDFInputRequest) (ResolvedPDFInput, error)
type PDFLayoutBackend ¶
type PDFLayoutBackend interface {
ExtractLayoutText(context.Context, string, []int) (PDFTextResult, error)
}
PDFLayoutBackend is the optional layout-preserving extension used for table and field-alignment evidence.
type PDFMetadataResult ¶
type PDFMetadataResult struct {
PageCount int
Outline *PDFOutline
Fonts []PDFFont
TotalRects int
PagesWithGraphics int
MaxRectsPerPage int
GraphicPages []int
RectsByPage map[int]int
}
PDFMetadataResult contains portable metadata required by the tool layer.
type PDFModelCandidate ¶
type PDFModelCandidate struct {
Name string `json:"name"`
Client string `json:"client,omitempty"`
Model string `json:"model,omitempty"`
NativePDF bool `json:"native_pdf,omitempty"`
SupportsVision bool `json:"-"`
ConfigKey string `json:"-"`
Vendor string `json:"-"`
}
PDFModelCandidate is one explicitly supplied model route. Model discovery, provider credentials and product routing remain Host-owned.
type PDFNativeRequest ¶
type PDFNativeRequest struct {
Candidate PDFModelCandidate
Prompt string
Paths []string
}
PDFNativeRequest contains no credential or provider client. The Host chooses and executes the concrete native-PDF provider.
type PDFOCRRequest ¶
PDFOCRRequest delegates optional OCR enrichment to the Host.
type PDFOutline ¶
type PDFOutline struct {
Title string `json:"title"`
Children []PDFOutline `json:"children,omitempty"`
}
PDFOutline is a recursive document outline item.
type PDFPageText ¶
PDFPageText is one physical page and its extracted text.
type PDFRenderedPage ¶
PDFRenderedPage is an explicitly rendered page owned by a Host adapter.
type PDFTextResult ¶
type PDFTextResult struct {
Pages []PDFPageText `json:"pages"`
}
PDFTextResult is the ordered text returned by a PDFBackend.
type PDFToolOptions ¶
type PDFToolOptions struct {
Root string
EnabledTools []string
MaxExtractChars int
MaxPageChars int
MaxPages int
TimeoutMs int
MaxResponseBytes int
Backend PDFBackend
FallbackBackend PDFBackend
OCRProfile string
PreferredModel string
FallbackModels []string
PreferNative *bool
NativePageSelectionPolicy string
ArtifactCacheSize int
Models []PDFModelCandidate
Host PDFHost
}
type PathRequest ¶
PathRequest describes one Host-authorized workspace path resolution. Canonical tools never infer an allowlist from the process working directory.
type PathResolver ¶
type PathResolver interface {
ResolvePath(context.Context, PathRequest) (ResolvedPath, error)
}
PathResolver is the authorization seam for document and artifact paths.
type PathResolverFunc ¶
type PathResolverFunc func(context.Context, PathRequest) (ResolvedPath, error)
PathResolverFunc adapts a function to PathResolver.
func (PathResolverFunc) ResolvePath ¶
func (f PathResolverFunc) ResolvePath(ctx context.Context, request PathRequest) (ResolvedPath, error)
type ResolvedPDFInput ¶
type ResolvedPDFInput struct {
Path string
Display string
CacheIdentity string
Remote bool
Cleanup func()
}
ResolvedPDFInput is the bounded local materialization consumed by portable PDF coordination.
type ResolvedPath ¶
ResolvedPath separates a backend path from the display-safe path returned to the model.
type ToolMetadata ¶
type ToolMetadata = agentxtools.ToolMetadata
func PDFToolMetadataForName ¶
func PDFToolMetadataForName(name string) ToolMetadata
PDFToolMetadataForName returns canonical descriptive metadata for one PDF entrypoint. It grants no authorization or backend access.
Source Files
¶
- document_parse_builtin.go
- helpers.go
- pdf_analyze_multi.go
- pdf_artifact_cache.go
- pdf_artifact_paths.go
- pdf_backend.go
- pdf_builtin.go
- pdf_media_artifacts.go
- pdf_models.go
- pdf_native.go
- pdf_remote.go
- pdf_structured.go
- pdf_structured_evaluation.go
- pdf_surface.go
- pdf_tool_metadata.go
- pdf_tool_schema.go
- pdf_unified.go
- pdf_unified_cache.go
- pdf_unified_context.go
- pdf_unified_evidence.go
- pdf_unified_focus.go
- pdf_unified_visual_cache.go
- pdf_unified_visuals.go
- pdf_visual.go
- ports.go
- textutil.go