anthropicConfig method

MessageBuilder anthropicConfig(
  1. void configure(
    1. AnthropicMessageBuilder
    )
)

Configure Anthropic-specific features

Implementation

MessageBuilder anthropicConfig(
    void Function(AnthropicMessageBuilder) configure) {
  final anthropicBuilder = AnthropicMessageBuilder._(this);
  configure(anthropicBuilder);

  // Store cache flag in extensions if enabled.
  if (anthropicBuilder._cacheEnabled) {
    // Add cache control to the message.
    final cacheMarker = AnthropicTextBlock(
      text: '', // Empty text
      cacheControl: AnthropicCacheControl.ephemeral(
        ttl: anthropicBuilder._cacheTtl?.value,
      ),
    );
    addBlock(cacheMarker);
  }
  return this;
}