feat: Implement skipCache functionality across conversation handling

This commit is contained in:
extio-de
2026-03-14 14:27:39 +01:00
parent c305740e10
commit 1e5adefd13
13 changed files with 131 additions and 106 deletions

View File

@@ -25,6 +25,8 @@ public final class AgentContext {
private volatile boolean error;
private volatile boolean skipNextCompletion;
private volatile boolean skipCache;
private volatile Conversation conversation;
@@ -74,6 +76,7 @@ public final class AgentContext {
this.agentContextUpdateConsumer = other.agentContextUpdateConsumer;
this.error = other.error;
this.skipNextCompletion = other.skipNextCompletion;
this.skipCache = other.skipCache;
this.streaming = other.streaming;
synchronized (other.graph) {
this.graph.addAll(other.graph);
@@ -201,6 +204,14 @@ public final class AgentContext {
public void setSkipNextCompletion(final boolean skipNextCompletion) {
this.skipNextCompletion = skipNextCompletion;
}
public boolean isSkipCache() {
return this.skipCache;
}
public void setSkipCache(final boolean skipCache) {
this.skipCache = skipCache;
}
Consumer<AgentContext> getAgentContextUpdateConsumer() {
return agentContextUpdateConsumer;

View File

@@ -103,6 +103,8 @@ public interface BaseAgent {
split.context().getGraph().add(this.name());
if (!skipCompletion) {
final boolean skipCache = split.context().isSkipCache();
split.context().setSkipCache(false);
final var conversation = this.setupConversation(split);
boolean parseable = false;
@@ -126,21 +128,21 @@ public interface BaseAgent {
};
if (modelProfile != null) {
requestStart = System.currentTimeMillis();
completion = client.streamConversation(modelProfile, conversation, chunkConsumer);
completion = client.streamConversation(modelProfile, conversation, chunkConsumer, skipCache);
}
else {
requestStart = System.currentTimeMillis();
completion = client.streamConversation(this.modelCategory(split.context()), conversation, chunkConsumer);
completion = client.streamConversation(this.modelCategory(split.context()), conversation, chunkConsumer, skipCache);
}
}
else {
if (modelProfile != null) {
requestStart = System.currentTimeMillis();
completion = client.conversation(modelProfile, conversation);
completion = client.conversation(modelProfile, conversation, skipCache);
}
else {
requestStart = System.currentTimeMillis();
completion = client.conversation(this.modelCategory(split.context()), conversation);
completion = client.conversation(this.modelCategory(split.context()), conversation, skipCache);
}
}
final var durationMs = System.currentTimeMillis() - requestStart;