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
50 changes: 50 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,56 @@ Methods:

- <code title="post /responses/input_tokens?beta=true">client.beta.responses.input_tokens.<a href="./src/openai/resources/beta/responses/input_tokens.py">count</a>(\*\*<a href="src/openai/types/beta/responses/input_token_count_params.py">params</a>) -> <a href="./src/openai/types/beta/responses/input_token_count_response.py">InputTokenCountResponse</a></code>

## ChatKit

Types:

```python
from openai.types.beta import ChatKitWorkflow
```

### Sessions

Methods:

- <code title="post /chatkit/sessions">client.beta.chatkit.sessions.<a href="./src/openai/resources/beta/chatkit/sessions.py">create</a>(\*\*<a href="src/openai/types/beta/chatkit/session_create_params.py">params</a>) -> <a href="./src/openai/types/beta/chatkit/chat_session.py">ChatSession</a></code>
- <code title="post /chatkit/sessions/{session_id}/cancel">client.beta.chatkit.sessions.<a href="./src/openai/resources/beta/chatkit/sessions.py">cancel</a>(session_id) -> <a href="./src/openai/types/beta/chatkit/chat_session.py">ChatSession</a></code>

### Threads

Types:

```python
from openai.types.beta.chatkit import (
ChatSession,
ChatSessionAutomaticThreadTitling,
ChatSessionChatKitConfiguration,
ChatSessionChatKitConfigurationParam,
ChatSessionExpiresAfterParam,
ChatSessionFileUpload,
ChatSessionHistory,
ChatSessionRateLimits,
ChatSessionRateLimitsParam,
ChatSessionStatus,
ChatSessionWorkflowParam,
ChatKitAttachment,
ChatKitResponseOutputText,
ChatKitThread,
ChatKitThreadAssistantMessageItem,
ChatKitThreadItemList,
ChatKitThreadUserMessageItem,
ChatKitWidgetItem,
ThreadDeleteResponse,
)
```

Methods:

- <code title="get /chatkit/threads/{thread_id}">client.beta.chatkit.threads.<a href="./src/openai/resources/beta/chatkit/threads.py">retrieve</a>(thread_id) -> <a href="./src/openai/types/beta/chatkit/chatkit_thread.py">ChatKitThread</a></code>
- <code title="get /chatkit/threads">client.beta.chatkit.threads.<a href="./src/openai/resources/beta/chatkit/threads.py">list</a>(\*\*<a href="src/openai/types/beta/chatkit/thread_list_params.py">params</a>) -> <a href="./src/openai/types/beta/chatkit/chatkit_thread.py">SyncConversationCursorPage[ChatKitThread]</a></code>
- <code title="delete /chatkit/threads/{thread_id}">client.beta.chatkit.threads.<a href="./src/openai/resources/beta/chatkit/threads.py">delete</a>(thread_id) -> <a href="./src/openai/types/beta/chatkit/thread_delete_response.py">ThreadDeleteResponse</a></code>
- <code title="get /chatkit/threads/{thread_id}/items">client.beta.chatkit.threads.<a href="./src/openai/resources/beta/chatkit/threads.py">list_items</a>(thread_id, \*\*<a href="src/openai/types/beta/chatkit/thread_list_items_params.py">params</a>) -> SyncConversationCursorPage[Data]</code>

## Realtime

Types:
Expand Down
24 changes: 12 additions & 12 deletions tests/api_resources/fine_tuning/jobs/test_checkpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ class TestCheckpoints:
@parametrize
def test_method_list(self, client: OpenAI) -> None:
checkpoint = client.fine_tuning.jobs.checkpoints.list(
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F",
)
assert_matches_type(SyncCursorPage[FineTuningJobCheckpoint], checkpoint, path=["response"])

@parametrize
def test_method_list_with_all_params(self, client: OpenAI) -> None:
checkpoint = client.fine_tuning.jobs.checkpoints.list(
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
after="string",
fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F",
after="after",
limit=0,
)
assert_matches_type(SyncCursorPage[FineTuningJobCheckpoint], checkpoint, path=["response"])

@parametrize
def test_raw_response_list(self, client: OpenAI) -> None:
response = client.fine_tuning.jobs.checkpoints.with_raw_response.list(
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F",
)

