Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .castiron.stats.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
schema_version: 1
generation_id: 5ab7c0df-1b0e-4726-b330-66fc16a4d92e
openapi_spec_hash: 92700e1a33a4f6174a01b46648c8186a
openapi_transformed_spec_hash: e37bbe0f04caa6093f1cb5d65d23ad03
config_hash: beab4f058e80bab30085bb6c8467b65f
codegen_sha: ee84ff7196fb28135d30ebe7a1c9fb86097a0c6e
codegen_hash: 5d7050df9f0d5edfe18c060ff9755376b15be0ed7dabc1d09ddb0062dcdf8143
public_codegen_sha: e0ac50e69382b43efbc0e605a37b56d10dd65e83
generation_id: 8def2c80-1858-4c9d-9b9b-dc3c6676fea6
openapi_spec_hash: b2c62b342b04685226037c980f2b5a7a
openapi_transformed_spec_hash: ba44bf31326f01a1d886b7510dd9da8a
config_hash: 1e11a5becf7bc1c2e9e07b8654872dc4
codegen_sha: 5f2f7e6d049ccc5916ffd6fea8e0794ae3c0cbd9
codegen_hash: 663402af14642770c879417eb667124b7f3d9737fd077e484448afc7a3962e78
public_codegen_sha: 285ffa3e3e167b59861e8c5d88e9030b1ca6c9d4
56 changes: 51 additions & 5 deletions api_reference/openapi.transformed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9552,7 +9552,8 @@ paths:
"line_item": null,
"project_id": null,
"api_key_id": null,
"quantity": null
"quantity": null,
"quantity_unit": null
}
]
}
Expand Down Expand Up @@ -31011,6 +31012,21 @@ components:
- type: number
description: When `group_by=line_item`, this field provides the quantity of the grouped costs result.
- type: 'null'
quantity_unit:
description: The unit of the `quantity` value. If no single supported unit applies to the result, this field is `null`.
anyOf:
- type: string
- type: string
enum:
- tokens
- 1000_tokens
- duration_seconds
- duration_minutes
- duration_hours
- gibibyte_hours
- images
- characters
- type: 'null'
required:
- object
x-oaiMeta:
Expand All @@ -31022,9 +31038,10 @@ components:
"value": 0.06,
"currency": "usd"
},
"line_item": "Image models",
"line_item": "input_tokens",
"project_id": "proj_abc",
"quantity": 10000
"quantity": 10000,
"quantity_unit": "tokens"
}
CreateAssistantRequest:
type: object
Expand Down Expand Up @@ -42278,6 +42295,9 @@ components:
- type: string
- type: 'null'
description: The external key associated with the project.
residency:
$ref: '#/components/schemas/PublicProjectResidency'
description: The residency configuration for the project.
required:
- id
- object
Expand Down Expand Up @@ -42473,7 +42493,15 @@ components:
anyOf:
- type: string
- type: 'null'
description: Create the project with the specified data residency region. Your organization must have access to Data residency functionality in order to use. See [data residency controls](https://platform.openai.com/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field.
deprecated: true
description: |-
Create the project with the specified data residency region. Your organization must have access to Data residency functionality in order to use. See [data residency controls](https://platform.openai.com/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field.
Deprecated: use `residency` instead. Do not provide both `geography` and `residency`.
residency:
anyOf:
- $ref: '#/components/schemas/PublicProjectResidency'
- type: 'null'
description: Create the project with the specified residency configuration. Your organization must have access to the requested residency configuration in order to use it. See [data residency controls](https://platform.openai.com/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field.
external_key_id:
anyOf:
- type: string
Expand Down Expand Up @@ -43170,7 +43198,10 @@ components:
anyOf:
- type: string
- type: 'null'
description: Geography for the project.
deprecated: true
description: |-
Geography for the project.
Deprecated: use `residency` when creating a project to configure data residency. This field is retained for backward compatibility.
ProjectUser:
type: object
description: Represents an individual user in a project.
Expand Down Expand Up @@ -64729,6 +64760,21 @@ components:
- input_tokens_details
title: Image generation usage
description: For `gpt-image-1` only, the token usage information for the image generation.
PublicProjectResidency:
type: string
enum:
- GLOBAL
- US_STORAGE_PROCESSING
- EU_STORAGE_PROCESSING
- JP_STORAGE
- KR_STORAGE
- CA_STORAGE
- SG_STORAGE
- IN_STORAGE
- AU_STORAGE
- GB_STORAGE
- AE_STORAGE
- AE_STORAGE_PROCESSING
SpecificProgrammaticToolCallingParam:
properties:
type:
Expand Down
2 changes: 2 additions & 0 deletions lib/openai.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@
require_relative "openai/models/admin/organization/certificate_list_response"
require_relative "openai/models/admin/organization/certificate_retrieve_params"
require_relative "openai/models/admin/organization/certificate_update_params"
require_relative "openai/models/admin/organization/cost_quantity_unit"
require_relative "openai/models/admin/organization/data_retention_retrieve_params"
require_relative "openai/models/admin/organization/data_retention_update_params"
require_relative "openai/models/admin/organization/group"
Expand Down Expand Up @@ -276,6 +277,7 @@
require_relative "openai/models/admin/organization/project_archive_params"
require_relative "openai/models/admin/organization/project_create_params"
require_relative "openai/models/admin/organization/project_list_params"
require_relative "openai/models/admin/organization/project_residency"
require_relative "openai/models/admin/organization/project_retrieve_params"
require_relative "openai/models/admin/organization/projects/api_key_delete_params"
require_relative "openai/models/admin/organization/projects/api_key_delete_response"
Expand Down
53 changes: 53 additions & 0 deletions lib/openai/models/admin/organization/cost_quantity_unit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# frozen_string_literal: true

module OpenAI
module Models
module Admin
module Organization
# The unit of the `quantity` value. If no single supported unit applies to the
# result, this field is `null`.
module CostQuantityUnit
extend OpenAI::Internal::Type::Union

variant String

variant const: -> { OpenAI::Models::Admin::Organization::CostQuantityUnit::TOKENS }

variant const: -> { OpenAI::Models::Admin::Organization::CostQuantityUnit::COST_QUANTITY_UNIT_1000_TOKENS }

variant const: -> { OpenAI::Models::Admin::Organization::CostQuantityUnit::DURATION_SECONDS }

variant const: -> { OpenAI::Models::Admin::Organization::CostQuantityUnit::DURATION_MINUTES }

variant const: -> { OpenAI::Models::Admin::Organization::CostQuantityUnit::DURATION_HOURS }

variant const: -> { OpenAI::Models::Admin::Organization::CostQuantityUnit::GIBIBYTE_HOURS }

variant const: -> { OpenAI::Models::Admin::Organization::CostQuantityUnit::IMAGES }

variant const: -> { OpenAI::Models::Admin::Organization::CostQuantityUnit::CHARACTERS }

# @!method self.variants
# @return [Array(String, Symbol)]

define_sorbet_constant!(:Variants) do
T.type_alias { T.any(String, OpenAI::Admin::Organization::CostQuantityUnit::TaggedSymbol) }
end

# @!group

TOKENS = :tokens
COST_QUANTITY_UNIT_1000_TOKENS = :"1000_tokens"
DURATION_SECONDS = :duration_seconds
DURATION_MINUTES = :duration_minutes
DURATION_HOURS = :duration_hours
GIBIBYTE_HOURS = :gibibyte_hours
IMAGES = :images
CHARACTERS = :characters

# @!endgroup
end
end
end
end
end
10 changes: 9 additions & 1 deletion lib/openai/models/admin/organization/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,19 @@ class Project < OpenAI::Internal::Type::BaseModel
# @return [String, nil]
optional :name, String, nil?: true

# @!attribute residency
# The residency configuration for the project.
#
# @return [Symbol, OpenAI::Models::Admin::Organization::ProjectResidency, nil]
optional :residency, enum: -> { OpenAI::Admin::Organization::ProjectResidency }

# @!attribute status
# `active` or `archived`
#
# @return [String, nil]
optional :status, String, nil?: true

# @!method initialize(id:, created_at:, archived_at: nil, external_key_id: nil, name: nil, status: nil, object: :"organization.project")
# @!method initialize(id:, created_at:, archived_at: nil, external_key_id: nil, name: nil, residency: nil, status: nil, object: :"organization.project")
# Represents an individual project.
#
# @param id [String] The identifier, which can be referenced in API endpoints
Expand All @@ -61,6 +67,8 @@ class Project < OpenAI::Internal::Type::BaseModel
#
# @param name [String, nil] The name of the project. This appears in reporting.
#
# @param residency [Symbol, OpenAI::Models::Admin::Organization::ProjectResidency] The residency configuration for the project.
#
# @param status [String, nil] `active` or `archived`
#
# @param object [Symbol, :"organization.project"] The object type, which is always `organization.project`
Expand Down
19 changes: 17 additions & 2 deletions lib/openai/models/admin/organization/project_create_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,28 @@ class ProjectCreateParams < OpenAI::Internal::Type::BaseModel
optional :external_key_id, String, nil?: true

# @!attribute geography
# @deprecated
#
# Create the project with the specified data residency region. Your organization
# must have access to Data residency functionality in order to use. See
# [data residency controls](https://platform.openai.com/docs/guides/your-data#data-residency-controls)
# to review the functionality and limitations of setting this field.
# to review the functionality and limitations of setting this field. Deprecated:
# use `residency` instead. Do not provide both `geography` and `residency`.
#
# @return [String, nil]
optional :geography, String, nil?: true

# @!method initialize(name:, external_key_id: nil, geography: nil, request_options: {})
# @!attribute residency
# Create the project with the specified residency configuration. Your organization
# must have access to the requested residency configuration in order to use it.
# See
# [data residency controls](https://platform.openai.com/docs/guides/your-data#data-residency-controls)
# to review the functionality and limitations of setting this field.
#
# @return [Symbol, OpenAI::Models::Admin::Organization::ProjectResidency, nil]
optional :residency, enum: -> { OpenAI::Admin::Organization::ProjectResidency }, nil?: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Make geography and residency mutually exclusive in the authoritative schema/generated parameter contract. This new optional residency field remains independent of existing geography, even though the adjacent public documentation explicitly says not to provide both; projects.create(name:, geography:, residency:) therefore serializes an unsupported request that the real endpoint rejects. Encode the exclusion upstream, regenerate this model, and add separate geography-only/residency-only cases plus rejection coverage for the combined input.


# @!method initialize(name:, external_key_id: nil, geography: nil, residency: nil, request_options: {})
# Some parameter documentations has been truncated, see
# {OpenAI::Models::Admin::Organization::ProjectCreateParams} for more details.
#
Expand All @@ -40,6 +53,8 @@ class ProjectCreateParams < OpenAI::Internal::Type::BaseModel
#
# @param geography [String, nil] Create the project with the specified data residency region. Your organization m
#
# @param residency [Symbol, OpenAI::Models::Admin::Organization::ProjectResidency, nil] Create the project with the specified residency configuration. Your organization
#
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
end
end
Expand Down
29 changes: 29 additions & 0 deletions lib/openai/models/admin/organization/project_residency.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

module OpenAI
module Models
module Admin
module Organization
module ProjectResidency
extend OpenAI::Internal::Type::Enum

GLOBAL = :GLOBAL
US_STORAGE_PROCESSING = :US_STORAGE_PROCESSING
EU_STORAGE_PROCESSING = :EU_STORAGE_PROCESSING
JP_STORAGE = :JP_STORAGE
KR_STORAGE = :KR_STORAGE
CA_STORAGE = :CA_STORAGE
SG_STORAGE = :SG_STORAGE
IN_STORAGE = :IN_STORAGE
AU_STORAGE = :AU_STORAGE
GB_STORAGE = :GB_STORAGE
AE_STORAGE = :AE_STORAGE
AE_STORAGE_PROCESSING = :AE_STORAGE_PROCESSING

# @!method self.values
# @return [Array<Symbol>]
end
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ class ProjectUpdateParams < OpenAI::Internal::Type::BaseModel
optional :external_key_id, String, nil?: true

# @!attribute geography
# Geography for the project.
# @deprecated
#
# Geography for the project. Deprecated: use `residency` when creating a project
# to configure data residency. This field is retained for backward compatibility.
#
# @return [String, nil]
optional :geography, String, nil?: true
Expand All @@ -33,6 +36,9 @@ class ProjectUpdateParams < OpenAI::Internal::Type::BaseModel
optional :name, String, nil?: true

# @!method initialize(project_id:, external_key_id: nil, geography: nil, name: nil, request_options: {})
# Some parameter documentations has been truncated, see
# {OpenAI::Models::Admin::Organization::ProjectUpdateParams} for more details.
#
# @param project_id [String]
#
# @param external_key_id [String, nil] External key ID to associate with the project.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,20 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel
# @return [Float, nil]
optional :quantity, Float, nil?: true

# @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, quantity: nil, object: :"organization.costs.result")
# @!attribute quantity_unit
# The unit of the `quantity` value. If no single supported unit applies to the
# result, this field is `null`.
#
# @return [String, Symbol, OpenAI::Models::Admin::Organization::CostQuantityUnit, nil]
optional(
:quantity_unit,
union: -> {
OpenAI::Admin::Organization::CostQuantityUnit
},
nil?: true
)

# @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, quantity: nil, quantity_unit: nil, object: :"organization.costs.result")
# Some parameter documentations has been truncated, see
# {OpenAI::Models::Admin::Organization::UsageAudioSpeechesResponse::Data::Result::OrganizationCostsResult}
# for more details.
Expand All @@ -986,6 +999,8 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel
#
# @param quantity [Float, nil] When `group_by=line_item`, this field provides the quantity of the grouped costs
#
# @param quantity_unit [String, Symbol, OpenAI::Models::Admin::Organization::CostQuantityUnit, nil] The unit of the `quantity` value. If no single supported unit applies to the res
#
# @param object [Symbol, :"organization.costs.result"]

# @see OpenAI::Models::Admin::Organization::UsageAudioSpeechesResponse::Data::Result::OrganizationCostsResult#amount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,20 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel
# @return [Float, nil]
optional :quantity, Float, nil?: true

# @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, quantity: nil, object: :"organization.costs.result")
# @!attribute quantity_unit
# The unit of the `quantity` value. If no single supported unit applies to the
# result, this field is `null`.
#
# @return [String, Symbol, OpenAI::Models::Admin::Organization::CostQuantityUnit, nil]
optional(
:quantity_unit,
union: -> {
OpenAI::Admin::Organization::CostQuantityUnit
},
nil?: true
)

# @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, quantity: nil, quantity_unit: nil, object: :"organization.costs.result")
# Some parameter documentations has been truncated, see
# {OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationCostsResult}
# for more details.
Expand All @@ -988,6 +1001,8 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel
#
# @param quantity [Float, nil] When `group_by=line_item`, this field provides the quantity of the grouped costs
#
# @param quantity_unit [String, Symbol, OpenAI::Models::Admin::Organization::CostQuantityUnit, nil] The unit of the `quantity` value. If no single supported unit applies to the res
#
# @param object [Symbol, :"organization.costs.result"]

# @see OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationCostsResult#amount
Expand Down
Loading