Documentation
¶
Overview ¶
Package content owns the ordered text, media, and citation values shared by chat and tool output.
Example ¶
package main
import (
"fmt"
"github.com/Tangerg/scope/core/content"
)
func main() {
block := content.Block{Kind: content.Text, Text: "Report", Citations: []content.Citation{{Source: content.CitationSource{Kind: content.CitationSourceReference, Value: "report:2026"}}}}
copy := block.Clone()
copy.Citations[0].Source.Value = "another report"
fmt.Println(block.Validate(), block.Citations[0].Source.Value)
}
Output: <nil> report:2026
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidBlock = errors.New("content: invalid block")
var ErrInvalidCitation = errors.New("content: invalid citation")
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
Kind Kind `json:"kind"`
Text string `json:"text,omitempty"`
Media *media.Media `json:"media,omitzero"`
Citations []Citation `json:"citations,omitempty"`
Metadata metadata.Map `json:"metadata,omitzero"`
}
Block carries content, never a control instruction, tool call, or nested result.
func (Block) JSONSchemaModel ¶
func (Block) MarshalJSON ¶
func (*Block) UnmarshalJSON ¶
type Citation ¶
type Citation struct {
Source CitationSource `json:"source"`
Title string `json:"title,omitempty"`
Quote string `json:"quote,omitempty"`
}
Citation is the portable identity and quoted evidence attached to a text part. Exact provider coordinates remain available through response metadata.
type CitationSource ¶
type CitationSource struct {
Kind CitationSourceKind `json:"kind"`
Value string `json:"value"`
}
CitationSource identifies cited material without adopting a provider's location taxonomy. Provider-native page, block, and character coordinates remain in the preserved native response. URI sources may use any scheme, including file and urn, and may include a fragment. They require a non-empty target and contain no whitespace. Validation identifies material; it never resolves the URI or grants permission to access it.
func (CitationSource) Validate ¶
func (c CitationSource) Validate() error
type CitationSourceKind ¶
type CitationSourceKind string
CitationSourceKind distinguishes an absolute URI from an opaque source reference whose interpretation remains with the provider or host.
const ( CitationSourceURI CitationSourceKind = "uri" CitationSourceReference CitationSourceKind = "reference" )
func (CitationSourceKind) Valid ¶
func (c CitationSourceKind) Valid() bool