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
68 changes: 8 additions & 60 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,7 @@ on:
- '**'
- '!gh-readonly-queue/**'
- '!integrated/**'
- '!stl-preview-head/**'
- '!stl-preview-base/**'
- '!generated'
- '!codegen/**'
- 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'
merge_group:
types:
- checks_requested
Expand All @@ -30,8 +22,8 @@ jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: (github.event_name == 'push' || github.event_name == 'merge_group' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'merge_group' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6

Expand All @@ -48,12 +40,12 @@ jobs:
run: ./scripts/lint

build:
if: (github.event_name == 'push' || github.event_name == 'merge_group' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
if: github.event_name == 'push' || github.event_name == 'merge_group' || github.event.pull_request.head.repo.fork
timeout-minutes: 10
name: build
permissions:
contents: read
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
Expand Down Expand Up @@ -96,54 +88,10 @@ jobs:
- name: Validate HTTPX2 wheel on Python 3.14
run: python scripts/utils/validate-httpx2-wheel.py

- name: Stage tarball for Stainless upload
if: |-
github.repository == 'stainless-sdks/openai-python' &&
!startsWith(github.ref, 'refs/heads/stl/')
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: stainless-package-tarball
path: dist/
if-no-files-found: error
retention-days: 1

stainless-upload:
name: upload tarball to Stainless
needs: build
if: github.repository == 'stainless-sdks/openai-python' && !startsWith(github.ref, 'refs/heads/stl/')
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false

- name: Download tarball
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: stainless-package-tarball
path: dist/

- name: Get GitHub OIDC Token
id: github-oidc
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Upload tarball
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
run: ./scripts/utils/upload-artifact.sh

test:
timeout-minutes: 15
name: test (Python ${{ matrix.python-version }})
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'merge_group' || github.event.pull_request.head.repo.fork
strategy:
fail-fast: false
Expand Down Expand Up @@ -185,7 +133,7 @@ jobs:
test-httpx2:
timeout-minutes: 20
name: test (HTTPX2)
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'merge_group' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
Expand Down Expand Up @@ -223,8 +171,8 @@ jobs:
timeout-minutes: 10
name: examples
environment: ci
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.repository == 'openai/openai-python' && github.ref != 'refs/heads/release-please--branches--main' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
runs-on: ubuntu-latest
if: github.repository == 'openai/openai-python' && github.ref != 'refs/heads/release-please--branches--main' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork)

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
Expand Down
4 changes: 0 additions & 4 deletions .stats.yml

This file was deleted.

2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Generated SDK

Most SDK source is generated by Stainless. Follow `CONTRIBUTING.md` before
Most SDK source is generated from the OpenAI API schema. Follow `CONTRIBUTING.md` before
changing generated files. Handwritten policy, automation, tests, and examples
should remain small and should not alter exported SDK APIs unless the change
explicitly requires it.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The OpenAI Python library provides convenient access to the OpenAI REST API from
application. The library includes type definitions for all request params and response fields,
and offers both synchronous and asynchronous clients powered by [HTTPX2](https://httpx2.pydantic.dev/).

It is generated from our [OpenAPI specification](https://github.com/openai/openai-openapi) with [Stainless](https://stainlessapi.com/).
It is generated from our [OpenAPI specification](https://github.com/openai/openai-openapi).

## Documentation

Expand Down
28 changes: 6 additions & 22 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,12 @@

## Reporting Security Issues

This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken.

To report a security issue, please contact the Stainless team at security@stainless.com.
Please report potential security vulnerabilities through OpenAI's
[coordinated vulnerability disclosure process](https://openai.com/policies/coordinated-vulnerability-disclosure-policy).
For questions about that process, contact disclosure@openai.com.

## Responsible Disclosure

We appreciate the efforts of security researchers and individuals who help us maintain the security of
SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible
disclosure practices by allowing us a reasonable amount of time to investigate and address the issue
before making any information public.

## Reporting Non-SDK Related Security Issues

If you encounter security issues that are not directly related to SDKs but pertain to the services
or products provided by OpenAI, please follow the respective company's security reporting guidelines.

### OpenAI Terms and Policies

Our Security Policy can be found at [Security Policy URL](https://openai.com/policies/coordinated-vulnerability-disclosure-policy).

Please contact disclosure@openai.com for any questions or concerns regarding the security of our services.

---

Thank you for helping us keep the SDKs and systems they interact with secure.
Please allow OpenAI a reasonable amount of time to investigate and address the
issue before making information public. Thank you for helping us keep this SDK
and the systems it interacts with secure.
4 changes: 1 addition & 3 deletions examples/.keep
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
File generated from our OpenAPI spec by Stainless.

This directory can be used to store example files demonstrating usage of this SDK.
It is ignored by Stainless code generation and its content (other than this keep file) won't be touched.
It is ignored by code generation and its content (other than this keep file) won't be touched.
7 changes: 1 addition & 6 deletions scripts/mock
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ elif [[ -f .castiron.stats.yml && -f api_reference/openapi.transformed.yml ]]; t
exit 1
fi
else
URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)"
fi

# Check if the URL is empty
if [ -z "$URL" ]; then
echo "Error: No OpenAPI spec path/url provided or found in .stats.yml"
echo "Error: No OpenAPI spec path/url provided or found in Castiron generation metadata" >&2
exit 1
fi

Expand Down
27 changes: 0 additions & 27 deletions scripts/utils/upload-artifact.sh

This file was deleted.

2 changes: 0 additions & 2 deletions src/openai/_constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import httpx2

RAW_RESPONSE_HEADER = "X-Stainless-Raw-Response"
Expand Down
2 changes: 0 additions & 2 deletions src/openai/_event_handler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

import threading
Expand Down
2 changes: 0 additions & 2 deletions src/openai/_exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import TYPE_CHECKING, Any, Optional, cast
Expand Down
2 changes: 0 additions & 2 deletions src/openai/_resource.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

import time
Expand Down
2 changes: 0 additions & 2 deletions src/openai/_send_queue.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

import typing
Expand Down
2 changes: 1 addition & 1 deletion src/openai/_utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def get_required_header(headers: HeadersLike, header: str) -> str:
if k.lower() == lower_header and isinstance(v, str):
return v

# to deal with the case where the header looks like Stainless-Event-Id
# to deal with the case where the header looks like X-Request-Id
intercaps_header = re.sub(r"([^\w])(\w)", lambda pat: pat.group(1) + pat.group(2).upper(), header.capitalize())

for normalized_header in [header, lower_header, header.upper(), intercaps_header]:
Expand Down
2 changes: 0 additions & 2 deletions src/openai/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "openai"
__version__ = "3.0.0" # x-release-please-version
4 changes: 1 addition & 3 deletions src/openai/lib/.keep
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
File generated from our OpenAPI spec by Stainless.

This directory can be used to store custom files to expand the SDK.
It is ignored by Stainless code generation and its content (other than this keep file) won't be touched.
It is ignored by code generation and its content (other than this keep file) won't be touched.
2 changes: 0 additions & 2 deletions src/openai/pagination.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Any, List, Generic, TypeVar, Optional, cast
from typing_extensions import Protocol, override, runtime_checkable

Expand Down
2 changes: 0 additions & 2 deletions src/openai/resources/beta/realtime/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from .realtime import (
Realtime,
AsyncRealtime,
Expand Down
2 changes: 0 additions & 2 deletions src/openai/resources/beta/realtime/realtime.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

import json
Expand Down
2 changes: 0 additions & 2 deletions src/openai/resources/beta/realtime/sessions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import List, Union, Iterable
Expand Down
2 changes: 0 additions & 2 deletions src/openai/resources/beta/realtime/transcription_sessions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import List
Expand Down
2 changes: 0 additions & 2 deletions src/openai/types/beta/chat/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations
2 changes: 0 additions & 2 deletions src/openai/types/beta/realtime/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from .session import Session as Session
Expand Down
2 changes: 0 additions & 2 deletions src/openai/types/beta/realtime/conversation_created_event.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing_extensions import Literal

Expand Down
2 changes: 0 additions & 2 deletions src/openai/types/beta/realtime/conversation_item.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Optional
from typing_extensions import Literal

Expand Down
2 changes: 0 additions & 2 deletions src/openai/types/beta/realtime/conversation_item_content.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing_extensions import Literal

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import Literal, TypedDict
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing_extensions import Literal

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import Literal, Required, TypedDict
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing_extensions import Literal

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing_extensions import Literal

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import Literal, Required, TypedDict
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing_extensions import Literal

from ...._models import BaseModel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Union, Optional
from typing_extensions import Literal, TypeAlias

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Optional
from typing_extensions import Literal

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing_extensions import Literal

Expand Down
2 changes: 0 additions & 2 deletions src/openai/types/beta/realtime/conversation_item_param.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import Iterable
Expand Down
Loading
Loading