class Multiwoven::Integrations::Source::Anthropic::Client

def process_streaming_response(chunk)

def process_streaming_response(chunk)
  check_chunk_error(chunk)
  chunk.each_line do |event|
    next unless event.include?("\"type\":\"content_block_delta\"")
    json_string = event.split("\n").find { |line| line.start_with?("data: ") }&.sub(/^data: /, "")
    next unless json_string
    parsed_data = JSON.parse(json_string)
    yield [RecordMessage.new(data: parsed_data, emitted_at: Time.now.to_i).to_multiwoven_message] if block_given?
  end
end