Package org.machanism.machai.bindex.core
Class Picker
java.lang.Object
org.machanism.machai.bindex.core.Picker
Performs Bindex registration, lookup, and semantic retrieval using embeddings
and MongoDB.
The Picker class provides methods for:
- Recommending libraries (Bindex entries) based on a natural language prompt and score threshold
- Registering and retrieving Bindex entries
- Building and executing classification prompts using a GenAI provider
- Recursively resolving dependencies for a Bindex entry
- Normalizing language names for repository matching
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringClasspath resource path for the Bindex JSON schema. -
Constructor Summary
ConstructorsConstructorDescriptionPicker(BindexRepository bindexRepository, Configurator configurator) Creates a Picker backed by the configured Bindex repository and a named GenAI provider. -
Method Summary
Modifier and TypeMethodDescriptionpick(String prompt, long vectorSearchLimits, Double score, Configurator configurator) Recommends a list ofBindexentries based on the provided prompt and minimum score.save(org.machanism.machai.schema.Bindex bindex) Saves aBindexentry to the repository, generating and storing its embedding vector.
-
Field Details
-
BINDEX_SCHEMA_RESOURCE
Classpath resource path for the Bindex JSON schema.- See Also:
-
-
Constructor Details
-
Picker
Creates a Picker backed by the configured Bindex repository and a named GenAI provider.- Parameters:
bindexRepository- the repository used to save and retrieve Bindex dataconfigurator- the project configuration used for repository and prompt settings
-
-
Method Details
-
save
Saves aBindexentry to the repository, generating and storing its embedding vector.- Parameters:
bindex- theBindexobject to save- Returns:
- the unique identifier assigned to the saved Bindex entry
- Throws:
IllegalArgumentException- if the embedding cannot be generated
-
pick
public Collection<BindexInfo> pick(String prompt, long vectorSearchLimits, Double score, Configurator configurator) throws IOException Recommends a list ofBindexentries based on the provided prompt and minimum score.This method uses a GenAI provider to classify the prompt, generates an embedding, and queries the Bindex repository for matching entries.
- Parameters:
prompt- the natural language description of project requirementsvectorSearchLimits- the maximum number of results to return from vector searchscore- the minimum relevance score threshold for recommended entriesconfigurator- the configuration object- Returns:
- a list of recommended
Bindexentries matching the criteria - Throws:
IOException- if there is an error during classification or repository access
-