@jorander, @Azarux, @johnsonr
Was looking for a PR (if you find one, please let me know) that added logic to Anthropic Options Converter:
override fun convertOptions(options: LlmOptions): AnthropicChatOptions {
val builder = AnthropicChatOptions.builder()
.temperature(options.temperature)
.topP(options.topP)
.maxTokens(options.maxTokens ?: DEFAULT_MAX_TOKENS)
.thinking(
if (options.thinking?.enabled == true) AnthropicApi.ChatCompletionRequest.ThinkingConfig(
AnthropicApi.ThinkingType.ENABLED,
options.thinking!!.tokenBudget,
) else AnthropicApi.ChatCompletionRequest.ThinkingConfig(
AnthropicApi.ThinkingType.DISABLED,
null,
)
)
Here is the problem statement: usability of the streaming API:
LlmOptions thinkingOptions = new LlmOptions().withThinking(Thinking.withTokenBudget(8000));
PromptRunner runner = ai.withDefaultLlm().withLlm(thinkingOptions);
assertTrue(runner.supportsStreaming(), "Default LLM must support streaming");
Flux<StreamingEvent<ParkingRecommendation>> stream = new StreamingPromptRunnerBuilder(runner)
.streaming()
.withPrompt(PARKING_PROMPT)
.createObjectStreamWithThinking(ParkingRecommendation.class);
As can be seen,
createObjectStreamWithThinking
requires Thinking.withTokenBudget(8000)); as pre-req.
Seems unnatural to me.
Since the converter was moved to another module via just a copy, git history was lost, and I was not able to track PRs.
@jorander, @azanux - appreciate it if you might remember this change.
Options:
- warning on the API if LLMOption does not activate Thinking
- auto-activate in API using a reasonable default if not set
Note: unlike two separate modes, creating() and thinking(), streaming() includes both. One API returns a collection of object streams, while stream+think returns a collection of streaming events.
Thank you.
@jorander, @Azarux, @johnsonr
Was looking for a PR (if you find one, please let me know) that added logic to Anthropic Options Converter:
override fun convertOptions(options: LlmOptions): AnthropicChatOptions {
val builder = AnthropicChatOptions.builder()
.temperature(options.temperature)
.topP(options.topP)
.maxTokens(options.maxTokens ?: DEFAULT_MAX_TOKENS)
.thinking(
if (options.thinking?.enabled == true) AnthropicApi.ChatCompletionRequest.ThinkingConfig(
AnthropicApi.ThinkingType.ENABLED,
options.thinking!!.tokenBudget,
) else AnthropicApi.ChatCompletionRequest.ThinkingConfig(
AnthropicApi.ThinkingType.DISABLED,
null,
)
)
Here is the problem statement: usability of the streaming API:
LlmOptions thinkingOptions = new LlmOptions().withThinking(Thinking.withTokenBudget(8000));
PromptRunner runner = ai.withDefaultLlm().withLlm(thinkingOptions);
assertTrue(runner.supportsStreaming(), "Default LLM must support streaming");
As can be seen,
createObjectStreamWithThinking
requires Thinking.withTokenBudget(8000)); as pre-req.
Seems unnatural to me.
Since the converter was moved to another module via just a copy, git history was lost, and I was not able to track PRs.
@jorander, @azanux - appreciate it if you might remember this change.
Options:
Note: unlike two separate modes, creating() and thinking(), streaming() includes both. One API returns a collection of object streams, while stream+think returns a collection of streaming events.
Thank you.