Class: OpenAI::Resources::Admin::Organization::Projects::RateLimits

Inherits:
Object
  • Object
show all
Defined in:
lib/openai/resources/admin/organization/projects/rate_limits.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ RateLimits

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 a new instance of RateLimits.

Parameters:



94
95
96
# File 'lib/openai/resources/admin/organization/projects/rate_limits.rb', line 94

def initialize(client:)
  @client = client
end

Instance Method Details

#list_rate_limits(project_id, after: nil, before: nil, limit: nil, request_options: {}) ⇒ OpenAI::Internal::ConversationCursorPage<OpenAI::Models::Admin::Organization::Projects::ProjectRateLimit>

Some parameter documentations has been truncated, see Models::Admin::Organization::Projects::RateLimitListRateLimitsParams for more details.

Returns the rate limits per model for a project.

Parameters:

  • project_id (String)

    The ID of the project.

  • after (String)

    A cursor for use in pagination. ‘after` is an object ID that defines your place

  • before (String)

    A cursor for use in pagination. ‘before` is an object ID that defines your place

  • limit (Integer)

    A limit on the number of objects to be returned. The default is 100.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/openai/resources/admin/organization/projects/rate_limits.rb', line 30

def list_rate_limits(project_id, params = {})
  parsed, options =
    OpenAI::Admin::Organization::Projects::RateLimitListRateLimitsParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["organization/projects/%1$s/rate_limits", project_id],
    query: query,
    page: OpenAI::Internal::ConversationCursorPage,
    model: OpenAI::Admin::Organization::Projects::ProjectRateLimit,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#update_rate_limit(rate_limit_id, project_id:, batch_1_day_max_input_tokens: nil, max_audio_megabytes_per_1_minute: nil, max_images_per_1_minute: nil, max_requests_per_1_day: nil, max_requests_per_1_minute: nil, max_tokens_per_1_minute: nil, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Projects::ProjectRateLimit

Some parameter documentations has been truncated, see Models::Admin::Organization::Projects::RateLimitUpdateRateLimitParams for more details.

Updates a project rate limit.

Parameters:

  • rate_limit_id (String)

    Path param: The ID of the rate limit.

  • project_id (String)

    Path param: The ID of the project.

  • batch_1_day_max_input_tokens (Integer)

    Body param: The maximum batch input tokens per day. Only relevant for certain mo

  • max_audio_megabytes_per_1_minute (Integer)

    Body param: The maximum audio megabytes per minute. Only relevant for certain mo

  • max_images_per_1_minute (Integer)

    Body param: The maximum images per minute. Only relevant for certain models.

  • max_requests_per_1_day (Integer)

    Body param: The maximum requests per day. Only relevant for certain models.

  • max_requests_per_1_minute (Integer)

    Body param: The maximum requests per minute.

  • max_tokens_per_1_minute (Integer)

    Body param: The maximum tokens per minute.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/openai/resources/admin/organization/projects/rate_limits.rb', line 74

def update_rate_limit(rate_limit_id, params)
  parsed, options =
    OpenAI::Admin::Organization::Projects::RateLimitUpdateRateLimitParams.dump_request(params)
  project_id =
    parsed.delete(:project_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["organization/projects/%1$s/rate_limits/%2$s", project_id, rate_limit_id],
    body: parsed,
    model: OpenAI::Admin::Organization::Projects::ProjectRateLimit,
    security: {admin_api_key_auth: true},
    options: options
  )
end