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

Feat/oai1.40.1 #194

Merged
merged 16 commits into from
Sep 4, 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
16 changes: 16 additions & 0 deletions portkey_ai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@
AsyncVectorStores,
AsyncVectorFiles,
AsyncVectorFileBatches,
BetaChat,
AsyncBetaChat,
BetaCompletions,
AsyncBetaCompletions,
Uploads,
Parts,
AsyncUploads,
AsyncParts,
)

from portkey_ai.version import VERSION
Expand Down Expand Up @@ -144,5 +152,13 @@
"AsyncVectorStores",
"AsyncVectorFiles",
"AsyncVectorFileBatches",
"BetaChat",
"AsyncBetaChat",
"BetaCompletions",
"AsyncBetaCompletions",
"Uploads",
"Parts",
"AsyncUploads",
"AsyncParts",
"openai",
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.3
Name: openai
Version: 1.26.0
Version: 1.40.1
Summary: The official Python library for the openai API
Project-URL: Homepage, https://github.com/openai/openai-python
Project-URL: Repository, https://github.com/openai/openai-python
Expand All @@ -27,10 +27,11 @@ Requires-Dist: anyio<5,>=3.5.0
Requires-Dist: cached-property; python_version < '3.8'
Requires-Dist: distro<2,>=1.7.0
Requires-Dist: httpx<1,>=0.23.0
Requires-Dist: jiter<1,>=0.4.0
Requires-Dist: pydantic<3,>=1.9.0
Requires-Dist: sniffio
Requires-Dist: tqdm>4
Requires-Dist: typing-extensions<5,>=4.7
Requires-Dist: typing-extensions<5,>=4.11
Provides-Extra: datalib
Requires-Dist: numpy>=1; extra == 'datalib'
Requires-Dist: pandas-stubs>=1.1.0.11; extra == 'datalib'
Expand All @@ -49,7 +50,7 @@ It is generated from our [OpenAPI specification](https://github.com/openai/opena

## Documentation

The REST API documentation can be found [on platform.openai.com](https://platform.openai.com/docs). The full API of this library can be found in [api.md](https://github.com/openai/openai-python/tree/main/api.md).
The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). The full API of this library can be found in [api.md](https://github.com/openai/openai-python/tree/main/api.md).

## Installation

Expand Down Expand Up @@ -94,7 +95,7 @@ so that your API Key is not stored in source control.

When interacting with the API some actions such as starting a Run and adding files to vector stores are asynchronous and take time to complete. The SDK includes
helper functions which will poll the status until it reaches a terminal state and then return the resulting object.
If an API method results in an action which could benefit from polling there will be a corresponding version of the
If an API method results in an action that could benefit from polling there will be a corresponding version of the
method ending in '\_and_poll'.

For instance to create a Run and poll until it reaches a terminal state you can run:
Expand All @@ -110,7 +111,7 @@ More information on the lifecycle of a Run can be found in the [Run Lifecycle Do

### Bulk Upload Helpers

When creating an interacting with vector stores, you can use the polling helpers to monitor the status of operations.
When creating and interacting with vector stores, you can use polling helpers to monitor the status of operations.
For convenience, we also provide a bulk upload helper to allow you to simultaneously upload several files at once.

```python
Expand All @@ -124,7 +125,7 @@ batch = await client.vector_stores.file_batches.upload_and_poll(

### Streaming Helpers

The SDK also includes helpers to process streams and handle the incoming events.
The SDK also includes helpers to process streams and handle incoming events.

```python
with client.beta.threads.runs.stream(
Expand Down Expand Up @@ -240,7 +241,7 @@ completion = openai.chat.completions.create(
print(completion.choices[0].message.content)
```

The API is the exact same as the standard client instance based API.
The API is the exact same as the standard client instance-based API.

This is intended to be used within REPLs or notebooks for faster iteration, **not** in application code.

Expand All @@ -267,7 +268,7 @@ List methods in the OpenAI API are paginated.
This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:

```python
import openai
from openai import OpenAI

client = OpenAI()

Expand All @@ -285,7 +286,7 @@ Or, asynchronously:

```python
import asyncio
import openai
from openai import AsyncOpenAI

client = AsyncOpenAI()

Expand Down Expand Up @@ -599,7 +600,7 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c

- Support for proxies
- Custom transports
- Additional [advanced](https://www.python-httpx.org/advanced/#client-instances) functionality
- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality

```python
from openai import OpenAI, DefaultHttpxClient
Expand All @@ -614,13 +615,19 @@ client = OpenAI(
)
```

You can also customize the client on a per-request basis by using `with_options()`:

```python
client.with_options(http_client=DefaultHttpxClient(...))
```

### Managing HTTP resources

By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.

## Microsoft Azure OpenAI

To use this library with [Azure OpenAI](https://learn.microsoft.com/en-us/azure/ai-services/openai/overview), use the `AzureOpenAI`
To use this library with [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview), use the `AzureOpenAI`
class instead of the `OpenAI` class.

> [!IMPORTANT]
Expand All @@ -632,9 +639,9 @@ from openai import AzureOpenAI

# gets the API Key from environment variable AZURE_OPENAI_API_KEY
client = AzureOpenAI(
# https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#rest-api-versioning
# https://learn.microsoft.com/azure/ai-services/openai/reference#rest-api-versioning
api_version="2023-07-01-preview",
# https://learn.microsoft.com/en-us/azure/cognitive-services/openai/how-to/create-resource?pivots=web-portal#create-a-resource
# https://learn.microsoft.com/azure/cognitive-services/openai/how-to/create-resource?pivots=web-portal#create-a-resource
azure_endpoint="https://example-endpoint.openai.azure.com",
)

Expand All @@ -658,7 +665,7 @@ In addition to the options provided in the base `OpenAI` client, the following o
- `azure_ad_token` (or the `AZURE_OPENAI_AD_TOKEN` environment variable)
- `azure_ad_token_provider`

An example of using the client with Azure Active Directory can be found [here](https://github.com/openai/openai-python/blob/main/examples/azure_ad.py).
An example of using the client with Microsoft Entra ID (formerly known as Azure Active Directory) can be found [here](https://github.com/openai/openai-python/blob/main/examples/azure_ad.py).

## Versioning

Expand Down
Loading
Loading