Skip to content

Commit 373ddae

Browse files
authored
Merge pull request #5 from mmacy/doc-release--1.13.0
[UNOFFICIAL] Doc release for v1.13.0 library release (WIP)
2 parents d5fe138 + 9b47651 commit 373ddae

37 files changed

+388
-888
lines changed

.github/workflows/create-releases.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/publish-pypi.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
# workflow for re-running publishing to PyPI in case it fails for some reason
2-
# you can run this workflow by navigating to https://www.github.com/openai/openai-python/actions/workflows/publish-pypi.yml
1+
# This workflow is triggered when a GitHub release is created.
2+
# It can also be run manually to re-publish to PyPI in case it failed for some reason.
3+
# You can run this workflow by navigating to https://www.github.com/openai/openai-python/actions/workflows/publish-pypi.yml
34
name: Publish PyPI
45
on:
56
workflow_dispatch:
67

8+
release:
9+
types: [published]
10+
711
jobs:
812
publish:
913
name: publish

.github/workflows/release-doctor.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ jobs:
1919
run: |
2020
bash ./bin/check-release-environment
2121
env:
22-
STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }}
2322
PYPI_TOKEN: ${{ secrets.OPENAI_PYPI_TOKEN || secrets.PYPI_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ codegen.log
1515

1616
# Ignore the MkDocs build artifact directory
1717
site/
18+
19+
# Random ignores
20+
.DS_Store

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.12.0"
2+
".": "1.13.0"
33
}

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Changelog
22

3+
## 1.13.0 (2024-02-19)
4+
5+
Full Changelog: [v1.12.0...v1.13.0](https://github.com/openai/openai-python/compare/v1.12.0...v1.13.0)
6+
7+
### Features
8+
9+
* **api:** updates ([#1146](https://github.com/openai/openai-python/issues/1146)) ([79b7675](https://github.com/openai/openai-python/commit/79b7675e51fb7d269a6ea281a568bc7812ba2ace))
10+
11+
12+
### Bug Fixes
13+
14+
* **api:** remove non-GA instance_id param ([#1164](https://github.com/openai/openai-python/issues/1164)) ([1abe139](https://github.com/openai/openai-python/commit/1abe139b1a5f5cc41263738fc12856056dce5697))
15+
16+
17+
### Chores
18+
19+
* **ci:** move github release logic to github app ([#1155](https://github.com/openai/openai-python/issues/1155)) ([67cfac2](https://github.com/openai/openai-python/commit/67cfac2564dfb718da0465e34b90ac6928fa962a))
20+
* **client:** use correct accept headers for binary data ([#1161](https://github.com/openai/openai-python/issues/1161)) ([e536437](https://github.com/openai/openai-python/commit/e536437ae0b2cb0ddf2d74618722005d37403f32))
21+
* **internal:** refactor release environment script ([#1158](https://github.com/openai/openai-python/issues/1158)) ([7fe8ec3](https://github.com/openai/openai-python/commit/7fe8ec3bf04ecf85e3bd5adf0d9992c051f87b81))
22+
323
## 1.12.0 (2024-02-08)
424

525
Full Changelog: [v1.11.1...v1.12.0](https://github.com/openai/openai-python/compare/v1.11.1...v1.12.0)

bin/check-release-environment

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22

33
errors=()
44

5-
if [ -z "${STAINLESS_API_KEY}" ]; then
6-
errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organization secrets on GitHub.")
7-
fi
8-
95
if [ -z "${PYPI_TOKEN}" ]; then
106
errors+=("The OPENAI_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
117
fi
128

13-
len=${#errors[@]}
9+
lenErrors=${#errors[@]}
1410

15-
if [[ len -gt 0 ]]; then
11+
if [[ lenErrors -gt 0 ]]; then
1612
echo -e "Found the following errors in the release environment:\n"
1713

1814
for error in "${errors[@]}"; do

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Welcome to Marsh's totally unofficial and totally unsupported documentation for
1010

1111
## About these docs
1212

13-
These docs are officially unofficial and unsupported, but you're welcome to use and improve them until OpenAI brings up their own (1) or they ask me to take them down.
13+
These docs are officially unofficial, but you're welcome to use and improve them until OpenAI brings up their own (1) or they ask me to take them down.
1414
{ .annotate }
1515

1616
1. I'll likely decommission this site when OpenAI [publishes their own Python API reference](https://community.openai.com/t/where-is-the-documentation-for-the-python-openai-sdk/583643).
@@ -30,4 +30,4 @@ That said, I use these docs myself and thus intend to keep them (mostly) current
3030

3131
1. That means you might encounter inaccuracies or you might not find what you think should be here. In either case, you should refer to [openai/openai-python](https://github.com/openai/openai-python) as the source of truth.
3232

33-
:material-hand-wave: *Enjoy!*[Marsh](https://github.com/mmacy)
33+
:material-peace: *Enjoy!*[Marsh](https://github.com/mmacy)
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
"""Snippets in this docstring are ingested by other documentation (including library docstrings) during the MkDocs build process.
2+
3+
# --8<-- [start:audio]
4+
The `audio` module provides classes for handling various audio processing operations, including transcription of audio to text, translation of spoken content, and speech synthesis.
5+
6+
This module supports synchronous and asynchronous operations, and offers interfaces for direct interaction with audio data, as well as handling of raw and streaming responses. Designed for applications that require audio input processing like automated transcription services, real-time translation of spoken language, and generating spoken content from text.
7+
# --8<-- [end:audio]
8+
9+
# --8<-- [start:beta]
10+
The `beta` modules provides a unified interface for accessing beta features of the API, encapsulating synchronous and asynchronous access to resources in beta.
11+
12+
The module aggregates the beta functionalities related to features like yet considered generally available (GA), offering a simplified entry point for interacting with these resources. It is designed to facilitate easy access to the cutting-edge features still under development, enabling developers to experiment with and leverage new capabilities before they become GA.
13+
# --8<-- [end:beta]
14+
15+
# --8<-- [start:chat]
16+
The `chat` module provides classes for creating and managing chat sessions that leverage OpenAI's language models to generate conversational responses.
17+
18+
The module supports both synchronous and asynchronous operations, offering interfaces for direct interaction with the completion endpoints tailored for chat applications. Designed for developers looking to integrate AI-powered chat functionalities into their applicationsand features like raw and streaming response handling for more flexible integration.
19+
# --8<-- [end:chat]
20+
21+
# --8<-- [start:chat_completions]
22+
The `chat.completions` module provides access to the chat completions endpoint of the OpenAI API. It supports
23+
the latest models including `gpt-4`, `gpt-4-turbo-preview`, `gpt-4-vision-preview`, `gpt-4-32k`, `gpt-3.5-turbo`,
24+
and their respective dated model releases, along with fine-tuned versions of `gpt-3.5-turbo`.
25+
26+
This module interacts with the `/v1/chat/completions` endpoint and replaces the the legacy [`resources.completions`][src.openai.resources.completions] module. You're *strongly encouraged* to migrate existing applications that use the legacy `resources.completions` module to this one before the expected [deprecation](https://platform.openai.com/docs/deprecations) of the `/v1/completions` endpoint.
27+
# --8<-- [end:chat_completions]
28+
29+
# --8<-- [start:completions]
30+
The `completions` module provides access to the legacy completions endpoint of the OpenAI API. Use the [`chat.completions`][src.openai.resources.chat.completions] module instead for new applications.
31+
32+
This module interacts with a [legacy](https://platform.openai.com/docs/deprecations) endpoint, `/v1/completions`, indicating that the endpoint no longer receives updates and is expected to be deprecated. This module is for use only in applications that require compatibility with the legacy endpoint and should **not** be used for new projects.
33+
34+
You're *strongly encouraged* to migrate existing applications to the [`chat.completions`][src.openai.resources.chat.completions] module⁠—which interacts with the current (non-legacy) `/v1/chat/completions` endpoint—prior to the [deprecation](https://platform.openai.com/docs/deprecations) of the `/v1/completions` endpoint.
35+
# --8<-- [end:completions]
36+
37+
# --8<-- [start:embeddings]
38+
The `embeddings` module provides classes for creating embeddings from text inputs using OpenAI's models and supports both synchronous and asynchronous operations as well as the handling of raw responses and streaming response capabilities.
39+
40+
The module is appropriate for use in applications that require semantic analysis of text, like similarity searches, text clustering, and other natural language processing tasks that can benefit from high-dimensional vector representations of text.
41+
# --8<-- [end:embeddings]
42+
43+
# --8<-- [start:files]
44+
The `files` module provides classes for uploading, retrieving, listing, and deleting files used across various OpenAI API endpoints.
45+
46+
The module supports both synchronous and asynchronous operations, along with handling of raw responses and streaming of file content. Designed for use cases that involve managing large datasets or files for purposes like fine-tuning models or using assistants, this module facilitates the efficient handling of file-related operations on the OpenAI platform.
47+
# --8<-- [end:files]
48+
49+
# --8<-- [start:fine_tuning]
50+
The `fine_tuning` module provides classes for handling fine-tuning operations, including the initiation, management, and retrieval of fine-tuning jobs.
51+
52+
The module supports synchronous and asynchronous operations, offering interfaces for working with jobs directly, as well as with raw or streaming responses. Designed for use in applications requiring custom model training on specific datasets to improve model performance for tailored tasks.
53+
# --8<-- [end:fine_tuning]
54+
55+
# --8<-- [start:fine_tuning_jobs]
56+
The `jobs` module provides synchronous and asynchronous access to fine-tuning job resources and enables you to create, retrieve, list, and cancel fine-tuning jobs and list the events associated with them.
57+
58+
Fine-tuning jobs allow you to customize pre-trained models with your own datasets, optimizing performance for specific tasks or improving understanding of particular data types. The classes in the `jobs` module includes methods for managing fine-tuning jobs, like creating a new job, fetching details of an existing job, listing all jobs, canceling a job, and listing events associated with a job.
59+
# --8<-- [end:fine_tuning_jobs]
60+
61+
# --8<-- [start:images]
62+
The `image` module provides functionality for creating variations of images, editing images based on textual prompts, and generating new images from prompts using specified models.
63+
64+
The module supports both synchronous and asynchronous operations, with capabilities for handling raw responses and streaming. Suitable for applications requiring dynamic image generation or modification through the OpenAI API, this module leverages models like DALL-E to interpret text prompts into visual content.
65+
# --8<-- [end:images]
66+
67+
# --8<-- [start:models]
68+
The `models` module facilitates the retrieval, listing, and deletion of models on the OpenAI platform and supports both synchronous and asynchronous operations.
69+
70+
The module enables developers to interact with models, providing functionalities like fetching detailed information about a specific model, listing all available models, and deleting fine-tuned models.
71+
# --8<-- [end:models]
72+
73+
# --8<-- [start:moderations]
74+
The `moderations` module provides functionality to submit text for moderation to determine whether it violates OpenAI's content policy.
75+
76+
Moderation is particularly useful for developers looking to ensure the content generated or processed by their applications adheres to OpenAI's content policy. By leveraging the content moderation models provided by OpenAI, applications can automatically classify and filter out text that might be considered harmful or inappropriate.
77+
# --8<-- [end:moderations]
78+
79+
# --8<-- [start:assistants]
80+
The `assistants` module offers functionalities to create, retrieve, update, list, and delete Assistants. Assistants are AI models configured to perform specific tasks based on instructions, files, and other parameters.
81+
# --8<-- [end:assistants]
82+
83+
# --8<-- [start:threads]
84+
The `threads` module facilitates the creation, retrieval, update, deletion, and execution of Threads. Threads represent a series of messages or interactions with an assistant and support a conversational context or a sequence of operations.
85+
# --8<-- [end:threads]
86+
"""

docs/reference/include/openai_init.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""Snippets in this docstring are ingested by other documentation (including library docstrings) during the MkDocs build process.
2+
3+
# --8<-- [start:openai]
4+
The [openai](https://pypi.org/project/openai/) package is the core library to install in Python projects that need
5+
to call the [OpenAI REST API](https://platform.openai.com/docs/api-reference). It inclues modules for working with OpenAI
6+
resources that provide access to its AI [models](https://platform.openai.com/docs/models),
7+
including large language models (LLMs) like GPT-4 and models for working with images and audio. The `openai` package
8+
provides both synchronous and asynchronous API clients, options to configure their behavior, and modules that provide
9+
Python code with an API surface to interact with the OpenAI platform.
10+
11+
To get started, check out the documentation for the module representing the [resource][src.openai.resources] you're interested in using for your
12+
project. For example, the [`resources.chat.completions`][src.openai.resources.chat.completions] module is what you'd use
13+
for conversational chat-style interactions with an LLM like [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo).
14+
Or, maybe you need the [`resources.audio`][src.openai.resources.audio] module for performing audio transcription, translation, and
15+
speech synthesis in your app.
16+
17+
Documentation for the library's main API client classes, [`OpenAI`][src.openai.OpenAI] and
18+
[`AsyncOpenAI`][src.openai.AsyncOpenAI], is another good place to start. The clients are the primary contact point for
19+
your code that needs to work with any of the resources available on OpenAI API endpoints.
20+
21+
For more information about the REST API this package talks to or to find client libraries for other programming
22+
languages, see:
23+
24+
- [REST API reference documentation](https://platform.openai.com/docs/api-reference) for the OpenAPI REST API (platform.openai.com)
25+
- [OpenAPI Description (OAD)](https://github.com/openai/openai-openapi) file for the OpenAPI REST API (GitHub)
26+
- More [client libraries](https://platform.openai.com/docs/libraries) for the OpenAI API (platform.openai.com)
27+
# --8<-- [end:openai]
28+
"""

docs/reference/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# openai
22

3-
::: src.openai
3+
::: src.openai
4+
options:
5+
docstring_section_style: spacy

mkdocs.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ watch: [README.md, src/openai]
99
theme:
1010
name: material
1111
icon:
12-
repo: fontawesome/brands/github
12+
repo: fontawesome/brands/git-alt
1313

1414
palette:
1515
- media: "(prefers-color-scheme: light)"
@@ -68,6 +68,8 @@ markdown_extensions:
6868
- pymdownx.inlinehilite
6969
- pymdownx.snippets
7070
- pymdownx.superfences
71+
- pymdownx.tasklist:
72+
custom_checkbox: true
7173

7274
plugins:
7375
- search
@@ -98,7 +100,7 @@ plugins:
98100
inherited_members: false
99101
merge_init_into_class: true
100102
separate_signature: true
101-
show_bases: true
103+
show_bases: false
102104
show_if_no_docstring: true
103105
show_root_full_path: false
104106
show_root_heading: false

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "openai"
3-
version = "1.12.0"
3+
version = "1.13.0"
44
description = "The official Python library for the openai API"
55
readme = "README.md"
66
license = "Apache-2.0"

src/openai/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# File generated from our OpenAPI spec by Stainless.
2-
2+
""" --8<-- 'docs/reference/include/openai_init.py:openai' """
33
from __future__ import annotations
44

55
import os as _os

src/openai/_base_client.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ def __init__(
147147

148148

149149
class BasePage(GenericModel, Generic[_T]):
150-
"""
151-
Defines the core interface for pagination.
150+
"""Defines the core interface for pagination.
152151
153152
Type Args:
154153
ModelT: The pydantic model that represents an item in the response.
@@ -419,8 +418,7 @@ def _build_headers(self, options: FinalRequestOptions) -> httpx.Headers:
419418
return headers
420419

421420
def _prepare_url(self, url: str) -> URL:
422-
"""
423-
Merge a URL argument together with any 'base_url' on the client,
421+
"""Merge a URL argument together with any 'base_url' on the client,
424422
to create the URL used for the outgoing request.
425423
"""
426424
# Copied from httpx's `_merge_url` method.

0 commit comments

Comments
 (0)