Class AtomSolver

java.lang.Object
com.tnsai.prompt.aot.AtomSolver

public class AtomSolver extends Object
Solves atoms in parallel with dependency resolution.

AtomSolver processes atoms respecting their dependencies, executing independent atoms in parallel while ensuring dependent atoms wait for their prerequisites.

Usage


 AtomSolver solver = new AtomSolver(llmClient);

 // Solve atoms (parallel where possible)
 List<Atom> solvedAtoms = solver.solve(atoms);

 // Check results
 for (Atom atom : solvedAtoms) {
     System.out.println(atom.getDescription() + ": " + atom.getSolution());
     System.out.println("Confidence: " + atom.getConfidence());
 }
 
  • Constructor Details

    • AtomSolver

      public AtomSolver(com.tnsai.llm.LLMClient llmClient)
      Creates an AtomSolver with default settings.
    • AtomSolver

      public AtomSolver(com.tnsai.llm.LLMClient llmClient, ExecutorService executor, int timeoutSeconds, boolean includeContext)
      Creates an AtomSolver with custom settings.
      Parameters:
      llmClient - LLM client for solving
      executor - executor for parallel processing
      timeoutSeconds - timeout per atom
      includeContext - include dependency solutions as context
  • Method Details

    • solve

      public List<Atom> solve(List<Atom> atoms)
      Solves all atoms respecting dependencies.
      Parameters:
      atoms - list of atoms to solve
      Returns:
      solved atoms
    • solveSingle

      public Atom solveSingle(Atom atom)
      Solves a single atom without dependencies.
    • shutdown

      public void shutdown()
      Shuts down the executor.