java.lang.Object
org.nasdanika.cli.CommandBase
org.nasdanika.cli.TelemetryCommand
org.nasdanika.ai.cli.HnswIndexCommandBase
Base command for creating vector index files by generating embeddings.
-
Field Summary
Fields inherited from class org.nasdanika.cli.TelemetryCommand
openTelemetryFields inherited from class org.nasdanika.cli.CommandBase
capabilityLoader, spec -
Constructor Summary
ConstructorsConstructorDescriptionHnswIndexCommandBase(io.opentelemetry.api.OpenTelemetry openTelemetry, CapabilityLoader capabilityLoader) -
Method Summary
Modifier and TypeMethodDescriptionexecute(io.opentelemetry.api.trace.Span commandSpan) getItems(io.opentelemetry.api.trace.Span commandSpan, ProgressMonitor progressMonitor) AFluxof items which are mapped toSimilaritySearch.EmbeddingsItemand then stored to the index.static com.github.jelmerk.hnswlib.core.hnsw.HnswIndex<SimilaritySearch.IndexId, float[], SimilaritySearch.EmbeddingsItem, Float> static com.github.jelmerk.hnswlib.core.hnsw.HnswIndex<SimilaritySearch.IndexId, float[], SimilaritySearch.EmbeddingsItem, Float> loadIndex(InputStream in) protected voidonGenerateEmbeddings(String key, String value, List<List<Float>> vectors, List<SimilaritySearch.EmbeddingsItem> embeddingsItems) Listener method for the generation process.Methods inherited from class org.nasdanika.cli.TelemetryCommand
buildSpan, call, getCommandPath, getInstrumentationScopeName, getInstrumentationScopeVersion, getSpanName, getTracerMethods inherited from class org.nasdanika.cli.CommandBase
close, getCapabilityLoader
-
Constructor Details
-
HnswIndexCommandBase
public HnswIndexCommandBase(io.opentelemetry.api.OpenTelemetry openTelemetry, CapabilityLoader capabilityLoader)
-
-
Method Details
-
execute
- Specified by:
executein classTelemetryCommand- Throws:
Exception
-
onGenerateEmbeddings
protected void onGenerateEmbeddings(String key, String value, List<List<Float>> vectors, List<SimilaritySearch.EmbeddingsItem> embeddingsItems) Listener method for the generation process. You may override this method for progress reporting.- Parameters:
key-value-embeddingsItems-
-
getItems
protected abstract reactor.core.publisher.Flux<Map.Entry<String,String>> getItems(io.opentelemetry.api.trace.Span commandSpan, ProgressMonitor progressMonitor) AFluxof items which are mapped toSimilaritySearch.EmbeddingsItemand then stored to the index.- Parameters:
commandSpan-- Returns:
-
loadIndex
public static com.github.jelmerk.hnswlib.core.hnsw.HnswIndex<SimilaritySearch.IndexId,float[], loadIndexSimilaritySearch.EmbeddingsItem, Float> (File file) throws IOException - Throws:
IOException
-
loadIndex
public static com.github.jelmerk.hnswlib.core.hnsw.HnswIndex<SimilaritySearch.IndexId,float[], loadIndexSimilaritySearch.EmbeddingsItem, Float> (InputStream in) throws IOException - Throws:
IOException
-