Class JevToolSelectionMiddleware

java.lang.Object
io.agentscope.extensions.judge.jev.example.JevToolSelectionMiddleware
All Implemented Interfaces:
io.agentscope.core.middleware.MiddlewareBase

public final class JevToolSelectionMiddleware extends Object implements io.agentscope.core.middleware.MiddlewareBase
Reduces the tool schema list sent to the primary model.

Always-included tools are preserved. Optional tools are ranked by Jev and only those with a probability above the synthetic "none" option are kept, up to maxTools.

The filter runs in onReasoning(io.agentscope.core.agent.Agent, io.agentscope.core.agent.RuntimeContext, io.agentscope.core.middleware.ReasoningInput, java.util.function.Function<io.agentscope.core.middleware.ReasoningInput, reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>>) on every reasoning step, so it re-selects tools as the conversation grows. Tool sets larger than the Jev choice limit are chunked, each chunk's winner is shortlisted, and the shortlist is reranked in a second request. When Jev fails and failOpen is set (the default), the original tool list is kept.

  • Field Details

    • DEFAULT_ALWAYS_INCLUDE_TOOLS

      public static final Set<String> DEFAULT_ALWAYS_INCLUDE_TOOLS
  • Method Details