Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 1.7.0 #1018

Merged
merged 14 commits into from
Jan 9, 2024
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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.6.1"
".": "1.7.0"
}
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# Changelog

## 1.7.0 (2024-01-08)

Full Changelog: [v1.6.1...v1.7.0](https://github.com/openai/openai-python/compare/v1.6.1...v1.7.0)

### Features

* add `None` default value to nullable response properties ([#1043](https://github.com/openai/openai-python/issues/1043)) ([d94b4d3](https://github.com/openai/openai-python/commit/d94b4d3d0adcd1a49a1c25cc9730cef013a3e9c9))


### Bug Fixes

* **client:** correctly use custom http client auth ([#1028](https://github.com/openai/openai-python/issues/1028)) ([3d7d93e](https://github.com/openai/openai-python/commit/3d7d93e951eb7fe09cd9d94d10a62a020398c7f9))


### Chores

* add .keep files for examples and custom code directories ([#1057](https://github.com/openai/openai-python/issues/1057)) ([7524097](https://github.com/openai/openai-python/commit/7524097a47af0fdc8b560186ef3b111b59430741))
* **internal:** bump license ([#1037](https://github.com/openai/openai-python/issues/1037)) ([d828527](https://github.com/openai/openai-python/commit/d828527540ebd97679075f48744818f06311b0cb))
* **internal:** loosen type var restrictions ([#1049](https://github.com/openai/openai-python/issues/1049)) ([e00876b](https://github.com/openai/openai-python/commit/e00876b20b93038450eb317899d8775c7661b8eb))
* **internal:** replace isort with ruff ([#1042](https://github.com/openai/openai-python/issues/1042)) ([f1fbc9c](https://github.com/openai/openai-python/commit/f1fbc9c0d62e7d89ab32c8bdfa39cd94b560690b))
* **internal:** update formatting ([#1041](https://github.com/openai/openai-python/issues/1041)) ([2e9ecee](https://github.com/openai/openai-python/commit/2e9ecee9bdfa8ec33b1b1527d5187483b700fad3))
* **src:** fix typos ([#988](https://github.com/openai/openai-python/issues/988)) ([6a8b806](https://github.com/openai/openai-python/commit/6a8b80624636f9a0e5ada151b2509710a6f74808))
* use property declarations for resource members ([#1047](https://github.com/openai/openai-python/issues/1047)) ([131f6bc](https://github.com/openai/openai-python/commit/131f6bc6b0ccf79119096057079e10906b3d4678))


### Documentation

* fix docstring typos ([#1022](https://github.com/openai/openai-python/issues/1022)) ([ad3fd2c](https://github.com/openai/openai-python/commit/ad3fd2cd19bf91f94473e368554dff39a8f9ad16))
* improve audio example to show how to stream to a file ([#1017](https://github.com/openai/openai-python/issues/1017)) ([d45ed7f](https://github.com/openai/openai-python/commit/d45ed7f0513b167555ae875f1877fa205c5790d2))

## 1.6.1 (2023-12-22)

Full Changelog: [v1.6.0...v1.6.1](https://github.com/openai/openai-python/compare/v1.6.0...v1.6.1)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2023 OpenAI
Copyright 2024 OpenAI

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
4 changes: 4 additions & 0 deletions examples/.keep
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
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.
21 changes: 21 additions & 0 deletions examples/picture.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python

from openai import OpenAI

# gets OPENAI_API_KEY from your environment variables
openai = OpenAI()

prompt = "An astronaut lounging in a tropical resort in space, pixel art"
model = "dall-e-3"


def main() -> None:
# Generate an image based on the prompt
response = openai.images.generate(prompt=prompt, model=model)

# Prints response containing a URL link to image
print(response)


if __name__ == "__main__":
main()
19 changes: 11 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "openai"
version = "1.6.1"
version = "1.7.0"
description = "The official Python library for the openai API"
readme = "README.md"
license = "Apache-2.0"
Expand All @@ -14,6 +14,7 @@ dependencies = [
"anyio>=3.5.0, <5",
"distro>=1.7.0, <2",
"sniffio",
"cached-property; python_version < '3.8'",
"tqdm > 4"
]
requires-python = ">= 3.7.1"
Expand Down Expand Up @@ -55,7 +56,6 @@ dev-dependencies = [
"pytest",
"pytest-asyncio",
"ruff",
"isort",
"time-machine",
"nox",
"dirty-equals>=0.6.0",
Expand All @@ -69,7 +69,6 @@ format = { chain = [
"format:ruff",
"format:docs",
"fix:ruff",
"format:isort",
]}
"format:black" = "black ."
"format:docs" = "python bin/ruffen-docs.py README.md api.md"
Expand Down Expand Up @@ -130,16 +129,13 @@ reportImplicitOverride = true
reportImportCycles = false
reportPrivateUsage = false

[tool.isort]
profile = "black"
length_sort = true
extra_standard_library = ["typing_extensions"]

[tool.ruff]
line-length = 120
output-format = "grouped"
target-version = "py37"
select = [
# isort
"I",
# bugbear rules
"B",
# remove unused imports
Expand All @@ -166,6 +162,13 @@ ignore-init-module-imports = true
[tool.ruff.format]
docstring-code-format = true

[tool.ruff.lint.isort]
length-sort = true
length-sort-straight = true
combine-as-imports = true
extra-standard-library = ["typing_extensions"]
known-first-party = ["openai", "tests"]

[tool.ruff.per-file-ignores]
"bin/**.py" = ["T201", "T203"]
"tests/**.py" = ["T201", "T203"]
Expand Down
7 changes: 3 additions & 4 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,16 @@ httpx==0.25.2
idna==3.4
importlib-metadata==7.0.0
iniconfig==2.0.0
isort==5.10.1
msal==1.26.0
msal-extensions==1.1.0
mypy==1.7.1
mypy-extensions==1.0.0
nodeenv==1.8.0
nox==2023.4.22
numpy==1.26.2
numpy==1.26.3
packaging==23.2
pandas==2.1.4
pandas-stubs==2.1.4.231218
pandas-stubs==2.1.4.231227
platformdirs==3.11.0
pluggy==1.3.0
portalocker==2.8.2
Expand All @@ -64,7 +63,7 @@ tqdm==4.66.1
types-pytz==2023.3.1.1
types-tqdm==4.66.0.2
typing-extensions==4.8.0
tzdata==2023.3
tzdata==2023.4
urllib3==2.1.0
virtualenv==20.24.5
zipp==3.17.0
Expand Down
41 changes: 16 additions & 25 deletions src/openai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,7 @@
from . import types
from ._types import NoneType, Transport, ProxiesTypes
from ._utils import file_from_path
from ._client import (
Client,
OpenAI,
Stream,
Timeout,
Transport,
AsyncClient,
AsyncOpenAI,
AsyncStream,
RequestOptions,
)
from ._client import Client, OpenAI, Stream, Timeout, Transport, AsyncClient, AsyncOpenAI, AsyncStream, RequestOptions
from ._version import __title__, __version__
from ._exceptions import (
APIError,
Expand Down Expand Up @@ -72,8 +62,7 @@

from .lib import azure as _azure
from .version import VERSION as VERSION
from .lib.azure import AzureOpenAI as AzureOpenAI
from .lib.azure import AsyncAzureOpenAI as AsyncAzureOpenAI
from .lib.azure import AzureOpenAI as AzureOpenAI, AsyncAzureOpenAI as AsyncAzureOpenAI
from .lib._old_api import *

_setup_logging()
Expand Down Expand Up @@ -323,15 +312,17 @@ def _reset_client() -> None: # type: ignore[reportUnusedFunction]
_client = None


from ._module_client import beta as beta
from ._module_client import chat as chat
from ._module_client import audio as audio
from ._module_client import edits as edits
from ._module_client import files as files
from ._module_client import images as images
from ._module_client import models as models
from ._module_client import embeddings as embeddings
from ._module_client import fine_tunes as fine_tunes
from ._module_client import completions as completions
from ._module_client import fine_tuning as fine_tuning
from ._module_client import moderations as moderations
from ._module_client import (
beta as beta,
chat as chat,
audio as audio,
edits as edits,
files as files,
images as images,
models as models,
embeddings as embeddings,
fine_tunes as fine_tunes,
completions as completions,
fine_tuning as fine_tuning,
moderations as moderations,
)
Loading