Agent: skipNextCompletion; Better cache keys; XL category; Fix ModelProfileService concurrency;
This commit is contained in:
@@ -43,12 +43,17 @@ public record Agent(String name, AgentType agentType, ModelCategory modelCategor
|
||||
for (final var split : splits) {
|
||||
tasks.add(CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
if (this.agentType() != AgentType.PROCESSING_ONLY) {
|
||||
boolean skipCompletion = split.context().isSkipNextCompletion() || this.agentType() == AgentType.PROCESSING_ONLY;
|
||||
if (skipCompletion) {
|
||||
split.context().setSkipNextCompletion(false);
|
||||
split.context().getGraph().add("○");
|
||||
}
|
||||
else {
|
||||
split.context().getGraph().add(this.modelCategory.getShortName());
|
||||
}
|
||||
split.context().getGraph().add(this.name());
|
||||
|
||||
if (this.agentType != AgentType.PROCESSING_ONLY) {
|
||||
if (!skipCompletion) {
|
||||
final var conversation = this.setupConversation(split);
|
||||
LOGGER.debug("Conversation: {}", conversation);
|
||||
|
||||
@@ -270,7 +275,7 @@ public record Agent(String name, AgentType agentType, ModelCategory modelCategor
|
||||
}
|
||||
|
||||
case final Agent a when a.agentType() == AgentType.PROCESSING_ONLY -> {
|
||||
context.getGraph().add("○");
|
||||
|
||||
}
|
||||
|
||||
default -> {
|
||||
|
||||
@@ -30,6 +30,8 @@ public final class AgentContext {
|
||||
|
||||
private volatile boolean error;
|
||||
|
||||
private volatile boolean skipNextCompletion;
|
||||
|
||||
public AgentContext(final Map<String, Agent> agents) {
|
||||
this.agents = agents;
|
||||
this.context = new ConcurrentHashMap<>();
|
||||
@@ -48,6 +50,7 @@ public final class AgentContext {
|
||||
this.requestStatistic = other.requestStatistic;
|
||||
this.lastCompletion = other.lastCompletion;
|
||||
this.error = other.error;
|
||||
this.skipNextCompletion = other.skipNextCompletion;
|
||||
synchronized (other.graph) {
|
||||
this.graph.addAll(other.graph);
|
||||
}
|
||||
@@ -125,4 +128,12 @@ public final class AgentContext {
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
public boolean isSkipNextCompletion() {
|
||||
return this.skipNextCompletion;
|
||||
}
|
||||
|
||||
public void setSkipNextCompletion(final boolean skipNextCompletion) {
|
||||
this.skipNextCompletion = skipNextCompletion;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class AgentExecutorService implements InitializingBean, DisposableBean {
|
||||
}
|
||||
|
||||
public List<AgentContext> walkGraph(final Agent agent, final AgentContext context) {
|
||||
LOGGER.info("Agent: {}", agent.name());
|
||||
LOGGER.debug("Agent: {}", agent.name());
|
||||
|
||||
Client client = null;
|
||||
if (agent.agentType() != AgentType.PROCESSING_ONLY) {
|
||||
|
||||
Reference in New Issue
Block a user