54 lines
1.7 KiB
Go
54 lines
1.7 KiB
Go
package source
|
|
|
|
import "encoding/json"
|
|
|
|
type SourceDocument struct {
|
|
ID string `json:"id"`
|
|
Kind string `json:"kind"`
|
|
Format string `json:"format"`
|
|
Digest string `json:"digest"`
|
|
Units []SourceUnit `json:"units"`
|
|
Metadata map[string]any `json:"metadata,omitempty"`
|
|
}
|
|
|
|
type SourceUnit struct {
|
|
ID int `json:"id"`
|
|
Kind string `json:"kind"`
|
|
Text string `json:"text"`
|
|
Ref SourceRef `json:"ref"`
|
|
Metadata map[string]any `json:"metadata,omitempty"`
|
|
}
|
|
|
|
type SourceRef struct {
|
|
SourceID string `json:"source_id"`
|
|
StartUnitID int `json:"start_unit_id"`
|
|
EndUnitID int `json:"end_unit_id"`
|
|
}
|
|
|
|
type ChunkAnnotations map[string]json.RawMessage
|
|
|
|
type ChunkPlan struct {
|
|
SourceDigest string `json:"source_digest"`
|
|
Ranges []ChunkRange `json:"ranges"`
|
|
Annotations ChunkAnnotations `json:"annotations,omitempty"`
|
|
}
|
|
|
|
type ChunkRange struct {
|
|
StartUnitID int `json:"start_unit_id"`
|
|
EndUnitID int `json:"end_unit_id"`
|
|
Annotations ChunkAnnotations `json:"annotations,omitempty"`
|
|
}
|
|
|
|
type Chunk struct {
|
|
ID string `json:"id"`
|
|
SourceID string `json:"source_id"`
|
|
Index int `json:"index"`
|
|
Ref SourceRef `json:"ref"`
|
|
Content []byte `json:"-"`
|
|
MediaType string `json:"media_type"`
|
|
Units []SourceUnit `json:"units"`
|
|
Metadata map[string]any `json:"metadata,omitempty"`
|
|
Annotations ChunkAnnotations `json:"annotations,omitempty"`
|
|
PlanAnnotations ChunkAnnotations `json:"plan_annotations,omitempty"`
|
|
}
|