Help us shape the future of Go! Take the 2026 Go Developer Survey

web

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package web defines readable web content, extraction and Agent adapters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Tool

func Tool(reader Reader, maxChars int) (tool.Tool, error)

Tool exposes a bounded read operation. Results remain untrusted source text.

func ValidateURL

func ValidateURL(raw string) error

ValidateURL accepts absolute HTTP(S) URLs without embedded credentials.

Types

type Document

type Document struct {
	URL      string            `json:"url"`
	Title    string            `json:"title"`
	Text     string            `json:"text"`
	Markdown string            `json:"markdown"`
	Links    []Link            `json:"links,omitempty"`
	Metadata map[string]string `json:"metadata,omitempty"`
}

Document is untrusted source material, not application instructions.

type Extractor

type Extractor interface {
	Extract(ctx context.Context, url string, html []byte) (*Document, error)
}

Extractor extracts already-fetched UTF-8 HTML without fetching its links.

type Link struct {
	Text string `json:"text"`
	URL  string `json:"url"`
}

Link preserves a source reference in readable content.

type Loader

type Loader struct {
	Reader       Reader
	URLs         []string
	SourcePrefix string
}

Loader reads a complete, explicitly configured URL list into a RAG snapshot. Any failed page fails the whole load, avoiding accidental Sync deletions.

func (Loader) Load

func (l Loader) Load(ctx context.Context) ([]*rag.Document, error)

Load implements rag.Loader; an empty URL list is an empty full snapshot.

type Reader

type Reader interface {
	Read(ctx context.Context, url string) (*Document, error)
}

Reader fetches and extracts a URL under application-selected access policies.

Jump to

Keyboard shortcuts

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