Commit 5608d64b
Changed files (7)
src
openai
resources
fine_tuning
jobs
types
beta
threads
tests
api_resources
fine_tuning
src/openai/resources/fine_tuning/jobs/jobs.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import Union, Iterable, Optional
+from typing import Dict, Union, Iterable, Optional
from typing_extensions import Literal
import httpx
@@ -30,6 +30,7 @@ from ...._base_client import (
make_request_options,
)
from ....types.fine_tuning import job_list_params, job_create_params, job_list_events_params
+from ....types.shared_params.metadata import Metadata
from ....types.fine_tuning.fine_tuning_job import FineTuningJob
from ....types.fine_tuning.fine_tuning_job_event import FineTuningJobEvent
@@ -67,6 +68,7 @@ class Jobs(SyncAPIResource):
training_file: str,
hyperparameters: job_create_params.Hyperparameters | NotGiven = NOT_GIVEN,
integrations: Optional[Iterable[job_create_params.Integration]] | NotGiven = NOT_GIVEN,
+ metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
method: job_create_params.Method | NotGiven = NOT_GIVEN,
seed: Optional[int] | NotGiven = NOT_GIVEN,
suffix: Optional[str] | NotGiven = NOT_GIVEN,
@@ -114,6 +116,13 @@ class Jobs(SyncAPIResource):
integrations: A list of integrations to enable for your fine-tuning job.
+ metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
+ for storing additional information about the object in a structured format, and
+ querying for objects via API or the dashboard.
+
+ Keys are strings with a maximum length of 64 characters. Values are strings with
+ a maximum length of 512 characters.
+
method: The method used for fine-tuning.
seed: The seed controls the reproducibility of the job. Passing in the same seed and
@@ -155,6 +164,7 @@ class Jobs(SyncAPIResource):
"training_file": training_file,
"hyperparameters": hyperparameters,
"integrations": integrations,
+ "metadata": metadata,
"method": method,
"seed": seed,
"suffix": suffix,
@@ -208,6 +218,7 @@ class Jobs(SyncAPIResource):
*,
after: str | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
+ metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
@@ -223,6 +234,9 @@ class Jobs(SyncAPIResource):
limit: Number of fine-tuning jobs to retrieve.
+ metadata: Optional metadata filter. To filter, use the syntax `metadata[k]=v`.
+ Alternatively, set `metadata=null` to indicate no metadata.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -243,6 +257,7 @@ class Jobs(SyncAPIResource):
{
"after": after,
"limit": limit,
+ "metadata": metadata,
},
job_list_params.JobListParams,
),
@@ -365,6 +380,7 @@ class AsyncJobs(AsyncAPIResource):
training_file: str,
hyperparameters: job_create_params.Hyperparameters | NotGiven = NOT_GIVEN,
integrations: Optional[Iterable[job_create_params.Integration]] | NotGiven = NOT_GIVEN,
+ metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
method: job_create_params.Method | NotGiven = NOT_GIVEN,
seed: Optional[int] | NotGiven = NOT_GIVEN,
suffix: Optional[str] | NotGiven = NOT_GIVEN,
@@ -412,6 +428,13 @@ class AsyncJobs(AsyncAPIResource):
integrations: A list of integrations to enable for your fine-tuning job.
+ metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
+ for storing additional information about the object in a structured format, and
+ querying for objects via API or the dashboard.
+
+ Keys are strings with a maximum length of 64 characters. Values are strings with
+ a maximum length of 512 characters.
+
method: The method used for fine-tuning.
seed: The seed controls the reproducibility of the job. Passing in the same seed and
@@ -453,6 +476,7 @@ class AsyncJobs(AsyncAPIResource):
"training_file": training_file,
"hyperparameters": hyperparameters,
"integrations": integrations,
+ "metadata": metadata,
"method": method,
"seed": seed,
"suffix": suffix,
@@ -506,6 +530,7 @@ class AsyncJobs(AsyncAPIResource):
*,
after: str | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
+ metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
@@ -521,6 +546,9 @@ class AsyncJobs(AsyncAPIResource):
limit: Number of fine-tuning jobs to retrieve.
+ metadata: Optional metadata filter. To filter, use the syntax `metadata[k]=v`.
+ Alternatively, set `metadata=null` to indicate no metadata.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -541,6 +569,7 @@ class AsyncJobs(AsyncAPIResource):
{
"after": after,
"limit": limit,
+ "metadata": metadata,
},
job_list_params.JobListParams,
),
src/openai/types/beta/threads/runs/file_search_tool_call.py
@@ -15,8 +15,11 @@ __all__ = [
class FileSearchRankingOptions(BaseModel):
- ranker: Literal["default_2024_08_21"]
- """The ranker used for the file search."""
+ ranker: Literal["auto", "default_2024_08_21"]
+ """The ranker to use for the file search.
+
+ If not specified will use the `auto` ranker.
+ """
score_threshold: float
"""The score threshold for the file search.
src/openai/types/fine_tuning/fine_tuning_job.py
@@ -4,6 +4,7 @@ from typing import List, Union, Optional
from typing_extensions import Literal
from ..._models import BaseModel
+from ..shared.metadata import Metadata
from .fine_tuning_job_wandb_integration_object import FineTuningJobWandbIntegrationObject
__all__ = [
@@ -208,5 +209,15 @@ class FineTuningJob(BaseModel):
integrations: Optional[List[FineTuningJobWandbIntegrationObject]] = None
"""A list of integrations to enable for this fine-tuning job."""
+ metadata: Optional[Metadata] = None
+ """Set of 16 key-value pairs that can be attached to an object.
+
+ This can be useful for storing additional information about the object in a
+ structured format, and querying for objects via API or the dashboard.
+
+ Keys are strings with a maximum length of 64 characters. Values are strings with
+ a maximum length of 512 characters.
+ """
+
method: Optional[Method] = None
"""The method used for fine-tuning."""
src/openai/types/fine_tuning/job_create_params.py
@@ -5,6 +5,8 @@ from __future__ import annotations
from typing import List, Union, Iterable, Optional
from typing_extensions import Literal, Required, TypedDict
+from ..shared_params.metadata import Metadata
+
__all__ = [
"JobCreateParams",
"Hyperparameters",
@@ -55,6 +57,16 @@ class JobCreateParams(TypedDict, total=False):
integrations: Optional[Iterable[Integration]]
"""A list of integrations to enable for your fine-tuning job."""
+ metadata: Optional[Metadata]
+ """Set of 16 key-value pairs that can be attached to an object.
+
+ This can be useful for storing additional information about the object in a
+ structured format, and querying for objects via API or the dashboard.
+
+ Keys are strings with a maximum length of 64 characters. Values are strings with
+ a maximum length of 512 characters.
+ """
+
method: Method
"""The method used for fine-tuning."""
src/openai/types/fine_tuning/job_list_params.py
@@ -2,6 +2,7 @@
from __future__ import annotations
+from typing import Dict, Optional
from typing_extensions import TypedDict
__all__ = ["JobListParams"]
@@ -13,3 +14,10 @@ class JobListParams(TypedDict, total=False):
limit: int
"""Number of fine-tuning jobs to retrieve."""
+
+ metadata: Optional[Dict[str, str]]
+ """Optional metadata filter.
+
+ To filter, use the syntax `metadata[k]=v`. Alternatively, set `metadata=null` to
+ indicate no metadata.
+ """
tests/api_resources/fine_tuning/test_jobs.py
@@ -50,6 +50,7 @@ class TestJobs:
},
}
],
+ metadata={"foo": "string"},
method={
"dpo": {
"hyperparameters": {
@@ -148,6 +149,7 @@ class TestJobs:
job = client.fine_tuning.jobs.list(
after="string",
limit=0,
+ metadata={"foo": "string"},
)
assert_matches_type(SyncCursorPage[FineTuningJob], job, path=["response"])
@@ -289,6 +291,7 @@ class TestAsyncJobs:
},
}
],
+ metadata={"foo": "string"},
method={
"dpo": {
"hyperparameters": {
@@ -387,6 +390,7 @@ class TestAsyncJobs:
job = await async_client.fine_tuning.jobs.list(
after="string",
limit=0,
+ metadata={"foo": "string"},
)
assert_matches_type(AsyncCursorPage[FineTuningJob], job, path=["response"])
.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 74
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-5d30684c3118d049682ea30cdb4dbef39b97d51667da484689193dc40162af32.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-b524aed1c2c5c928aa4e2c546f5dbb364e7b4d5027daf05e42e210b05a97c3c6.yml