struct

Anthropic::Completions::Response

Inherits JSON::Serializable < Struct < Value < Object

Response model for the legacy completions API.

DEPRECATED: Use Anthropic::Messages::Response with the Messages API instead. This endpoint is provided for backward compatibility only.

Example

response = client.completions.create(
  model: "claude-2.1",
  prompt: "\n\nHuman: Hello\n\nAssistant:",
  max_tokens_to_sample: 100
)
puts response.completion

Constructors

new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

completion
Source
log_id
Source
model
Source
request_id

Request ID extracted from HTTP response headers (not part of JSON body). Set by Completions::API after parsing the response.

Source
request_id=(request_id : String | Nil)

Request ID extracted from HTTP response headers (not part of JSON body). Set by Completions::API after parsing the response.

Source
stop
Source
stop_reason
Source
truncated
Source