Assert.That(EmbeddingChangeImpact.AffectsStoredIndex(dataSource,stored,storedwith{Name="Another name"}),Is.False,"The name of an embedding provider reaches no vector.");
Assert.That(EmbeddingChangeImpact.AffectsStoredIndex(dataSource,stored,storedwith{Num=42}),Is.False,"The number is there to sort the list with.");
Assert.That(EmbeddingChangeImpact.AffectsStoredIndex(dataSource,stored,storedwith{EmbeddingBatchSize=16}),Is.False,"How many chunks travel in one request says nothing about the vectors which come back.");
Assert.That(EmbeddingChangeImpact.AffectsStoredIndex(dataSource,stored,storedwith{CustomIconDataUrl="data:image/png;base64,AAAA"}),Is.False,"An icon is an icon.");
Assert.That(EmbeddingChangeImpact.AffectsStoredIndex(dataSource,stored,storedwith{Hostname="http://localhost:9999"}),Is.True,"Another server can serve another model under the same name.");
Assert.That(EmbeddingChangeImpact.AffectsStoredIndex(dataSource,stored,storedwith{Host=Host.LM_STUDIO}),Is.True,"Another kind of host speaks another API.");
Assert.That(EmbeddingChangeImpact.AffectsStoredIndex(dataSource,stored,storedwith{HFInferenceProvider=HFInferenceProvider.GROQ}),Is.True,"The same model name served by another backend is another vector source.");
Assert.That(EmbeddingChangeImpact.AffectsStoredIndex(dataSource,stored,storedwith{TokenizerFingerprint="BBBB"}),Is.True,"Another tokenizer counts tokens differently, so the text is cut elsewhere.");
Assert.That(EmbeddingChangeImpact.AffectsStoredIndex(dataSource,stored,storedwith{TokenizerPath="/somewhere/else/tokenizer.json"}),Is.False,"It is the same tokenizer under another path.");
Assert.That(EditKeepingTheProvider(embeddingProvider,stored,storedwith{MaxChunkTokenLength=256}),Is.True,"Other chunk boundaries mean other vectors.");
Assert.That(EditKeepingTheProvider(embeddingProvider,stored,storedwith{ChunkOverlapTokenLength=50}),Is.True,"Another overlap changes what every chunk starts with.");
});
}
/// <summary>
/// Writing out what a data source already follows must not cost it its index.
/// </summary>
/// <remarks>
/// A token limit of 0 means "follow the embedding provider", and opening the expert settings of a
/// data source fills that empty field with exactly the provider's limit. Both are the same cut,
/// so nobody may be asked about it -- and above all, nothing may be re-embedded for it. Somebody
/// who only wanted to change how many matches an answer may use paid for a full rebuild.
Assert.That(EditKeepingTheProvider(embeddingProvider,stored,storedwith{Name="Another name"}),Is.False,"The name is how the data source is offered, not how it was read.");
Assert.That(EditKeepingTheProvider(embeddingProvider,stored,storedwith{Description="Another description"}),Is.False,"The description is there for the agent which picks data sources.");
Assert.That(EditKeepingTheProvider(embeddingProvider,stored,storedwith{MaxMatches=42}),Is.False,"How many matches an answer may use is decided per query.");
Assert.That(EditKeepingTheProvider(embeddingProvider,stored,storedwith{ConfidenceLevel=ConfidenceLevel.HIGH}),Is.False,"The confidence level is enforced live on every request and changes no vector.");
});
}
/// <summary>
/// Checks what changing the embedding of a data source costs.
/// </summary>
/// <remarks>
/// This is why each side has to be asked with its own provider: a data source carries only the id
/// of its embedding provider, and that id is nowhere in the signature. Asking both sides with the
/// same provider would call this edit harmless, while the next indexing run throws everything away.