Record Class KnowledgeSourceConfig
Both Knowledge declarations and AgentBuilder sources
are normalized to this model before reaching source loaders.
It carries ingestion configuration only — what to load and from where.
select keeps the part of each loaded document at and below a
structural path; blank keeps it whole.
refresh is how often a FILE source is checked for changed files
once loaded; empty loads it once. How the loaded documents are then used
is KnowledgeEntry's to say, and how they are searched is
normalized to RetrievalConfig rather than to this record.
- Since:
- 0.13.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder retaining the annotation defaults. -
Constructor Summary
ConstructorsConstructorDescriptionKnowledgeSourceConfig(String name, Knowledge.Type type, DocumentFormat format, String path, String connection, String query, boolean enabled) Seven-argument form: empty include/exclude selectors.KnowledgeSourceConfig(String name, Knowledge.Type type, DocumentFormat format, String path, String connection, String query, boolean enabled, List<String> include, List<String> exclude) Nine-argument form:KnowledgeUnit.AUTOandChunkContext.NONE.KnowledgeSourceConfig(String name, Knowledge.Type type, DocumentFormat format, String path, String connection, String query, boolean enabled, List<String> include, List<String> exclude, ChunkContext chunkContext, String chunkContextModel) Eleven-argument form:KnowledgeUnit.AUTO.KnowledgeSourceConfig(String name, Knowledge.Type type, DocumentFormat format, String path, String connection, String query, boolean enabled, List<String> include, List<String> exclude, KnowledgeUnit unit) Ten-argument form:ChunkContext.NONE.KnowledgeSourceConfig(String name, Knowledge.Type type, DocumentFormat format, String path, String connection, String query, boolean enabled, List<String> include, List<String> exclude, KnowledgeUnit unit, ChunkContext chunkContext, String chunkContextModel) Twelve-argument form: noselect, so whole documents load.KnowledgeSourceConfig(String name, Knowledge.Type type, DocumentFormat format, String path, String connection, String query, boolean enabled, List<String> include, List<String> exclude, KnowledgeUnit unit, ChunkContext chunkContext, String chunkContextModel, String select) Thirteen-argument form: refresh off, so a FILE source loads once.KnowledgeSourceConfig(String name, Knowledge.Type type, DocumentFormat format, String path, String connection, String query, boolean enabled, List<String> include, List<String> exclude, KnowledgeUnit unit, ChunkContext chunkContext, String chunkContextModel, String select, Optional<Duration> refresh) Creates an instance of aKnowledgeSourceConfigrecord class.KnowledgeSourceConfig(String name, Knowledge.Type type, String path, String connection, String query, boolean enabled) Creates a source using the canonicalDocumentFormat.AUTOdefault and empty selectors. -
Method Summary
Modifier and TypeMethodDescriptionbuilder(String name, Knowledge.Type type) Returns the value of thechunkContextrecord component.Returns the value of thechunkContextModelrecord component.Returns the value of theconnectionrecord component.booleanenabled()Returns the value of theenabledrecord component.final booleanIndicates whether some other object is "equal to" this one.exclude()Returns the value of theexcluderecord component.static KnowledgeSourceConfigformat()Returns the value of theformatrecord component.static KnowledgeSourceConfigConverts aKnowledgedeclaration's source members to the canonical runtime model.final inthashCode()Returns a hash code value for this object.include()Returns the value of theincluderecord component.static KnowledgeSourceConfigAMEMORYsource: chat knowledge the application supplies at runtime through aChatKnowledgeBinding.name()Returns the value of thenamerecord component.path()Returns the value of thepathrecord component.query()Returns the value of thequeryrecord component.refresh()Returns the value of therefreshrecord component.select()Returns the value of theselectrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.unit()Returns the value of theunitrecord component.Returns a copy of this declaration with only the location replaced.withSelection(Knowledge.Type type, String path, KnowledgeUnit unit) Copies this configuration with optional type, path and unit selections.
-
Constructor Details
-
KnowledgeSourceConfig
public KnowledgeSourceConfig(String name, Knowledge.Type type, DocumentFormat format, String path, String connection, String query, boolean enabled, List<String> include, List<String> exclude, KnowledgeUnit unit, ChunkContext chunkContext, String chunkContextModel, String select, Optional<Duration> refresh) Creates an instance of aKnowledgeSourceConfigrecord class.- Parameters:
name- the value for thenamerecord componenttype- the value for thetyperecord componentformat- the value for theformatrecord componentpath- the value for thepathrecord componentconnection- the value for theconnectionrecord componentquery- the value for thequeryrecord componentenabled- the value for theenabledrecord componentinclude- the value for theincluderecord componentexclude- the value for theexcluderecord componentunit- the value for theunitrecord componentchunkContext- the value for thechunkContextrecord componentchunkContextModel- the value for thechunkContextModelrecord componentselect- the value for theselectrecord componentrefresh- the value for therefreshrecord component
-
KnowledgeSourceConfig
public KnowledgeSourceConfig(String name, Knowledge.Type type, DocumentFormat format, String path, String connection, String query, boolean enabled, List<String> include, List<String> exclude, KnowledgeUnit unit, ChunkContext chunkContext, String chunkContextModel, String select) Thirteen-argument form: refresh off, so a FILE source loads once.- Since:
- 0.18.7
-
KnowledgeSourceConfig
public KnowledgeSourceConfig(String name, Knowledge.Type type, DocumentFormat format, String path, String connection, String query, boolean enabled, List<String> include, List<String> exclude, KnowledgeUnit unit, ChunkContext chunkContext, String chunkContextModel) Twelve-argument form: noselect, so whole documents load.- Since:
- 0.18.0
-
KnowledgeSourceConfig
public KnowledgeSourceConfig(String name, Knowledge.Type type, DocumentFormat format, String path, String connection, String query, boolean enabled) Seven-argument form: empty include/exclude selectors. -
KnowledgeSourceConfig
public KnowledgeSourceConfig(String name, Knowledge.Type type, DocumentFormat format, String path, String connection, String query, boolean enabled, List<String> include, List<String> exclude) Nine-argument form:KnowledgeUnit.AUTOandChunkContext.NONE. -
KnowledgeSourceConfig
public KnowledgeSourceConfig(String name, Knowledge.Type type, DocumentFormat format, String path, String connection, String query, boolean enabled, List<String> include, List<String> exclude, KnowledgeUnit unit) Ten-argument form:ChunkContext.NONE.- Since:
- 0.15.0
-
KnowledgeSourceConfig
public KnowledgeSourceConfig(String name, Knowledge.Type type, DocumentFormat format, String path, String connection, String query, boolean enabled, List<String> include, List<String> exclude, ChunkContext chunkContext, String chunkContextModel) Eleven-argument form:KnowledgeUnit.AUTO.- Since:
- 0.15.0
-
KnowledgeSourceConfig
public KnowledgeSourceConfig(String name, Knowledge.Type type, String path, String connection, String query, boolean enabled) Creates a source using the canonicalDocumentFormat.AUTOdefault and empty selectors.
-
-
Method Details
-
from
Converts aKnowledgedeclaration's source members to the canonical runtime model.How the source is used (
use,maxTokens,search) is not part of this record;KnowledgeEntrycarries it.- Parameters:
knowledge- the declaration- Returns:
- the source configuration
- Since:
- 0.13.0
-
builder
-
withPath
Returns a copy of this declaration with only the location replaced.Everything a
@Knowledgedeclaration can say — name, type, format, selectors, unit, chunk context — stays declarative and is carried over unchanged. Onlypathis supplied here, for the one thing an annotation cannot express: a location that does not exist until run time, such as a per-run transcript directory.The replacement must be non-blank. A blank override would silently reproduce the "declared but unlocated" state this method exists to leave behind.
- Parameters:
resolvedPath- the location, known now, that the declaration could not name at compile time- Returns:
- a new configuration equal to this one except for
path - Since:
- 0.16.0
-
withSelection
Copies this configuration with optional type, path and unit selections. Null keeps the current field; an explicit AUTO unit selects AUTO. A non-null path must be non-blank. Every other field is preserved and the canonical constructor validates the resulting combination.- Parameters:
type- selected type, or null to keep the current typepath- selected path, or null to keep the current pathunit- selected unit, or null to keep the current unit- Returns:
- an immutable configuration with the selected fields
-
file
-
memory
AMEMORYsource: chat knowledge the application supplies at runtime through aChatKnowledgeBinding. It names the binding's source and nothing else; initialization loads nothing for it.- Parameters:
name- the source name the runtime binding carries- Returns:
- an enabled MEMORY source
- Since:
- 0.18.0
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
format
Returns the value of theformatrecord component.- Returns:
- the value of the
formatrecord component
-
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-
connection
Returns the value of theconnectionrecord component.- Returns:
- the value of the
connectionrecord component
-
query
Returns the value of thequeryrecord component.- Returns:
- the value of the
queryrecord component
-
enabled
public boolean enabled()Returns the value of theenabledrecord component.- Returns:
- the value of the
enabledrecord component
-
include
Returns the value of theincluderecord component.- Returns:
- the value of the
includerecord component
-
exclude
Returns the value of theexcluderecord component.- Returns:
- the value of the
excluderecord component
-
unit
Returns the value of theunitrecord component.- Returns:
- the value of the
unitrecord component
-
chunkContext
Returns the value of thechunkContextrecord component.- Returns:
- the value of the
chunkContextrecord component
-
chunkContextModel
Returns the value of thechunkContextModelrecord component.- Returns:
- the value of the
chunkContextModelrecord component
-
select
Returns the value of theselectrecord component.- Returns:
- the value of the
selectrecord component
-
refresh
Returns the value of therefreshrecord component.- Returns:
- the value of the
refreshrecord component
-