From 935542863bd02a6ec7d7a0509567b5e5326014f0 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Fri, 14 Jun 2024 23:26:06 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API --- .stats.yml | 2 +- src/together/_client.py | 4 +- src/together/resources/chat/completions.py | 46 +++++++++++-------- src/together/resources/completions.py | 28 +++++------ src/together/resources/embeddings.py | 4 +- src/together/resources/files.py | 16 +++---- src/together/resources/fine_tune.py | 24 +++++----- src/together/resources/images.py | 4 +- src/together/resources/models.py | 4 +- .../types/chat/completion_create_params.py | 8 ++-- .../types/completion_create_params.py | 2 +- tests/test_client.py | 4 +- 12 files changed, 77 insertions(+), 69 deletions(-) diff --git a/.stats.yml b/.stats.yml index d332e906..02655e1f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 15 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2FTogetherAI-6e975518a2563fdb57394133f1ed9dfe426a2cf5d2fef793fd139627c93df4aa.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2FTogetherAI-5934359dd4fbab352cb5042ffbf08374bd3d3b6bc0550fd09797de44626772fe.yml diff --git a/src/together/_client.py b/src/together/_client.py index 9e4fd0c3..77e8d83a 100644 --- a/src/together/_client.py +++ b/src/together/_client.py @@ -131,7 +131,7 @@ def qs(self) -> Querystring: @override def auth_headers(self) -> dict[str, str]: api_key = self.api_key - return {"Authorization": f"Bearer {api_key}"} + return {"Authorization": api_key} @property @override @@ -313,7 +313,7 @@ def qs(self) -> Querystring: @override def auth_headers(self) -> dict[str, str]: api_key = self.api_key - return {"Authorization": f"Bearer {api_key}"} + return {"Authorization": api_key} @property @override diff --git a/src/together/resources/chat/completions.py b/src/together/resources/chat/completions.py index d45eac28..43125d39 100644 --- a/src/together/resources/chat/completions.py +++ b/src/together/resources/chat/completions.py @@ -50,7 +50,7 @@ def create( model: str, echo: bool | NotGiven = NOT_GIVEN, frequency_penalty: float | NotGiven = NOT_GIVEN, - logit_bias: Dict[str, object] | NotGiven = NOT_GIVEN, + logit_bias: Dict[str, float] | NotGiven = NOT_GIVEN, logprobs: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, min_p: float | NotGiven = NOT_GIVEN, @@ -74,7 +74,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ChatCompletion: """ - Creates a model response for the given chat conversation. + Query a chat model. Args: messages: A list of messages comprising the conversation so far. @@ -114,7 +114,8 @@ def create( stop: A list of string sequences that will truncate (stop) inference text output. stream: If set, tokens are returned as Server-Sent Events as they are made available. - Stream terminates with `data: [DONE]` + Stream terminates with `data: [DONE]`. If false, return a single JSON object + containing the results. temperature: Determines the degree of randomness in the response. @@ -147,7 +148,7 @@ def create( stream: Literal[True], echo: bool | NotGiven = NOT_GIVEN, frequency_penalty: float | NotGiven = NOT_GIVEN, - logit_bias: Dict[str, object] | NotGiven = NOT_GIVEN, + logit_bias: Dict[str, float] | NotGiven = NOT_GIVEN, logprobs: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, min_p: float | NotGiven = NOT_GIVEN, @@ -170,7 +171,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Stream[ChatCompletionChunk]: """ - Creates a model response for the given chat conversation. + Query a chat model. Args: messages: A list of messages comprising the conversation so far. @@ -178,7 +179,8 @@ def create( model: The name of the model to query. stream: If set, tokens are returned as Server-Sent Events as they are made available. - Stream terminates with `data: [DONE]` + Stream terminates with `data: [DONE]`. If false, return a single JSON object + containing the results. echo: If set, the response will contain the prompt, and will also return prompt logprobs if set with logprobs. @@ -243,7 +245,7 @@ def create( stream: bool, echo: bool | NotGiven = NOT_GIVEN, frequency_penalty: float | NotGiven = NOT_GIVEN, - logit_bias: Dict[str, object] | NotGiven = NOT_GIVEN, + logit_bias: Dict[str, float] | NotGiven = NOT_GIVEN, logprobs: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, min_p: float | NotGiven = NOT_GIVEN, @@ -266,7 +268,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ChatCompletion | Stream[ChatCompletionChunk]: """ - Creates a model response for the given chat conversation. + Query a chat model. Args: messages: A list of messages comprising the conversation so far. @@ -274,7 +276,8 @@ def create( model: The name of the model to query. stream: If set, tokens are returned as Server-Sent Events as they are made available. - Stream terminates with `data: [DONE]` + Stream terminates with `data: [DONE]`. If false, return a single JSON object + containing the results. echo: If set, the response will contain the prompt, and will also return prompt logprobs if set with logprobs. @@ -338,7 +341,7 @@ def create( model: str, echo: bool | NotGiven = NOT_GIVEN, frequency_penalty: float | NotGiven = NOT_GIVEN, - logit_bias: Dict[str, object] | NotGiven = NOT_GIVEN, + logit_bias: Dict[str, float] | NotGiven = NOT_GIVEN, logprobs: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, min_p: float | NotGiven = NOT_GIVEN, @@ -414,7 +417,7 @@ async def create( model: str, echo: bool | NotGiven = NOT_GIVEN, frequency_penalty: float | NotGiven = NOT_GIVEN, - logit_bias: Dict[str, object] | NotGiven = NOT_GIVEN, + logit_bias: Dict[str, float] | NotGiven = NOT_GIVEN, logprobs: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, min_p: float | NotGiven = NOT_GIVEN, @@ -438,7 +441,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ChatCompletion: """ - Creates a model response for the given chat conversation. + Query a chat model. Args: messages: A list of messages comprising the conversation so far. @@ -478,7 +481,8 @@ async def create( stop: A list of string sequences that will truncate (stop) inference text output. stream: If set, tokens are returned as Server-Sent Events as they are made available. - Stream terminates with `data: [DONE]` + Stream terminates with `data: [DONE]`. If false, return a single JSON object + containing the results. temperature: Determines the degree of randomness in the response. @@ -511,7 +515,7 @@ async def create( stream: Literal[True], echo: bool | NotGiven = NOT_GIVEN, frequency_penalty: float | NotGiven = NOT_GIVEN, - logit_bias: Dict[str, object] | NotGiven = NOT_GIVEN, + logit_bias: Dict[str, float] | NotGiven = NOT_GIVEN, logprobs: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, min_p: float | NotGiven = NOT_GIVEN, @@ -534,7 +538,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncStream[ChatCompletionChunk]: """ - Creates a model response for the given chat conversation. + Query a chat model. Args: messages: A list of messages comprising the conversation so far. @@ -542,7 +546,8 @@ async def create( model: The name of the model to query. stream: If set, tokens are returned as Server-Sent Events as they are made available. - Stream terminates with `data: [DONE]` + Stream terminates with `data: [DONE]`. If false, return a single JSON object + containing the results. echo: If set, the response will contain the prompt, and will also return prompt logprobs if set with logprobs. @@ -607,7 +612,7 @@ async def create( stream: bool, echo: bool | NotGiven = NOT_GIVEN, frequency_penalty: float | NotGiven = NOT_GIVEN, - logit_bias: Dict[str, object] | NotGiven = NOT_GIVEN, + logit_bias: Dict[str, float] | NotGiven = NOT_GIVEN, logprobs: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, min_p: float | NotGiven = NOT_GIVEN, @@ -630,7 +635,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ChatCompletion | AsyncStream[ChatCompletionChunk]: """ - Creates a model response for the given chat conversation. + Query a chat model. Args: messages: A list of messages comprising the conversation so far. @@ -638,7 +643,8 @@ async def create( model: The name of the model to query. stream: If set, tokens are returned as Server-Sent Events as they are made available. - Stream terminates with `data: [DONE]` + Stream terminates with `data: [DONE]`. If false, return a single JSON object + containing the results. echo: If set, the response will contain the prompt, and will also return prompt logprobs if set with logprobs. @@ -702,7 +708,7 @@ async def create( model: str, echo: bool | NotGiven = NOT_GIVEN, frequency_penalty: float | NotGiven = NOT_GIVEN, - logit_bias: Dict[str, object] | NotGiven = NOT_GIVEN, + logit_bias: Dict[str, float] | NotGiven = NOT_GIVEN, logprobs: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, min_p: float | NotGiven = NOT_GIVEN, diff --git a/src/together/resources/completions.py b/src/together/resources/completions.py index fb72ecb8..163fc7a5 100644 --- a/src/together/resources/completions.py +++ b/src/together/resources/completions.py @@ -48,7 +48,7 @@ def create( prompt: str, echo: bool | NotGiven = NOT_GIVEN, frequency_penalty: float | NotGiven = NOT_GIVEN, - logit_bias: Dict[str, object] | NotGiven = NOT_GIVEN, + logit_bias: Dict[str, float] | NotGiven = NOT_GIVEN, logprobs: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, min_p: float | NotGiven = NOT_GIVEN, @@ -69,7 +69,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Completion: """ - Creates a completion for the provided prompt and parameters + Query a language, code, or image model. Args: model: The name of the model to query. @@ -136,7 +136,7 @@ def create( stream: Literal[True], echo: bool | NotGiven = NOT_GIVEN, frequency_penalty: float | NotGiven = NOT_GIVEN, - logit_bias: Dict[str, object] | NotGiven = NOT_GIVEN, + logit_bias: Dict[str, float] | NotGiven = NOT_GIVEN, logprobs: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, min_p: float | NotGiven = NOT_GIVEN, @@ -156,7 +156,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Stream[Completion]: """ - Creates a completion for the provided prompt and parameters + Query a language, code, or image model. Args: model: The name of the model to query. @@ -223,7 +223,7 @@ def create( stream: bool, echo: bool | NotGiven = NOT_GIVEN, frequency_penalty: float | NotGiven = NOT_GIVEN, - logit_bias: Dict[str, object] | NotGiven = NOT_GIVEN, + logit_bias: Dict[str, float] | NotGiven = NOT_GIVEN, logprobs: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, min_p: float | NotGiven = NOT_GIVEN, @@ -243,7 +243,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Completion | Stream[Completion]: """ - Creates a completion for the provided prompt and parameters + Query a language, code, or image model. Args: model: The name of the model to query. @@ -309,7 +309,7 @@ def create( prompt: str, echo: bool | NotGiven = NOT_GIVEN, frequency_penalty: float | NotGiven = NOT_GIVEN, - logit_bias: Dict[str, object] | NotGiven = NOT_GIVEN, + logit_bias: Dict[str, float] | NotGiven = NOT_GIVEN, logprobs: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, min_p: float | NotGiven = NOT_GIVEN, @@ -379,7 +379,7 @@ async def create( prompt: str, echo: bool | NotGiven = NOT_GIVEN, frequency_penalty: float | NotGiven = NOT_GIVEN, - logit_bias: Dict[str, object] | NotGiven = NOT_GIVEN, + logit_bias: Dict[str, float] | NotGiven = NOT_GIVEN, logprobs: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, min_p: float | NotGiven = NOT_GIVEN, @@ -400,7 +400,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Completion: """ - Creates a completion for the provided prompt and parameters + Query a language, code, or image model. Args: model: The name of the model to query. @@ -467,7 +467,7 @@ async def create( stream: Literal[True], echo: bool | NotGiven = NOT_GIVEN, frequency_penalty: float | NotGiven = NOT_GIVEN, - logit_bias: Dict[str, object] | NotGiven = NOT_GIVEN, + logit_bias: Dict[str, float] | NotGiven = NOT_GIVEN, logprobs: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, min_p: float | NotGiven = NOT_GIVEN, @@ -487,7 +487,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncStream[Completion]: """ - Creates a completion for the provided prompt and parameters + Query a language, code, or image model. Args: model: The name of the model to query. @@ -554,7 +554,7 @@ async def create( stream: bool, echo: bool | NotGiven = NOT_GIVEN, frequency_penalty: float | NotGiven = NOT_GIVEN, - logit_bias: Dict[str, object] | NotGiven = NOT_GIVEN, + logit_bias: Dict[str, float] | NotGiven = NOT_GIVEN, logprobs: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, min_p: float | NotGiven = NOT_GIVEN, @@ -574,7 +574,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Completion | AsyncStream[Completion]: """ - Creates a completion for the provided prompt and parameters + Query a language, code, or image model. Args: model: The name of the model to query. @@ -640,7 +640,7 @@ async def create( prompt: str, echo: bool | NotGiven = NOT_GIVEN, frequency_penalty: float | NotGiven = NOT_GIVEN, - logit_bias: Dict[str, object] | NotGiven = NOT_GIVEN, + logit_bias: Dict[str, float] | NotGiven = NOT_GIVEN, logprobs: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, min_p: float | NotGiven = NOT_GIVEN, diff --git a/src/together/resources/embeddings.py b/src/together/resources/embeddings.py index 75ccf4bd..290c574d 100644 --- a/src/together/resources/embeddings.py +++ b/src/together/resources/embeddings.py @@ -48,7 +48,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Embedding: """ - Creates an embedding vector representing the input text + Query an embedding model for a given string of text. Args: input: A string providing the text for the model to embed. @@ -101,7 +101,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Embedding: """ - Creates an embedding vector representing the input text + Query an embedding model for a given string of text. Args: input: A string providing the text for the model to embed. diff --git a/src/together/resources/files.py b/src/together/resources/files.py index ee055f07..90b95bf1 100644 --- a/src/together/resources/files.py +++ b/src/together/resources/files.py @@ -52,7 +52,7 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FileRetrieveResponse: """ - Retrieve a file + List the metadata for a single uploaded data file. Args: extra_headers: Send extra headers @@ -83,7 +83,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FileListResponse: - """List all files""" + """List the metadata for all uploaded data files.""" return self._get( "/files", options=make_request_options( @@ -104,7 +104,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FileDeleteResponse: """ - Delete a file + Delete a previously uploaded data file. Args: extra_headers: Send extra headers @@ -137,7 +137,7 @@ def content( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> BinaryAPIResponse: """ - Retrieve file content + Get the contents of a single uploaded data file. Args: extra_headers: Send extra headers @@ -181,7 +181,7 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FileRetrieveResponse: """ - Retrieve a file + List the metadata for a single uploaded data file. Args: extra_headers: Send extra headers @@ -212,7 +212,7 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FileListResponse: - """List all files""" + """List the metadata for all uploaded data files.""" return await self._get( "/files", options=make_request_options( @@ -233,7 +233,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FileDeleteResponse: """ - Delete a file + Delete a previously uploaded data file. Args: extra_headers: Send extra headers @@ -266,7 +266,7 @@ async def content( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncBinaryAPIResponse: """ - Retrieve file content + Get the contents of a single uploaded data file. Args: extra_headers: Send extra headers diff --git a/src/together/resources/fine_tune.py b/src/together/resources/fine_tune.py index e3aab276..c75ac6ae 100644 --- a/src/together/resources/fine_tune.py +++ b/src/together/resources/fine_tune.py @@ -57,7 +57,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FineTune: """ - Create a fine-tuning job + Use a model to create a fine-tuning job. Args: model: Name of the base model to run fine-tune job on @@ -117,7 +117,7 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FineTune: """ - Retrieve fine-tune job details + List the metadata for a single fine-tuning job. Args: extra_headers: Send extra headers @@ -148,7 +148,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FineTuneListResponse: - """List fine-tune job history""" + """List the metadata for all fine-tuning jobs.""" return self._get( "/fine-tunes", options=make_request_options( @@ -169,7 +169,7 @@ def cancel( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FineTune: """ - Cancels a running fine-tuning job. + Cancel a currently running fine-tuning job. Args: extra_headers: Send extra headers @@ -204,7 +204,7 @@ def download( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FineTuneDownloadResponse: """ - Downloads a compressed fine-tuned model or checkpoint to local disk. + Download a compressed fine-tuned model or checkpoint to local disk. Args: ft_id: Fine-tune ID to download. A string that starts with `ft-`. @@ -253,7 +253,7 @@ def list_events( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FineTuneEvent: """ - List events of a fine-tune job + List the events for a single fine-tuning job. Args: extra_headers: Send extra headers @@ -303,7 +303,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FineTune: """ - Create a fine-tuning job + Use a model to create a fine-tuning job. Args: model: Name of the base model to run fine-tune job on @@ -363,7 +363,7 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FineTune: """ - Retrieve fine-tune job details + List the metadata for a single fine-tuning job. Args: extra_headers: Send extra headers @@ -394,7 +394,7 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FineTuneListResponse: - """List fine-tune job history""" + """List the metadata for all fine-tuning jobs.""" return await self._get( "/fine-tunes", options=make_request_options( @@ -415,7 +415,7 @@ async def cancel( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FineTune: """ - Cancels a running fine-tuning job. + Cancel a currently running fine-tuning job. Args: extra_headers: Send extra headers @@ -450,7 +450,7 @@ async def download( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FineTuneDownloadResponse: """ - Downloads a compressed fine-tuned model or checkpoint to local disk. + Download a compressed fine-tuned model or checkpoint to local disk. Args: ft_id: Fine-tune ID to download. A string that starts with `ft-`. @@ -499,7 +499,7 @@ async def list_events( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FineTuneEvent: """ - List events of a fine-tune job + List the events for a single fine-tuning job. Args: extra_headers: Send extra headers diff --git a/src/together/resources/images.py b/src/together/resources/images.py index d57d1240..ec9156c6 100644 --- a/src/together/resources/images.py +++ b/src/together/resources/images.py @@ -54,7 +54,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ImageFile: """ - Generate images based on a given prompt using a specified model + Use an image model to generate an image for a given prompt. Args: model: The model to use for image generation. @@ -131,7 +131,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ImageFile: """ - Generate images based on a given prompt using a specified model + Use an image model to generate an image for a given prompt. Args: model: The model to use for image generation. diff --git a/src/together/resources/models.py b/src/together/resources/models.py index edb727fc..da92d7b9 100644 --- a/src/together/resources/models.py +++ b/src/together/resources/models.py @@ -40,7 +40,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ModelListResponse: - """Lists all the available models""" + """Lists all of Together's open-source models""" return self._get( "/models", options=make_request_options( @@ -69,7 +69,7 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ModelListResponse: - """Lists all the available models""" + """Lists all of Together's open-source models""" return await self._get( "/models", options=make_request_options( diff --git a/src/together/types/chat/completion_create_params.py b/src/together/types/chat/completion_create_params.py index d1e404b9..05c6a86a 100644 --- a/src/together/types/chat/completion_create_params.py +++ b/src/together/types/chat/completion_create_params.py @@ -38,7 +38,7 @@ class CompletionCreateParamsBase(TypedDict, total=False): mentioned prior. """ - logit_bias: Dict[str, object] + logit_bias: Dict[str, float] """ The `logit_bias` parameter allows us to adjust the likelihood of specific tokens appearing in the generated output. @@ -128,7 +128,8 @@ class CompletionCreateParamsNonStreaming(CompletionCreateParamsBase): stream: Literal[False] """If set, tokens are returned as Server-Sent Events as they are made available. - Stream terminates with `data: [DONE]` + Stream terminates with `data: [DONE]`. If false, return a single JSON object + containing the results. """ @@ -136,7 +137,8 @@ class CompletionCreateParamsStreaming(CompletionCreateParamsBase): stream: Required[Literal[True]] """If set, tokens are returned as Server-Sent Events as they are made available. - Stream terminates with `data: [DONE]` + Stream terminates with `data: [DONE]`. If false, return a single JSON object + containing the results. """ diff --git a/src/together/types/completion_create_params.py b/src/together/types/completion_create_params.py index f2cb084e..7f4e1fef 100644 --- a/src/together/types/completion_create_params.py +++ b/src/together/types/completion_create_params.py @@ -28,7 +28,7 @@ class CompletionCreateParamsBase(TypedDict, total=False): mentioned prior. """ - logit_bias: Dict[str, object] + logit_bias: Dict[str, float] """ The `logit_bias` parameter allows us to adjust the likelihood of specific tokens appearing in the generated output. diff --git a/tests/test_client.py b/tests/test_client.py index b09a8db0..2e3679a9 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -332,7 +332,7 @@ def test_default_headers_option(self) -> None: def test_validate_headers(self) -> None: client = Together(base_url=base_url, api_key=api_key, _strict_response_validation=True) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - assert request.headers.get("Authorization") == f"Bearer {api_key}" + assert request.headers.get("Authorization") == api_key with pytest.raises(TogetherError): client2 = Together(base_url=base_url, api_key=None, _strict_response_validation=True) @@ -1048,7 +1048,7 @@ def test_default_headers_option(self) -> None: def test_validate_headers(self) -> None: client = AsyncTogether(base_url=base_url, api_key=api_key, _strict_response_validation=True) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - assert request.headers.get("Authorization") == f"Bearer {api_key}" + assert request.headers.get("Authorization") == api_key with pytest.raises(TogetherError): client2 = AsyncTogether(base_url=base_url, api_key=None, _strict_response_validation=True)