diff --git a/src/main/java/de/extio/lmlib/agent/BaseAgent.java b/src/main/java/de/extio/lmlib/agent/BaseAgent.java index 89c198f..a17a327 100644 --- a/src/main/java/de/extio/lmlib/agent/BaseAgent.java +++ b/src/main/java/de/extio/lmlib/agent/BaseAgent.java @@ -37,6 +37,8 @@ public interface BaseAgent { static final Logger LOGGER = LoggerFactory.getLogger(BaseAgent.class); static final ObjectMapper objectMapper = new ObjectMapper(); + + int MAX_TOOL_CALL_ROUNDS = 6; default String name() { throw new UnsupportedOperationException("Name must be implemented in the agent"); @@ -222,7 +224,7 @@ public interface BaseAgent { } if (!completion.toolCalls().isEmpty() && responseHandler instanceof final ToolCallingAgentResponseHandler toolCallingAgentResponseHandler) { - if (toolCallRounds >= 6) { + if (toolCallRounds >= MAX_TOOL_CALL_ROUNDS) { parseException = new IllegalStateException("Too many tool call rounds"); break; } diff --git a/src/main/java/de/extio/lmlib/client/oai/responses/OpenAiResponsesApiDialect.java b/src/main/java/de/extio/lmlib/client/oai/responses/OpenAiResponsesApiDialect.java index cdd037d..701565e 100644 --- a/src/main/java/de/extio/lmlib/client/oai/responses/OpenAiResponsesApiDialect.java +++ b/src/main/java/de/extio/lmlib/client/oai/responses/OpenAiResponsesApiDialect.java @@ -64,6 +64,21 @@ public interface OpenAiResponsesApiDialect { return List.of(); } + /** + * Controls whether encrypted reasoning payloads should be requested for + * stateless replay. + *

+ * lm-lib defaults this to {@code true} so existing Responses tool-call loops keep + * working without additional configuration. + * + * @param modelProfile the resolved model profile for the request + * @return {@code true} to include encrypted reasoning content when replay is + * stateless, otherwise {@code false} + */ + default boolean includeEncryptedReasoningContent(final ModelProfile modelProfile) { + return true; + } + /** * Caps the number of built-in tool calls the Responses API may execute during a * single request. diff --git a/src/main/java/de/extio/lmlib/client/oai/responses/ResponsesApiClient.java b/src/main/java/de/extio/lmlib/client/oai/responses/ResponsesApiClient.java index f49507b..df8fb09 100644 --- a/src/main/java/de/extio/lmlib/client/oai/responses/ResponsesApiClient.java +++ b/src/main/java/de/extio/lmlib/client/oai/responses/ResponsesApiClient.java @@ -879,7 +879,7 @@ public class ResponsesApiClient implements Client{ private List createIncludeList(final ModelProfile modelProfile, final boolean store) { final var include = new LinkedHashSet<>(this.responsesDialect().include(modelProfile)); - if (!store) { + if (!store && this.responsesDialect().includeEncryptedReasoningContent(modelProfile)) { include.add(OpenAiResponsesApiDialect.INCLUDE_REASONING_ENCRYPTED_CONTENT); } return List.copyOf(include);