Module: OpenAI::Internal::Type::BasePage Private

Included in:
ConversationCursorPage, CursorPage, NextCursorPage, Page
Defined in:
lib/openai/internal/type/base_page.rb,
sig/openai/internal/type/base_page.rbs

Overview

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.

This module provides a base implementation for paginated responses in the SDK.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#last_responseOpenAI::ResponseMetadata (readonly)

Metadata from the HTTP response that produced this page.



28
29
30
# File 'lib/openai/internal/type/base_page.rb', line 28

def last_response
  @last_response
end

Instance Method Details

#_request_idString?

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.

The ID of the API request, returned via the x-request-id response header. This is only populated on top-level response objects returned by the client.

Returns:

  • (String, nil)


21
# File 'lib/openai/internal/type/base_page.rb', line 21

def _request_id = last_response.request_id

#auto_paging_each(&blk) {|, arg0| ... } ⇒ void

This method returns an undefined value.

Parameters:

  • blk (Proc)

Yields:

Yield Parameters:

  • (generic<Elem>)
  • arg0 (Elem)

Yield Returns:

  • (void)


47
# File 'lib/openai/internal/type/base_page.rb', line 47

def auto_paging_each(&blk) = (raise NotImplementedError)

#initialize(client:, req:, response_metadata:, page_data:) ⇒ 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:



60
61
62
63
64
65
66
# File 'lib/openai/internal/type/base_page.rb', line 60

def initialize(client:, req:, response_metadata:, page_data:)
  @client = client
  @req = req
  @model = req.fetch(:model)
  @last_response = 
  super()
end

#next_pageself

Returns:

  • (self)

Raises:



39
# File 'lib/openai/internal/type/base_page.rb', line 39

def next_page = (raise NotImplementedError)

#next_page?Boolean

Returns:



33
# File 'lib/openai/internal/type/base_page.rb', line 33

def next_page? = (raise NotImplementedError)

#to_enumEnumerable<generic<Elem>> Also known as: enum_for

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.

Returns:

  • (Enumerable<generic<Elem>>)


50
# File 'lib/openai/internal/type/base_page.rb', line 50

def to_enum = super(:auto_paging_each)