Documentation
¶
Overview ¶
Package knowledge builds and serves the read-only knowledge representation of an M-Press site. The artifact is deterministic and contains no credentials or authoring controls.
Index ¶
- Constants
- func Generate(output string, cfg config.Config, pagesByLanguage map[string][]*content.Page) error
- func HTTPHandler(store *Store, version string) http.Handler
- func NewMCPServer(store *Store, version string) *mcp.Server
- func RunStdio(ctx context.Context, store *Store, version string) error
- type Artifacts
- type Chunk
- type EvaluationCase
- type EvaluationReport
- type EvaluationResult
- type EvaluationSuite
- type GetPageInput
- type GetPageOutput
- type Index
- type IndexTerm
- type Manifest
- type Page
- type PageSummary
- type Posting
- type SearchInput
- type SearchOptions
- type SearchOutput
- type SearchResult
- type SiteInfo
- type Store
Constants ¶
View Source
const ( Schema = 2 Directory = "knowledge" ManifestFile = "manifest.json" PagesFile = "pages.json" ChunksFile = "chunks.json" IndexFile = "index.json" )
Variables ¶
This section is empty.
Functions ¶
func NewMCPServer ¶
NewMCPServer creates a read-only server over one verified build artifact. It intentionally shares no handlers with the development authoring server.
Types ¶
type Chunk ¶
type Chunk struct {
ID string `json:"id"`
PageID string `json:"pageId"`
ResourceURI string `json:"resourceUri"`
Language string `json:"language"`
Version string `json:"version"`
Route string `json:"route"`
URL string `json:"url"`
Source string `json:"source"`
PageTitle string `json:"pageTitle"`
Title string `json:"title"`
HeadingID string `json:"headingId,omitempty"`
HeadingPath []string `json:"headingPath,omitempty"`
Tags []string `json:"tags,omitempty"`
Part int `json:"part,omitempty"`
Text string `json:"text"`
}
type EvaluationCase ¶
type EvaluationReport ¶
type EvaluationReport struct {
Suite string `json:"suite"`
Cases int `json:"cases"`
Passed int `json:"passed"`
RecallAt1 float64 `json:"recallAt1"`
RecallAt3 float64 `json:"recallAt3"`
RecallAt5 float64 `json:"recallAt5"`
MRR float64 `json:"mrr"`
CitationRate float64 `json:"citationRate"`
Results []EvaluationResult `json:"results"`
}
type EvaluationResult ¶
type EvaluationSuite ¶
type EvaluationSuite struct {
Name string `json:"name"`
Cases []EvaluationCase `json:"cases"`
}
func LoadEvaluationSuite ¶
func LoadEvaluationSuite(path string) (EvaluationSuite, error)
type GetPageInput ¶
type GetPageOutput ¶
type GetPageOutput struct {
ID string `json:"id"`
ResourceURI string `json:"resourceUri"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
URL string `json:"url"`
Language string `json:"language"`
Version string `json:"version"`
Tags []string `json:"tags,omitempty"`
Text string `json:"text"`
}
type Manifest ¶
type Manifest struct {
Schema int `json:"schema"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
BaseURL string `json:"baseUrl,omitempty"`
DefaultLanguage string `json:"defaultLanguage"`
Languages []string `json:"languages"`
CurrentVersion string `json:"currentVersion"`
Digest string `json:"digest"`
Pages []PageSummary `json:"pages"`
Artifacts Artifacts `json:"artifacts"`
}
type Page ¶
type Page struct {
PageSummary
Text string `json:"text"`
}
type PageSummary ¶
type PageSummary struct {
ID string `json:"id"`
ResourceURI string `json:"resourceUri"`
Language string `json:"language"`
Version string `json:"version"`
Route string `json:"route"`
URL string `json:"url"`
Source string `json:"source"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Tags []string `json:"tags,omitempty"`
ChunkCount int `json:"chunkCount"`
}
type SearchInput ¶
type SearchInput struct {
Query string `json:"query" jsonschema:"Words or exact phrase to find in the knowledge base."`
Language string `json:"language,omitempty" jsonschema:"Optional language code such as en or fr."`
Version string `json:"version,omitempty" jsonschema:"Optional documentation version. Defaults to the current version."`
Tags []string `json:"tags,omitempty" jsonschema:"Optional tags that every result must contain."`
Limit int `json:"limit,omitempty" jsonschema:"Maximum results from 1 to 50. Defaults to 8."`
}
type SearchOptions ¶
type SearchOutput ¶
type SearchOutput struct {
Query string `json:"query"`
Results []SearchResult `json:"results"`
}
type SearchResult ¶
type SearchResult struct {
ChunkID string `json:"chunkId"`
PageID string `json:"pageId"`
ResourceURI string `json:"resourceUri"`
PageResource string `json:"pageResource"`
Title string `json:"title"`
PageTitle string `json:"pageTitle"`
URL string `json:"url"`
Language string `json:"language"`
Version string `json:"version"`
HeadingPath []string `json:"headingPath,omitempty"`
Snippet string `json:"snippet"`
Score int `json:"score"`
}
type SiteInfo ¶
type SiteInfo struct {
Title string `json:"title"`
Description string `json:"description,omitempty"`
BaseURL string `json:"baseUrl,omitempty"`
DefaultLanguage string `json:"defaultLanguage"`
Languages []string `json:"languages"`
CurrentVersion string `json:"currentVersion"`
Pages int `json:"pages"`
Sections int `json:"sections"`
Digest string `json:"digest"`
}
type Store ¶
type Store struct {
Manifest Manifest
Pages []Page
Chunks []Chunk
// contains filtered or unexported fields
}
func LoadAll ¶
LoadAll loads the current artifact and any captured version artifacts mounted beneath the generated site. Mounted snapshots are relabelled in memory so version filters and resource identifiers cannot collide with the current corpus or with each other.
func (*Store) Evaluate ¶
func (s *Store) Evaluate(suite EvaluationSuite, limit int) EvaluationReport
func (*Store) Search ¶
func (s *Store) Search(options SearchOptions) []SearchResult
Click to show internal directories.
Click to hide internal directories.