§
    Ý
@g}} ã                  ó  — d dl mZ d dlZd dlmZmZmZmZmZ d dl	m
Z
mZ d dlZd dlZddlmZ ddlmZmZmZmZmZ ddlmZmZmZ dd	lmZ dd
lmZmZ ddlm Z m!Z! ddl"m#Z#m$Z$ ddl%m&Z&m'Z' ddl(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3 ddl4m&Z& ddl5m6Z6 ddl7m8Z8 ddl9m:Z: ddl;m<Z< ddgZ= G d„ de¦  «        Z> G d„ de¦  «        Z? G d„ d¦  «        Z@ G d„ d ¦  «        ZA G d!„ d"¦  «        ZB G d#„ d$¦  «        ZCd*d)„ZDdS )+é    )ÚannotationsN)ÚDictÚListÚUnionÚIterableÚOptional)ÚLiteralÚoverloadé   )Ú_legacy_response)Ú	NOT_GIVENÚBodyÚQueryÚHeadersÚNotGiven)Úrequired_argsÚmaybe_transformÚasync_maybe_transform)Úcached_property)ÚSyncAPIResourceÚAsyncAPIResource)Úto_streamed_response_wrapperÚ"async_to_streamed_response_wrapper)ÚStreamÚAsyncStream)ÚChatCompletionAudioParamÚcompletion_create_params)Úmake_request_options)Ú	ChatModel)ÚChatCompletion)ÚChatCompletionChunk)ÚChatCompletionModality)ÚChatCompletionToolParam)r   )ÚChatCompletionMessageParam)Ú ChatCompletionStreamOptionsParam)Ú$ChatCompletionPredictionContentParam)Ú#ChatCompletionToolChoiceOptionParamÚCompletionsÚAsyncCompletionsc            !      ó¾  — e Zd ZedNd„¦   «         ZedOd„¦   «         ZeeeeeeeeeeeeeeeeeeeeeeeeeeeedddedœdPdC„¦   «         ZeeeeeeeeeeeeeeeeeeeeeeeeeeedddedDœdQdG„¦   «         ZeeeeeeeeeeeeeeeeeeeeeeeeeeedddedDœdRdJ„¦   «         Z e	dd
gg dK¢¦  «        eeeeeeeeeeeeeeeeeeeeeeeeeeedddedœdSdM„¦   «         ZdS )Tr(   ÚreturnÚCompletionsWithRawResponsec                ó    — t          | ¦  «        S ©a  
        This property can be used as a prefix for any HTTP method call to return the
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
        )r,   ©Úselfs    úU/var/www/piapp/venv/lib/python3.11/site-packages/openai/resources/chat/completions.pyÚwith_raw_responsezCompletions.with_raw_response+   s   € õ *¨$Ñ/Ô/Ð/ó    Ú CompletionsWithStreamingResponsec                ó    — t          | ¦  «        S ©zÌ
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/openai/openai-python#with_streaming_response
        )r4   r/   s    r1   Úwith_streaming_responsez#Completions.with_streaming_response5   s   € õ 0°Ñ5Ô5Ð5r3   N©ÚaudioÚfrequency_penaltyÚfunction_callÚ	functionsÚ
