Class Picker

java.lang.Object
org.machanism.machai.bindex.core.Picker

public class Picker extends Object
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 Details

    • BINDEX_SCHEMA_RESOURCE

      public static final String BINDEX_SCHEMA_RESOURCE
      Classpath resource path for the Bindex JSON schema.
      See Also:
  • Constructor Details

    • Picker

      public Picker(BindexRepository bindexRepository, Configurator configurator)
      Creates a Picker backed by the configured Bindex repository and a named GenAI provider.
      Parameters:
      bindexRepository - the repository used to save and retrieve Bindex data
      configurator - the project configuration used for repository and prompt settings
  • Method Details

    • save

      public String save(org.machanism.machai.schema.Bindex bindex)
      Saves a Bindex entry to the repository, generating and storing its embedding vector.
      Parameters:
      bindex - the Bindex object 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 of Bindex entries 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 requirements
      vectorSearchLimits - the maximum number of results to return from vector search
      score - the minimum relevance score threshold for recommended entries
      configurator - the configuration object
      Returns:
      a list of recommended Bindex entries matching the criteria
      Throws:
      IOException - if there is an error during classification or repository access