assert response.is_closed is True
Expand All @@ -48,7 +48,7 @@ def test_raw_response_list(self, client: OpenAI) -> None:
@parametrize
def test_streaming_response_list(self, client: OpenAI) -> None:
with client.fine_tuning.jobs.checkpoints.with_streaming_response.list(
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -62,7 +62,7 @@ def test_streaming_response_list(self, client: OpenAI) -> None:
def test_path_params_list(self, client: OpenAI) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `fine_tuning_job_id` but received ''"):
client.fine_tuning.jobs.checkpoints.with_raw_response.list(
"",
fine_tuning_job_id="",
)


Expand All @@ -74,23 +74,23 @@ class TestAsyncCheckpoints:
@parametrize
async def test_method_list(self, async_client: AsyncOpenAI) -> None:
checkpoint = await async_client.fine_tuning.jobs.checkpoints.list(
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F",
)
assert_matches_type(AsyncCursorPage[FineTuningJobCheckpoint], checkpoint, path=["response"])

@parametrize
async def test_method_list_with_all_params(self, async_client: AsyncOpenAI) -> None:
checkpoint = await async_client.fine_tuning.jobs.checkpoints.list(
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
after="string",
fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F",
after="after",
limit=0,
)
assert_matches_type(AsyncCursorPage[FineTuningJobCheckpoint], checkpoint, path=["response"])

@parametrize
async def test_raw_response_list(self, async_client: AsyncOpenAI) -> None:
response = await async_client.fine_tuning.jobs.checkpoints.with_raw_response.list(
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F",
)

assert response.is_closed is True
Expand All @@ -101,7 +101,7 @@ async def test_raw_response_list(self, async_client: AsyncOpenAI) -> None:
@parametrize
async def test_streaming_response_list(self, async_client: AsyncOpenAI) -> None:
async with async_client.fine_tuning.jobs.checkpoints.with_streaming_response.list(
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -115,5 +115,5 @@ async def test_streaming_response_list(self, async_client: AsyncOpenAI) -> None:
async def test_path_params_list(self, async_client: AsyncOpenAI) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `fine_tuning_job_id` but received ''"):
await async_client.fine_tuning.jobs.checkpoints.with_raw_response.list(
"",
fine_tuning_job_id="",
)
28 changes: 14 additions & 14 deletions tests/api_resources/fine_tuning/test_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def test_method_list(self, client: OpenAI) -> None:
@parametrize
def test_method_list_with_all_params(self, client: OpenAI) -> None:
job = client.fine_tuning.jobs.list(
after="string",
after="after",
limit=0,
metadata={"foo": "string"},
)
Expand Down Expand Up @@ -232,23 +232,23 @@ def test_path_params_cancel(self, client: OpenAI) -> None:
@parametrize
def test_method_list_events(self, client: OpenAI) -> None:
job = client.fine_tuning.jobs.list_events(
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F",
)
assert_matches_type(SyncCursorPage[FineTuningJobEvent], job, path=["response"])

@parametrize
def test_method_list_events_with_all_params(self, client: OpenAI) -> None:
job = client.fine_tuning.jobs.list_events(
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
after="string",
fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F",
after="after",
limit=0,
)
assert_matches_type(SyncCursorPage[FineTuningJobEvent], job, path=["response"])

@parametrize
def test_raw_response_list_events(self, client: OpenAI) -> None:
response = client.fine_tuning.jobs.with_raw_response.list_events(
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F",
)

assert response.is_closed is True
Expand All @@ -259,7 +259,7 @@ def test_raw_response_list_events(self, client: OpenAI) -> None:
@parametrize
def test_streaming_response_list_events(self, client: OpenAI) -> None:
with client.fine_tuning.jobs.with_streaming_response.list_events(
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -273,7 +273,7 @@ def test_streaming_response_list_events(self, client: OpenAI) -> None:
def test_path_params_list_events(self, client: OpenAI) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `fine_tuning_job_id` but received ''"):
client.fine_tuning.jobs.with_raw_response.list_events(
"",
fine_tuning_job_id="",
)

@parametrize
Expand Down Expand Up @@ -502,7 +502,7 @@ async def test_method_list(self, async_client: AsyncOpenAI) -> None:
@parametrize
async def test_method_list_with_all_params(self, async_client: AsyncOpenAI) -> None:
job = await async_client.fine_tuning.jobs.list(
after="string",
after="after",
limit=0,
metadata={"foo": "string"},
)
Expand Down Expand Up @@ -569,23 +569,23 @@ async def test_path_params_cancel(self, async_client: AsyncOpenAI) -> None:
@parametrize
async def test_method_list_events(self, async_client: AsyncOpenAI) -> None:
job = await async_client.fine_tuning.jobs.list_events(
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F",
)
assert_matches_type(AsyncCursorPage[FineTuningJobEvent], job, path=["response"])

@parametrize
async def test_method_list_events_with_all_params(self, async_client: AsyncOpenAI) -> None:
job = await async_client.fine_tuning.jobs.list_events(
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
after="string",
fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F",
after="after",
limit=0,
)
assert_matches_type(AsyncCursorPage[FineTuningJobEvent], job, path=["response"])

@parametrize
async def test_raw_response_list_events(self, async_client: AsyncOpenAI) -> None:
response = await async_client.fine_tuning.jobs.with_raw_response.list_events(
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F",
)

assert response.is_closed is True
Expand All @@ -596,7 +596,7 @@ async def test_raw_response_list_events(self, async_client: AsyncOpenAI) -> None
@parametrize
async def test_streaming_response_list_events(self, async_client: AsyncOpenAI) -> None:
async with async_client.fine_tuning.jobs.with_streaming_response.list_events(
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -610,7 +610,7 @@ async def test_streaming_response_list_events(self, async_client: AsyncOpenAI) -
async def test_path_params_list_events(self, async_client: AsyncOpenAI) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `fine_tuning_job_id` but received ''"):
await async_client.fine_tuning.jobs.with_raw_response.list_events(
"",
fine_tuning_job_id="",
)

@parametrize
Expand Down
12 changes: 0 additions & 12 deletions tests/api_resources/vector_stores/test_file_batches.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from openai import OpenAI, AsyncOpenAI
from tests.utils import assert_matches_type
from openai._utils import assert_signatures_in_sync
from openai.pagination import SyncCursorPage, AsyncCursorPage
from openai.types.vector_stores import (
VectorStoreFile,
Expand Down Expand Up @@ -451,14 +450,3 @@ async def test_path_params_list_files(self, async_client: AsyncOpenAI) -> None:
batch_id="",
vector_store_id="vector_store_id",
)


@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"])
def test_create_and_poll_method_in_sync(sync: bool, client: OpenAI, async_client: AsyncOpenAI) -> None:
checking_client: OpenAI | AsyncOpenAI = client if sync else async_client

# ensure helpers do not drift from generated spec
assert_signatures_in_sync(
checking_client.vector_stores.file_batches.create,
checking_client.vector_stores.file_batches.create_and_poll,
)
22 changes: 0 additions & 22 deletions tests/api_resources/vector_stores/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from openai import OpenAI, AsyncOpenAI
from tests.utils import assert_matches_type
from openai._utils import assert_signatures_in_sync
from openai.pagination import SyncPage, AsyncPage, SyncCursorPage, AsyncCursorPage
from openai.types.vector_stores import (
VectorStoreFile,
Expand Down Expand Up @@ -626,24 +625,3 @@ async def test_path_params_content(self, async_client: AsyncOpenAI) -> None:
file_id="",
vector_store_id="vs_abc123",
)


@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"])
def test_create_and_poll_method_in_sync(sync: bool, client: OpenAI, async_client: AsyncOpenAI) -> None:
checking_client: OpenAI | AsyncOpenAI = client if sync else async_client

assert_signatures_in_sync(
checking_client.vector_stores.files.create,
checking_client.vector_stores.files.create_and_poll,
)


@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"])
def test_upload_and_poll_method_in_sync(sync: bool, client: OpenAI, async_client: AsyncOpenAI) -> None:
checking_client: OpenAI | AsyncOpenAI = client if sync else async_client

assert_signatures_in_sync(
checking_client.vector_stores.files.create,
checking_client.vector_stores.files.upload_and_poll,
exclude_params={"file_id", "extra_headers", "extra_query", "extra_body", "timeout"},
)
Loading
Loading