logit_biasÚlogprobsÚmax_completion_tokensÚ
max_tokensÚmetadataÚ
modalitiesÚnÚparallel_tool_callsÚ
predictionÚpresence_penaltyÚresponse_formatÚseedÚservice_tierÚstopÚstoreÚstreamÚstream_optionsÚtemperatureÚtool_choiceÚtoolsÚtop_logprobsÚtop_pÚuserÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutÚmessagesú$Iterable[ChatCompletionMessageParam]ÚmodelúUnion[str, ChatModel]r9   ú-Optional[ChatCompletionAudioParam] | NotGivenr:   úOptional[float] | NotGivenr;   ú0completion_create_params.FunctionCall | NotGivenr<   ú6Iterable[completion_create_params.Function] | NotGivenr=   ú#Optional[Dict[str, int]] | NotGivenr>   úOptional[bool] | NotGivenr?   úOptional[int] | NotGivenr@   rA   ú#Optional[Dict[str, str]] | NotGivenrB   ú1Optional[List[ChatCompletionModality]] | NotGivenrC   rD   úbool | NotGivenrE   ú9Optional[ChatCompletionPredictionContentParam] | NotGivenrF   rG   ú2completion_create_params.ResponseFormat | NotGivenrH   rI   ú/Optional[Literal['auto', 'default']] | NotGivenrJ   ú*Union[Optional[str], List[str]] | NotGivenrK   rL   ú#Optional[Literal[False]] | NotGivenrM   ú5Optional[ChatCompletionStreamOptionsParam] | NotGivenrN   rO   ú.ChatCompletionToolChoiceOptionParam | NotGivenrP   ú,Iterable[ChatCompletionToolParam] | NotGivenrQ   rR   rS   ústr | NotGivenrT   úHeaders | NonerU   úQuery | NonerV   úBody | NonerW   ú'float | httpx.Timeout | None | NotGivenr    c       !        ó   — dS ©a-  Creates a model response for the given chat conversation.

        Learn more in the
        [text generation](https://platform.openai.com/docs/guides/text-generation),
        [vision](https://platform.openai.com/docs/guides/vision), and
        [audio](https://platform.openai.com/docs/guides/audio) guides.

        Args:
          messages: A list of messages comprising the conversation so far. Depending on the
              [model](https://platform.openai.com/docs/models) you use, different message
              types (modalities) are supported, like
              [text](https://platform.openai.com/docs/guides/text-generation),
              [images](https://platform.openai.com/docs/guides/vision), and
              [audio](https://platform.openai.com/docs/guides/audio).

          model: ID of the model to use. See the
              [model endpoint compatibility](https://platform.openai.com/docs/models#model-endpoint-compatibility)
              table for details on which models work with the Chat API.

          audio: Parameters for audio output. Required when audio output is requested with
              `modalities: ["audio"]`.
              [Learn more](https://platform.openai.com/docs/guides/audio).

          frequency_penalty: Number between -2.0 and 2.0. Positive values penalize new tokens based on their
              existing frequency in the text so far, decreasing the model's likelihood to
              repeat the same line verbatim.

              [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation)

          function_call: Deprecated in favor of `tool_choice`.

              Controls which (if any) function is called by the model. `none` means the model
              will not call a function and instead generates a message. `auto` means the model
              can pick between generating a message or calling a function. Specifying a
              particular function via `{"name": "my_function"}` forces the model to call that
              function.

              `none` is the default when no functions are present. `auto` is the default if
              functions are present.

          functions: Deprecated in favor of `tools`.

              A list of functions the model may generate JSON inputs for.

          logit_bias: Modify the likelihood of specified tokens appearing in the completion.

              Accepts a JSON object that maps tokens (specified by their token ID in the
              tokenizer) to an associated bias value from -100 to 100. Mathematically, the
              bias is added to the logits generated by the model prior to sampling. The exact
              effect will vary per model, but values between -1 and 1 should decrease or
              increase likelihood of selection; values like -100 or 100 should result in a ban
              or exclusive selection of the relevant token.

          logprobs: Whether to return log probabilities of the output tokens or not. If true,
              returns the log probabilities of each output token returned in the `content` of
              `message`.

          max_completion_tokens: An upper bound for the number of tokens that can be generated for a completion,
              including visible output tokens and
              [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).

          max_tokens: The maximum number of [tokens](/tokenizer) that can be generated in the chat
              completion. This value can be used to control
              [costs](https://openai.com/api/pricing/) for text generated via API.

              This value is now deprecated in favor of `max_completion_tokens`, and is not
              compatible with
              [o1 series models](https://platform.openai.com/docs/guides/reasoning).

          metadata: Developer-defined tags and values used for filtering completions in the
              [dashboard](https://platform.openai.com/chat-completions).

          modalities: Output types that you would like the model to generate for this request. Most
              models are capable of generating text, which is the default:

              `["text"]`

              The `gpt-4o-audio-preview` model can also be used to
              [generate audio](https://platform.openai.com/docs/guides/audio). To request that
              this model generate both text and audio responses, you can use:

              `["text", "audio"]`

          n: How many chat completion choices to generate for each input message. Note that
              you will be charged based on the number of generated tokens across all of the
              choices. Keep `n` as `1` to minimize costs.

          parallel_tool_calls: Whether to enable
              [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
              during tool use.

          prediction: Static predicted output content, such as the content of a text file that is
              being regenerated.

          presence_penalty: Number between -2.0 and 2.0. Positive values penalize new tokens based on
              whether they appear in the text so far, increasing the model's likelihood to
              talk about new topics.

              [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation)

          response_format: An object specifying the format that the model must output. Compatible with
              [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
              [GPT-4o mini](https://platform.openai.com/docs/models#gpt-4o-mini),
              [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4) and
              all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.

              Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
              Outputs which ensures the model will match your supplied JSON schema. Learn more
              in the
              [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

              Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
              message the model generates is valid JSON.

              **Important:** when using JSON mode, you **must** also instruct the model to
              produce JSON yourself via a system or user message. Without this, the model may
              generate an unending stream of whitespace until the generation reaches the token
              limit, resulting in a long-running and seemingly "stuck" request. Also note that
              the message content may be partially cut off if `finish_reason="length"`, which
              indicates the generation exceeded `max_tokens` or the conversation exceeded the
              max context length.

          seed: This feature is in Beta. If specified, our system will make a best effort to
              sample deterministically, such that repeated requests with the same `seed` and
              parameters should return the same result. Determinism is not guaranteed, and you
              should refer to the `system_fingerprint` response parameter to monitor changes
              in the backend.

          service_tier: Specifies the latency tier to use for processing the request. This parameter is
              relevant for customers subscribed to the scale tier service:

              - If set to 'auto', and the Project is Scale tier enabled, the system will
                utilize scale tier credits until they are exhausted.
              - If set to 'auto', and the Project is not Scale tier enabled, the request will
                be processed using the default service tier with a lower uptime SLA and no
                latency guarentee.
              - If set to 'default', the request will be processed using the default service
                tier with a lower uptime SLA and no latency guarentee.
              - When not set, the default behavior is 'auto'.

              When this parameter is set, the response body will include the `service_tier`
              utilized.

          stop: Up to 4 sequences where the API will stop generating further tokens.

          store: Whether or not to store the output of this chat completion request for use in
              our [model distillation](https://platform.openai.com/docs/guides/distillation)
              or [evals](https://platform.openai.com/docs/guides/evals) products.

          stream: If set, partial message deltas will be sent, like in ChatGPT. Tokens will be
              sent as data-only
              [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)
              as they become available, with the stream terminated by a `data: [DONE]`
              message.
              [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).

          stream_options: Options for streaming response. Only set this when you set `stream: true`.

          temperature: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
              make the output more random, while lower values like 0.2 will make it more
              focused and deterministic.

              We generally recommend altering this or `top_p` but not both.

          tool_choice: Controls which (if any) tool is called by the model. `none` means the model will
              not call any tool and instead generates a message. `auto` means the model can
              pick between generating a message or calling one or more tools. `required` means
              the model must call one or more tools. Specifying a particular tool via
              `{"type": "function", "function": {"name": "my_function"}}` forces the model to
              call that tool.

              `none` is the default when no tools are present. `auto` is the default if tools
              are present.

          tools: A list of tools the model may call. Currently, only functions are supported as a
              tool. Use this to provide a list of functions the model may generate JSON inputs
              for. A max of 128 functions are supported.

          top_logprobs: An integer between 0 and 20 specifying the number of most likely tokens to
              return at each token position, each with an associated log probability.
              `logprobs` must be set to `true` if this parameter is used.

          top_p: An alternative to sampling with temperature, called nucleus sampling, where the
              model considers the results of the tokens with top_p probability mass. So 0.1
              means only the tokens comprising the top 10% probability mass are considered.

              We generally recommend altering this or `temperature` but not both.

          user: A unique identifier representing your end-user, which can help OpenAI to monitor
              and detect abuse.
              [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        N© ©"r0   rX   rZ   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   s"                                     r1   ÚcreatezCompletions.create>   ó
   € ð` 	ˆr3   ©r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   úLiteral[True]úStream[ChatCompletionChunk]c       !        ó   — dS ©a-  Creates a model response for the given chat conversation.

        Learn more in the
        [text generation](https://platform.openai.com/docs/guides/text-generation),
        [vision](https://platform.openai.com/docs/guides/vision), and
        [audio](https://platform.openai.com/docs/guides/audio) guides.

        Args:
          messages: A list of messages comprising the conversation so far. Depending on the
              [model](https://platform.openai.com/docs/models) you use, different message
              types (modalities) are supported, like
              [text](https://platform.openai.com/docs/guides/text-generation),
              [images](https://platform.openai.com/docs/guides/vision), and
              [audio](https://platform.openai.com/docs/guides/audio).

          model: ID of the model to use. See the
              [model endpoint compatibility](https://platform.openai.com/docs/models#model-endpoint-compatibility)
              table for details on which models work with the Chat API.

          stream: If set, partial message deltas will be sent, like in ChatGPT. Tokens will be
              sent as data-only
              [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)
              as they become available, with the stream terminated by a `data: [DONE]`
              message.
              [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).

          audio: Parameters for audio output. Required when audio output is requested with
              `modalities: ["audio"]`.
              [Learn more](https://platform.openai.com/docs/guides/audio).

          frequency_penalty: Number between -2.0 and 2.0. Positive values penalize new tokens based on their
              existing frequency in the text so far, decreasing the model's likelihood to
              repeat the same line verbatim.

              [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation)

          function_call: Deprecated in favor of `tool_choice`.

              Controls which (if any) function is called by the model. `none` means the model
              will not call a function and instead generates a message. `auto` means the model
              can pick between generating a message or calling a function. Specifying a
              particular function via `{"name": "my_function"}` forces the model to call that
              function.

              `none` is the default when no functions are present. `auto` is the default if
              functions are present.

          functions: Deprecated in favor of `tools`.

              A list of functions the model may generate JSON inputs for.

          logit_bias: Modify the likelihood of specified tokens appearing in the completion.

              Accepts a JSON object that maps tokens (specified by their token ID in the
              tokenizer) to an associated bias value from -100 to 100. Mathematically, the
              bias is added to the logits generated by the model prior to sampling. The exact
              effect will vary per model, but values between -1 and 1 should decrease or
              increase likelihood of selection; values like -100 or 100 should result in a ban
              or exclusive selection of the relevant token.

          logprobs: Whether to return log probabilities of the output tokens or not. If true,
              returns the log probabilities of each output token returned in the `content` of
              `message`.

          max_completion_tokens: An upper bound for the number of tokens that can be generated for a completion,
              including visible output tokens and
              [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).

          max_tokens: The maximum number of [tokens](/tokenizer) that can be generated in the chat
              completion. This value can be used to control
              [costs](https://openai.com/api/pricing/) for text generated via API.

              This value is now deprecated in favor of `max_completion_tokens`, and is not
              compatible with
              [o1 series models](https://platform.openai.com/docs/guides/reasoning).

          metadata: Developer-defined tags and values used for filtering completions in the
              [dashboard](https://platform.openai.com/chat-completions).

          modalities: Output types that you would like the model to generate for this request. Most
              models are capable of generating text, which is the default:

              `["text"]`

              The `gpt-4o-audio-preview` model can also be used to
              [generate audio](https://platform.openai.com/docs/guides/audio). To request that
              this model generate both text and audio responses, you can use:

              `["text", "audio"]`

          n: How many chat completion choices to generate for each input message. Note that
              you will be charged based on the number of generated tokens across all of the
              choices. Keep `n` as `1` to minimize costs.

          parallel_tool_calls: Whether to enable
              [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
              during tool use.

          prediction: Static predicted output content, such as the content of a text file that is
              being regenerated.

          presence_penalty: Number between -2.0 and 2.0. Positive values penalize new tokens based on
              whether they appear in the text so far, increasing the model's likelihood to
              talk about new topics.

              [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation)

          response_format: An object specifying the format that the model must output. Compatible with
              [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
              [GPT-4o mini](https://platform.openai.com/docs/models#gpt-4o-mini),
              [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4) and
              all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.

              Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
              Outputs which ensures the model will match your supplied JSON schema. Learn more
              in the
              [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

              Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
              message the model generates is valid JSON.

              **Important:** when using JSON mode, you **must** also instruct the model to
              produce JSON yourself via a system or user message. Without this, the model may
              generate an unending stream of whitespace until the generation reaches the token
              limit, resulting in a long-running and seemingly "stuck" request. Also note that
              the message content may be partially cut off if `finish_reason="length"`, which
              indicates the generation exceeded `max_tokens` or the conversation exceeded the
              max context length.

          seed: This feature is in Beta. If specified, our system will make a best effort to
              sample deterministically, such that repeated requests with the same `seed` and
              parameters should return the same result. Determinism is not guaranteed, and you
              should refer to the `system_fingerprint` response parameter to monitor changes
              in the backend.

          service_tier: Specifies the latency tier to use for processing the request. This parameter is
              relevant for customers subscribed to the scale tier service:

              - If set to 'auto', and the Project is Scale tier enabled, the system will
                utilize scale tier credits until they are exhausted.
              - If set to 'auto', and the Project is not Scale tier enabled, the request will
                be processed using the default service tier with a lower uptime SLA and no
                latency guarentee.
              - If set to 'default', the request will be processed using the default service
                tier with a lower uptime SLA and no latency guarentee.
              - When not set, the default behavior is 'auto'.

              When this parameter is set, the response body will include the `service_tier`
              utilized.

          stop: Up to 4 sequences where the API will stop generating further tokens.

          store: Whether or not to store the output of this chat completion request for use in
              our [model distillation](https://platform.openai.com/docs/guides/distillation)
              or [evals](https://platform.openai.com/docs/guides/evals) products.

          stream_options: Options for streaming response. Only set this when you set `stream: true`.

          temperature: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
              make the output more random, while lower values like 0.2 will make it more
              focused and deterministic.

              We generally recommend altering this or `top_p` but not both.

          tool_choice: Controls which (if any) tool is called by the model. `none` means the model will
              not call any tool and instead generates a message. `auto` means the model can
              pick between generating a message or calling one or more tools. `required` means
              the model must call one or more tools. Specifying a particular tool via
              `{"type": "function", "function": {"name": "my_function"}}` forces the model to
              call that tool.

              `none` is the default when no tools are present. `auto` is the default if tools
              are present.

          tools: A list of tools the model may call. Currently, only functions are supported as a
              tool. Use this to provide a list of functions the model may generate JSON inputs
              for. A max of 128 functions are supported.

          top_logprobs: An integer between 0 and 20 specifying the number of most likely tokens to
              return at each token position, each with an associated log probability.
              `logprobs` must be set to `true` if this parameter is used.

          top_p: An alternative to sampling with temperature, called nucleus sampling, where the
              model considers the results of the tokens with top_p probability mass. So 0.1
              means only the tokens comprising the top 10% probability mass are considered.

              We generally recommend altering this or `temperature` but not both.

          user: A unique identifier representing your end-user, which can help OpenAI to monitor
              and detect abuse.
              [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        Nru   ©"r0   rX   rZ   rL   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   s"                                     r1   rw   zCompletions.create0  rx   r3   Úboolú,ChatCompletion | Stream[ChatCompletionChunk]c       !        ó   — dS r}   ru   r~   s"                                     r1   rw   zCompletions.create"  rx   r3   ©rX   rZ   rL   ú3Optional[Literal[False]] | Literal[True] | NotGivenc       !        óZ  — t          |¦  «         |                      dt          i d|“d|“d|“d|“d|“d|“d|“d	|“d
|	“d|
“d|“d|“d|“d|“d|“d|“d|“||||||||||||dœ¥t          j        ¦  «        t          ||| |!¬¦  «        t          |pdt          t                   ¬¦  «        S ©Nz/chat/completionsrX   rZ   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   )rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   )rT   rU   rV   rW   F)ÚbodyÚoptionsÚcast_torL   Ú
stream_cls)	Úvalidate_response_formatÚ_postr   r   ÚCompletionCreateParamsr   r    r   r!   rv   s"                                     r1   rw   zCompletions.create  sƒ  € õP 	! Ñ1Ô1Ð1Ø�zŠzØÝ ðØ ðà˜Uðð ˜Uðð (Ð):ð	ð
 $ ]ðð   ðð ! *ðð  ðð ,Ð-Bðð ! *ðð  ðð ! *ðð ˜ðð *Ð+>ðð ! *ðð  'Ð(8ð!ð" & ð#ð$ !Ø$0Ø Ø"Ø$Ø&4Ø#.Ø#.Ø"Ø$0Ø"Ø ð;ð ð õ> )Ô?ñA!ô !õD )Ø+¸ÐQ[Ðelðñ ô õ #Ø�?˜UÝÕ1Ô2ðS ñ *
ô *
ð *	
r3   )r+   r,   )r+   r4   ©DrX   rY   rZ   r[   r9   r\   r:   r]   r;   r^   r<   r_   r=   r`   r>   ra   r?   rb   r@   rb   rA   rc   rB   rd   rC   rb   rD   re   rE   rf   rF   r]   rG   rg   rH   rb   rI   rh   rJ   ri   rK   ra   rL   rj   rM   rk   rN   r]   rO   rl   rP   rm   rQ   rb   rR   r]   rS   rn   rT   ro   rU   rp   rV   rq   rW   rr   r+   r    )DrX   rY   rZ   r[   rL   rz   r9   r\   r:   r]   r;   r^   r<   r_   r=   r`   r>   ra   r?   rb   r@   rb   rA   rc   rB   rd   rC   rb   rD   re   rE   rf   rF   r]   rG   rg   rH   rb   rI   rh   rJ   ri   rK   ra   rM   rk   rN   r]   rO   rl   rP   rm   rQ   rb   rR   r]   rS   rn   rT   ro   rU   rp   rV   rq   rW   rr   r+   r{   )DrX   rY   rZ   r[   rL   r   r9   r\   r:   r]   r;   r^   r<   r_   r=   r`   r>   ra   r?   rb   r@   rb   rA   rc   rB   rd   rC   rb   rD   re   rE   rf   rF   r]   rG   rg   rH   rb   rI   rh   rJ   ri   rK   ra   rM   rk   rN   r]   rO   rl   rP   rm   rQ   rb   rR   r]   rS   rn   rT   ro   rU   rp   rV   rq   rW   rr   r+   r€   )DrX   rY   rZ   r[   r9   r\   r:   r]   r;   r^   r<   r_   r=   r`   r>   ra   r?   rb   r@   rb   rA   rc   rB   rd   rC   rb   rD   re   rE   rf   rF   r]   rG   rg   rH   rb   rI   rh   rJ   ri   rK   ra   rL   rƒ   rM   rk   rN   r]   rO   rl   rP   rm   rQ   rb   rR   r]   rS   rn   rT   ro   rU   rp   rV   rq   rW   rr   r+   r€   ©
Ú__name__Ú
__module__Ú__qualname__r   r2   r7   r
   r   rw   r   ru   r3   r1   r(   r(   *   s»  € € € € € Øð0ð 0ð 0ñ „_ð0ð ð6ð 6ð 6ñ „_ð6ð ð @IØ8AØJSØLUØ:CØ.7Ø:CØ/8Ø8AØHQØ&/Ø/8ØPYØ7@ØNWØ)2ØHQØ;DØ+4Ø6?ØPYØ2;ØFOØ>GØ1:Ø,5Ø(ð )-Ø$(Ø"&Ø;DðKoð oð oð oð oñ „Xðoðb ð @IØ8AØJSØLUØ:CØ.7Ø:CØ/8Ø8AØHQØ&/Ø/8ØPYØ7@ØNWØ)2ØHQØ;DØ+4ØPYØ2;ØFOØ>GØ1:Ø,5Ø(ð )-Ø$(Ø"&Ø;DðKoð oð oð oð oñ „Xðoðb ð @IØ8AØJSØLUØ:CØ.7Ø:CØ/8Ø8AØHQØ&/Ø/8ØPYØ7@ØNWØ)2ØHQØ;DØ+4ØPYØ2;ØFOØ>GØ1:Ø,5Ø(ð )-Ø$(Ø"&Ø;DðKoð oð oð oð oñ „Xðoðb €]�J Ð(Ð*IÐ*IÐ*IÑJÔJð @IØ8AØJSØLUØ:CØ.7Ø:CØ/8Ø8AØHQØ&/Ø/8ØPYØ7@ØNWØ)2ØHQØ;DØ+4ØFOØPYØ2;ØFOØ>GØ1:Ø,5Ø(ð )-Ø$(Ø"&Ø;DðKR
ð R
ð R
ð R
ð R
ñ KÔJðR
ð R
ð R
r3   c            !      ó¾  — e Zd ZedNd„¦   «         ZedOd„¦   «         ZeeeeeeeeeeeeeeeeeeeeeeeeeeeedddedœdPdC„¦   «         ZeeeeeeeeeeeeeeeeeeeeeeeeeeedddedDœdQdG„¦   «         ZeeeeeeeeeeeeeeeeeeeeeeeeeeedddedDœdRdJ„¦   «         Z e	dd
gg dK¢¦  «        eeeeeeeeeeeeeeeeeeeeeeeeeeedddedœdSdM„¦   «         ZdS )Tr)   r+   ÚAsyncCompletionsWithRawResponsec                ó    — t          | ¦  «        S r.   )r“   r/   s    r1   r2   z"AsyncCompletions.with_raw_responsek  s   € õ /¨tÑ4Ô4Ð4r3   Ú%AsyncCompletionsWithStreamingResponsec                ó    — t          | ¦  «        S r6   )r•   r/   s    r1   r7   z(AsyncCompletions.with_streaming_responseu  s   € õ 5°TÑ:Ô:Ð:r3   Nr8   rX   rY   rZ   r[   r9   r\   r:   r]   r;   r^   r<   r_   r=   r`   r>   ra   r?   rb   r@   rA   rc   rB   rd   rC   rD   re   rE   rf   rF   rG   rg   rH   rI   rh   rJ   ri   rK   rL   rj   rM   rk   rN   rO   rl   rP   rm   rQ   rR   rS   rn   rT   ro   rU   rp   rV   rq   rW   rr   r    c       !      ƒ  ó
   K  — dS rt   ru   rv   s"                                     r1   rw   zAsyncCompletions.create~  ó   è è € ð` 	ˆr3   ry   rz   ú AsyncStream[ChatCompletionChunk]c       !      ƒ  ó
   K  — dS r}   ru   r~   s"                                     r1   rw   zAsyncCompletions.createp  r˜   r3   r   ú1ChatCompletion | AsyncStream[ChatCompletionChunk]c       !      ƒ  ó
   K  — dS r}   ru   r~   s"                                     r1   rw   zAsyncCompletions.createb  r˜   r3   r‚   rƒ   c       !      ƒ  óv  K  — t          |¦  «         |                      dt          i d|“d|“d|“d|“d|“d|“d|“d	|“d
|	“d|
“d|“d|“d|“d|“d|“d|“d|“||||||||||||dœ¥t          j        ¦  «        ƒ d {V —†t          ||| |!¬¦  «        t          |pdt          t                   ¬¦  «        ƒ d {V —†S r…   )	rŠ   r‹   r   r   rŒ   r   r    r   r!   rv   s"                                     r1   rw   zAsyncCompletions.createT  sÃ  è è € õP 	! Ñ1Ô1Ð1Ø—Z’ZØÝ,ðØ ðà˜Uðð ˜Uðð (Ð):ð	ð
 $ ]ðð   ðð ! *ðð  ðð ,Ð-Bðð ! *ðð  ðð ! *ðð ˜ðð *Ð+>ðð ! *ðð  'Ð(8ð!ð" & ð#ð$ !Ø$0Ø Ø"Ø$Ø&4Ø#.Ø#.Ø"Ø$0Ø"Ø ð;ð ð õ> )Ô?ñA!ô !ð !ð !ð !ð !ð !ð !õD )Ø+¸ÐQ[Ðelðñ ô õ #Ø�?˜UÝ"Õ#6Ô7ðS  ñ *
ô *
ð *
ð *
ð *
ð *
ð *
ð *
ð *	
r3   )r+   r“   )r+   r•   r�   )DrX   rY   rZ   r[   rL   rz   r9   r\   r:   r]   r;   r^   r<   r_   r=   r`   r>   ra   r?   rb   r@   rb   rA   rc   rB   rd   rC   rb   rD   re   rE   rf   rF   r]   rG   rg   rH   rb   rI   rh   rJ   ri   rK   ra   rM   rk   rN   r]   rO   rl   rP   rm   rQ   rb   rR   r]   rS   rn   rT   ro   rU   rp   rV   rq   rW   rr   r+   r™   )DrX   rY   rZ   r[   rL   r   r9   r\   r:   r]   r;   r^   r<   r_   r=   r`   r>   ra   r?   rb   r@   rb   rA   rc   rB   rd   rC   rb   rD   re   rE   rf   rF   r]   rG   rg   rH   rb   rI   rh   rJ   ri   rK   ra   rM   rk   rN   r]   rO   rl   rP   rm   rQ   rb   rR   r]   rS   rn   rT   ro   rU   rp   rV   rq   rW   rr   r+   r›   )DrX   rY   rZ   r[   r9   r\   r:   r]   r;   r^   r<   r_   r=   r`   r>   ra   r?   rb   r@   rb   rA   rc   rB   rd   rC   rb   rD   re   rE   rf   rF   r]   rG   rg   rH   rb   rI   rh   rJ   ri   rK   ra   rL   rƒ   rM   rk   rN   r]   rO   rl   rP   rm   rQ   rb   rR   r]   rS   rn   rT   ro   rU   rp   rV   rq   rW   rr   r+   r›   rŽ   ru   r3   r1   r)   r)   j  s»  € € € € € Øð5ð 5ð 5ñ „_ð5ð ð;ð ;ð ;ñ „_ð;ð ð @IØ8AØJSØLUØ:CØ.7Ø:CØ/8Ø8AØHQØ&/Ø/8ØPYØ7@ØNWØ)2ØHQØ;DØ+4Ø6?ØPYØ2;ØFOØ>GØ1:Ø,5Ø(ð )-Ø$(Ø"&Ø;DðKoð oð oð oð oñ „Xðoðb ð @IØ8AØJSØLUØ:CØ.7Ø:CØ/8Ø8AØHQØ&/Ø/8ØPYØ7@ØNWØ)2ØHQØ;DØ+4ØPYØ2;ØFOØ>GØ1:Ø,5Ø(ð )-Ø$(Ø"&Ø;DðKoð oð oð oð oñ „Xðoðb ð @IØ8AØJSØLUØ:CØ.7Ø:CØ/8Ø8AØHQØ&/Ø/8ØPYØ7@ØNWØ)2ØHQØ;DØ+4ØPYØ2;ØFOØ>GØ1:Ø,5Ø(ð )-Ø$(Ø"&Ø;DðKoð oð oð oð oñ „Xðoðb €]�J Ð(Ð*IÐ*IÐ*IÑJÔJð @IØ8AØJSØLUØ:CØ.7Ø:CØ/8Ø8AØHQØ&/Ø/8ØPYØ7@ØNWØ)2ØHQØ;DØ+4ØFOØPYØ2;ØFOØ>GØ1:Ø,5Ø(ð )-Ø$(Ø"&Ø;DðKR
ð R
ð R
ð R
ð R
ñ KÔJðR
ð R
ð R
r3   c                  ó   — e Zd Zdd„ZdS )r,   Úcompletionsr(   r+   ÚNonec                óP   — || _         t          j        |j        ¦  «        | _        d S ©N)Ú_completionsr   Úto_raw_response_wrapperrw   ©r0   rŸ   s     r1   Ú__init__z#CompletionsWithRawResponse.__init__«  s(   € Ø'ˆÔå&Ô>ØÔñ
ô 
ˆŒˆˆr3   N©rŸ   r(   r+   r    ©r�   r�   r‘   r¦   ru   r3   r1   r,   r,   ª  ó(   € € € € € ð
ð 
ð 
ð 
ð 
ð 
r3   r,   c                  ó   — e Zd Zdd„ZdS )r“   rŸ   r)   r+   r    c                óP   — || _         t          j        |j        ¦  «        | _        d S r¢   )r£   r   Úasync_to_raw_response_wrapperrw   r¥   s     r1   r¦   z(AsyncCompletionsWithRawResponse.__init__´  s(   € Ø'ˆÔå&ÔDØÔñ
ô 
ˆŒˆˆr3   N©rŸ   r)   r+   r    r¨   ru   r3   r1   r“   r“   ³  r©   r3   r“   c                  ó   — e Zd Zdd„ZdS )r4   rŸ   r(   r+   r    c                óF   — || _         t          |j        ¦  «        | _        d S r¢   )r£   r   rw   r¥   s     r1   r¦   z)CompletionsWithStreamingResponse.__init__½  s%   € Ø'ˆÔå2ØÔñ
ô 
ˆŒˆˆr3   Nr§   r¨   ru   r3   r1   r4   r4   ¼  r©   r3   r4   c                  ó   — e Zd Zdd„ZdS )r•   rŸ   r)   r+   r    c                óF   — || _         t          |j        ¦  «        | _        d S r¢   )r£   r   rw   r¥   s     r1   r¦   z.AsyncCompletionsWithStreamingResponse.__init__Æ  s%   € Ø'ˆÔå8ØÔñ
ô 
ˆŒˆˆr3   Nr­   r¨   ru   r3   r1   r•   r•   Å  r©   r3   r•   rG   Úobjectr+   r    c                ó„   — t          j        | ¦  «        r)t          | t          j        ¦  «        rt          d¦  «        ‚d S d S )NzzYou tried to pass a `BaseModel` class to `chat.completions.create()`; You must use `beta.chat.completions.parse()` instead)ÚinspectÚisclassÚ
issubclassÚpydanticÚ	BaseModelÚ	TypeError)rG   s    r1   rŠ   rŠ   Î  sT   € Ý„�Ñ'Ô'ð 
­J°ÍÔHZÑ,[Ô,[ð 
Ýð Iñ
ô 
ð 	
ð
ð 
ð 
ð 
r3   )rG   r²   r+   r    )EÚ
__future__r   r´   Útypingr   r   r   r   r   Útyping_extensionsr	   r
   Úhttpxr·   Ú r   Ú_typesr   r   r   r   r   Ú_utilsr   r   r   Ú_compatr   Ú	_resourcer   r   Ú	_responser   r   Ú
_streamingr   r   Ú
types.chatr   r   Ú_base_clientr   Útypes.chat_modelr   Útypes.chat.chat_completionr    Ú types.chat.chat_completion_chunkr!   Ú#types.chat.chat_completion_modalityr"   Ú%types.chat.chat_completion_tool_paramr#   Ú&types.chat.chat_completion_audio_paramÚ(types.chat.chat_completion_message_paramr$   Ú/types.chat.chat_completion_stream_options_paramr%   Ú3types.chat.chat_completion_prediction_content_paramr&   Ú3types.chat.chat_completion_tool_choice_option_paramr'   Ú__all__r(   r)   r,   r“   r4   r•   rŠ   ru   r3   r1   ú<module>rÒ      s`  ðð #Ð "Ð "Ð "Ð "Ð "à €€€Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø /Ð /Ð /Ð /Ð /Ð /Ð /Ð /à €€€Ø €€€à  Ð  Ð  Ð  Ð  Ð  Ø ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?ðð ð ð ð ð ð ð ð ð ð
 'Ð &Ð &Ð &Ð &Ð &Ø :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ø YÐ YÐ YÐ YÐ YÐ YÐ YÐ YØ -Ð -Ð -Ð -Ð -Ð -Ð -Ð -ðð ð ð ð ð ð ð ð 1Ð 0Ð 0Ð 0Ð 0Ð 0Ø )Ð )Ð )Ð )Ð )Ð )Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø CÐ CÐ CÐ CÐ CÐ CØ IÐ IÐ IÐ IÐ IÐ IØ LÐ LÐ LÐ LÐ LÐ LØ NÐ NÐ NÐ NÐ NÐ NØ RÐ RÐ RÐ RÐ RÐ RØ _Ð _Ð _Ð _Ð _Ð _Ø gÐ gÐ gÐ gÐ gÐ gØ fÐ fÐ fÐ fÐ fÐ fàÐ,Ð
-€ð}
ð }
ð }
ð }
ð }
�/ñ }
ô }
ð }
ð@}
ð }
ð }
ð }
ð }
Ð'ñ }
ô }
ð }
ð@
ð 
ð 
ð 
ð 
ñ 
ô 
ð 
ð
ð 
ð 
ð 
ð 
ñ 
ô 
ð 
ð
ð 
ð 
ð 
ð 
ñ 
ô 
ð 
ð
ð 
ð 
ð 
ð 
ñ 
ô 
ð 
ð
ð 
ð 
ð 
ð 
ð 
r3   