1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
mod display;
use weavatrix_graph::GraphError;
/// Result type returned by semantic-linking operations.
pub type Result<T> = std::result::Result<T, SemanticError>;
/// Validation and graph-integration failures.
#[derive(Debug)]
#[non_exhaustive]
pub enum SemanticError {
/// The model identifier is empty.
EmptyModel,
/// The model identifier has leading or trailing whitespace.
ModelHasSurroundingWhitespace,
/// The cosine threshold is non-finite or outside `[0, 1]`.
InvalidSimilarityThreshold,
/// Top-K must be positive.
ZeroTopK,
/// The configured vector limit must be positive.
ZeroMaxVectors,
/// A vector has no dimensions.
EmptyVector { node: String },
/// A vector contains NaN or infinity.
NonFiniteVectorValue { node: String, index: usize },
/// A vector has no direction and cannot be compared with cosine similarity.
ZeroVector { node: String },
/// More vectors were supplied than the caller-configured safety bound.
TooManyVectors { count: usize, maximum: usize },
/// Two vectors target the same graph node.
DuplicateNode { node: String },
/// A vector targets a node absent from the input graph.
MissingGraphNode { node: String },
/// Vectors from the same model have inconsistent dimensions.
DimensionMismatch {
node: String,
expected: usize,
actual: usize,
},
/// A platform-sized counter could not be represented in graph metadata.
NumericOverflow,
/// Semantic candidate or report storage could not be reserved.
AllocationFailed,
/// The vector candidate-pool multiplier must be positive.
ZeroCandidatePoolMultiplier,
/// A candidate engine returned a key outside the current semantic input.
CandidateKeyOutOfRange { key: u64, vector_count: usize },
/// An SEO site identifier is empty.
EmptySeoSite { node: String },
/// An SEO site identifier has leading or trailing whitespace.
SeoSiteHasSurroundingWhitespace { node: String },
/// An SEO canonical identifier is empty.
EmptySeoCanonical { node: String },
/// An SEO canonical identifier has leading or trailing whitespace.
SeoCanonicalHasSurroundingWhitespace { node: String },
/// An SEO language identifier is empty.
EmptySeoLanguage { node: String },
/// An SEO language identifier has leading or trailing whitespace.
SeoLanguageHasSurroundingWhitespace { node: String },
/// More than one SEO profile targets the same graph node.
DuplicateSeoProfile { node: String },
/// A semantic vector has no corresponding SEO profile.
MissingSeoProfile { node: String },
/// An SEO profile targets a node absent from the graph.
SeoProfileMissingGraphNode { node: String },
/// The anchor matcher model identifier is empty.
EmptyAnchorModel,
/// The anchor matcher model identifier has surrounding whitespace.
AnchorModelHasSurroundingWhitespace,
/// The anchor similarity threshold is non-finite or outside `[0, 1]`.
InvalidAnchorSimilarityThreshold,
/// At least one anchor suggestion per link must be requested.
ZeroAnchorSuggestions,
/// A candidate anchor locator is empty.
EmptyAnchorLocator { source: String },
/// Candidate anchor text is empty.
EmptyAnchorText { source: String, locator: String },
/// Candidate anchor context is empty.
EmptyAnchorContext { source: String, locator: String },
/// Candidate anchor text is not present in its supplied source context.
AnchorTextOutsideContext { source: String, locator: String },
/// Candidate anchor text metadata has surrounding whitespace.
AnchorTextHasSurroundingWhitespace {
source: String,
locator: String,
field: &'static str,
},
/// More than one candidate uses the same source and locator.
DuplicateAnchorCandidate { source: String, locator: String },
/// A semantic link target has no page vector for anchor matching.
MissingAnchorTargetVector { target: String },
/// A candidate anchor vector does not match the target-vector dimension.
AnchorDimensionMismatch {
source: String,
locator: String,
expected: usize,
actual: usize,
},
/// A semantic edge was produced by another embedding model.
AnchorModelMismatch { expected: String, actual: String },
/// A semantic edge is missing an attribute required for anchor matching.
MissingSemanticEdgeAttribute { attribute: &'static str },
/// The first-party vector candidate engine rejected a build or query.
#[cfg(feature = "vector-search")]
VectorSearch(weavatrix_search_vector::SearchError),
/// The underlying graph rejected a kind, identifier, provenance, or edge.
Graph(GraphError),
}