Module: Anthropic::Internal::Type::RequestParameters::Converter Private

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#dump_request(params) ⇒ Array(Object, Hash{Symbol=>Object})

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • params (Object)

Returns:

  • (Array(Object, Hash{Symbol=>Object}))


27
28
29
30
31
32
33
34
35
36
37
# File 'lib/anthropic/internal/type/request_parameters.rb', line 27

def dump_request(params)
  state = {can_retry: true}
  case (dumped = dump(params, state: state))
  in Hash
    options = Anthropic::Internal::Util.coerce_hash!(dumped[:request_options]).to_h
    request_options = state.fetch(:can_retry) ? options : {**options, max_retries: 0}
    [dumped.except(:request_options), request_options]
  else
    [dumped, nil]
  end
end