o
    CjiS@                     @  s"  d dl mZ d dlZd dlmZmZmZmZmZm	Z	m
Z
mZ d dlmZmZ d dlmZmZmZmZmZmZmZ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!m"Z"m#Z#m$Z$m%Z% dd	l&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z, dd
l-m.Z.m/Z/ ddl-m0Z1 ddl-m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9 ddl:m;Z; ddgZ<e	dZ=eG dd deZ>G dd dej?Z?d7ddZ@d8d d!ZAd9d"d#ZBd:d%d&ZCere?Z0n	G d'd de1e?Z0e.rd d(lmDZD d:d)d*ZEnesG d+d, d,e0ee= ZFd:d-d*ZEd;d/d0ZGG d1d2 d2ed3d4ZHeG d5d6 d6ej?ZIdS )<    )annotationsN)TYPE_CHECKINGAnyTypeUnionGenericTypeVarCallablecast)datedatetime)	UnpackLiteralClassVarProtocolRequired	TypedDictfinaloverrideruntime_checkable)	FieldInfo   )	BodyIncExQueryModelTHeadersTimeoutNotGiven
AnyMappingHttpxRequestFiles)is_listis_given
is_mapping
parse_dateparse_datetimestrip_not_given)PYDANTIC_V2
ConfigDict)GenericModel)get_argsis_union	parse_obj
get_originis_literal_typeget_model_configget_model_fieldsfield_get_default)RAW_RESPONSE_HEADER	BaseModelr)   _Tc                   @  s   e Zd ZU ded< dS )_ConfigProtocolboolallow_population_by_field_nameN__name__
__module____qualname____annotations__ r=   r=   e/var/www/html/Resume-Parser/resume-parser-inhouse/venv/lib/python3.10/site-packages/openai/_models.pyr5   <   s   
 r5   c                      s   e Zd ZU ereddZded< need0ddZ	G d	d
 d
e
jZed1ddZee	d2d3ddZes9eZesgedddddddddd	d4 fd)d*Zedddddddddd+	d5 fd.d/Z  ZS   ZS )6r3   allow)extraClassVar[ConfigDict]model_configreturnset[str]c                 C  s   | j S N)__fields_set__selfr=   r=   r>   model_fields_setF   s   zBaseModel.model_fields_setc                   @  s   e Zd ZU ejjZded< dS )zBaseModel.Configr   r@   N)r9   r:   r;   pydanticExtrar?   r@   r<   r=   r=   r=   r>   ConfigL   s   
 rL   strc                 C  s   |    d| d dS )N(z, ))__repr_name____repr_str__rG   r=   r=   r>   __str__O   s   zBaseModel.__str__NclsType[ModelT]_fields_setset[str] | Nonevaluesobjectr   c                 K  sD  |  | }i }t| }t|tr|jn|d}|d u rt }t| }| D ].\}}	|	j	}
|
d u s8|
|vr:|r:|}
|
|v rOt
||
 |	|
d||< || q't|	||< q'i }| D ]\}
}|
|vrttrk|||
< q\||
 |||
< q\t|d| trt|dd  t|d| t|d| |S |  t|d| |S )Npopulate_by_name)valuefieldkey__dict____pydantic_private____pydantic_extra____pydantic_fields_set__rF   )__new__r/   
isinstancer5   r7   getsetr0   itemsalias_construct_fieldaddr1   r'   rX   __setattr___init_private_attributes)rS   rU   rW   mfields_valuesconfigrY   model_fieldsnamer[   r\   _extrarZ   r=   r=   r>   	constructV   sF   


zBaseModel.constructpythonFT)	modeincludeexcludeby_aliasexclude_unsetexclude_defaultsexclude_none
round_tripwarningsrs   Literal['json', 'python'] | strrt   r   ru   rv   r6   rw   rx   ry   rz   r{   dict[str, Any]c       	   
        sH   |dkrt d|dkrt d|	dkrt dt j||||||dS )a  Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump

            Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

            Args:
                mode: The mode in which `to_python` should run.
                    If mode is 'json', the dictionary will only contain JSON serializable types.
                    If mode is 'python', the dictionary may contain any Python objects.
                include: A list of fields to include in the output.
                exclude: A list of fields to exclude from the output.
                by_alias: Whether to use the field's alias in the dictionary key if defined.
                exclude_unset: Whether to exclude fields that are unset or None from the output.
                exclude_defaults: Whether to exclude fields that are set to their default value from the output.
                exclude_none: Whether to exclude fields that have a value of `None` from the output.
                round_trip: Whether to enable serialization and deserialization round-trip support.
                warnings: Whether to log warnings when invalid fields are encountered.

            Returns:
                A dictionary representation of the model.
            rr   z%mode is only supported in Pydantic v2F+round_trip is only supported in Pydantic v2T)warnings is only supported in Pydantic v2)rt   ru   rv   rw   rx   ry   )
ValueErrorsuperdict)
rH   rs   rt   ru   rv   rw   rx   ry   rz   r{   	__class__r=   r>   
model_dump   s   "zBaseModel.model_dump)	indentrt   ru   rv   rw   rx   ry   rz   r{   r   
int | Nonec       	   
   	     s:   |dkrt d|	dkrt dt j|||||||dS )a  Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json

            Generates a JSON representation of the model using Pydantic's `to_json` method.

            Args:
                indent: Indentation to use in the JSON output. If None is passed, the output will be compact.
                include: Field(s) to include in the JSON output. Can take either a string or set of strings.
                exclude: Field(s) to exclude from the JSON output. Can take either a string or set of strings.
                by_alias: Whether to serialize using field aliases.
                exclude_unset: Whether to exclude fields that have not been explicitly set.
                exclude_defaults: Whether to exclude fields that have the default value.
                exclude_none: Whether to exclude fields that have a value of `None`.
                round_trip: Whether to use serialization/deserialization between JSON and class instance.
                warnings: Whether to show any warnings that occurred during serialization.

            Returns:
                A JSON string representation of the model.
            Fr~   Tr   )r   rt   ru   rv   rw   rx   ry   )r   r   json)
rH   r   rt   ru   rv   rw   rx   ry   rz   r{   r   r=   r>   model_dump_json   s    zBaseModel.model_dump_json)rC   rD   )rC   rM   rE   )rS   rT   rU   rV   rW   rX   rC   r   )rs   r|   rt   r   ru   r   rv   r6   rw   r6   rx   r6   ry   r6   rz   r6   r{   r6   rC   r}   )r   r   rt   r   ru   r   rv   r6   rw   r6   rx   r6   ry   r6   rz   r6   r{   r6   rC   rM   )r9   r:   r;   r'   r(   rB   r<   propertyr   rI   rJ   
BaseConfigrL   rR   classmethodrq   r   model_constructr   r   __classcell__r=   r=   r   r>   r3   A   sN   
 70rZ   rX   r[   r   r\   rM   rC   c                 C  sJ   | d u rt |S tr|j}ntt|j}|d u rtd| t| |dS )Nz"Unexpected field type is None for rZ   type_)r1   r'   
annotationr
   typeouter_type_RuntimeErrorconstruct_type)rZ   r[   r\   r   r=   r=   r>   rg      s   rg   r   r   r6   c                 C  sH   t | p| }t| rt| D ]	}t|r dS qdS t|tp#t|tS )zWReturns whether or not the given type is either a `BaseModel` or a union of `BaseModel`TF)r-   r+   r*   is_basemodel
issubclassr3   r)   )r   originvariantr=   r=   r>   r   
  s   r   c              	     s  t p}t}t|r=zt| dW S  ty   Y nw |D ]}z	t| |dW   S  ty5   Y q!w td |tkrXt| sG| S t\}fdd| 	 D S t
st|tsft|trt| rsfdd| D S t| rttrjdi | S ttjdi | S |tkrt| s| S |d   fd	d| D S |tkrt| trt| }|| kr| S |S | S tkrzt| W S  ty   |  Y S w tkrzt| W S  ty   |  Y S w | S )zLoose coercion to the expected type with construction of nested values.

    If the given value does not match the expected type then it is returned as-is.
    r   rZ   r   z0Could not convert data into a valid instance of c                   s   i | ]\}}|t | d qS r   r   ).0r\   item)
items_typer=   r>   
<dictcomp>6  s    z"construct_type.<locals>.<dictcomp>c                   s.   g | ]}t |rtt jd i |n|qS )r=   )r#   r
   r   rq   r   entryr   r=   r>   
<listcomp>:  s   . z"construct_type.<locals>.<listcomp>r   c                   s   g | ]}t | d qS r   r   r   )
inner_typer=   r>   r   G  s    Nr=   )r-   r*   r+   validate_type	Exceptionr   r   r   r#   re   r.   r   r3   r)   r!   rq   r
   r   listfloatrb   intr   r%   r   r$   )rZ   r   r   argsr   _coercedr=   )r   r   r   r>   r     sh   



r   type[_T]c                 C  s8   t | rt| tjrttt| |S ttt| |dS )z@Strict validation that the given value matches the expected typer   )	inspectisclassr   rJ   r3   r
   r4   r,   _validate_non_model_typer   r=   r=   r>   r   a  s   r   c                   @  s   e Zd ZdS )r)   N)r9   r:   r;   r=   r=   r=   r>   r)   o  s    )TypeAdapterc                 C  s   t | |S rE   )r   validate_pythonr   r=   r=   r>   r   v  s   r   c                   @     e Zd ZU dZded< dS )	RootModelzUsed as a placeholder to easily convert runtime types to a Pydantic format
        to provide validation.

        For example:
        ```py
        validated = RootModel[int](__root__='5').__root__
        # validated: 5
        ```
        r4   __root__N)r9   r:   r;   __doc__r<   r=   r=   r=   r>   r   {  s   
 
r   c                 C  s   t | |}tt|jS rE   )_create_pydantic_modelvalidater
   r4   r   )r   rZ   modelr=   r=   r>   r     s   Type[RootModel[_T]]c                 C  s   t |  S rE   )r   r   r=   r=   r>   r     s   r   c                   @  s^   e Zd ZU ded< ded< ded< ded< ded	< d
ed< ded< ded< ded< ded< dS )FinalRequestOptionsInputzRequired[str]methodurlr   paramsr   headersr   max_retrieszfloat | Timeout | NonetimeoutzHttpxRequestFiles | NonefilesrM   idempotency_keyr   	json_datar   
extra_jsonNr8   r=   r=   r=   r>   r     s   
 r   F)totalc                      s   e Zd ZU ded< ded< i Zded< e Zded< e Zded	< e Zd
ed< dZ	ded< dZ
ded< e Zded< dZded< dZded< erSeddZded< n	G dd dejZd*dd Zd+d"d#Ze	d,d- fd(d)ZesyeZ  ZS   ZS ).FinalRequestOptionsrM   r   r   r   r   zUnion[Headers, NotGiven]r   zUnion[int, NotGiven]r   z%Union[float, Timeout, None, NotGiven]r   NzUnion[HttpxRequestFiles, None]r   zUnion[str, None]r   z%Union[Callable[[Any], Any], NotGiven]post_parserzUnion[Body, None]r   zUnion[AnyMapping, None]r   T)arbitrary_types_allowedrA   rB   c                   @  r   )zFinalRequestOptions.ConfigTr6   r   N)r9   r:   r;   r   r<   r=   r=   r=   r>   rL     s   
 rL   r   rC   c                 C  s   t | jtr|S | jS rE   )rb   r   r   )rH   r   r=   r=   r>   get_max_retries  s   z#FinalRequestOptions.get_max_retriesNonec                 C  s:   t | jsd S | jtri | j| _| jt d S d S rE   )r"   r   rc   r2   poprG   r=   r=   r>   _strip_raw_response_header  s   
z.FinalRequestOptions._strip_raw_response_headerrU   rV   rW    Unpack[FinalRequestOptionsInput]c                   sD   dd |  D }trt j|fi |S ttt j|fi |S )Nc                 S  s   i | ]	\}}|t |qS r=   )r&   )r   r\   rZ   r=   r=   r>   r     s    z1FinalRequestOptions.construct.<locals>.<dictcomp>)re   r'   r   r   r
   r   rq   )rS   rU   rW   kwargsr   r=   r>   rq     s   zFinalRequestOptions.construct)r   r   rC   r   )rC   r   rE   )rU   rV   rW   r   rC   r   )r9   r:   r;   r<   r   r   r   r   r   r   r   r   r   r   r'   r(   rB   rJ   r   rL   r   r   r   rq   r   r   r   r=   r=   r   r>   r     s.   
 

r   )rZ   rX   r[   r   r\   rM   rC   rX   )r   r   rC   r6   )rZ   rX   r   r   rC   rX   )r   r   rZ   rX   rC   r4   )r   r4   rC   r   )J
__future__r   r   typingr   r   r   r   r   r   r	   r
   r   r   typing_extensionsr   r   r   r   r   r   r   r   r   rJ   pydantic.genericspydantic.fieldsr   _typesr   r   r   r   r   r   r   r   r    _utilsr!   r"   r#   r$   r%   r&   _compatr'   r(   r)   BaseGenericModelr*   r+   r,   r-   r.   r/   r0   r1   
_constantsr2   __all__r4   r5   r3   rg   r   r   r   r   r   r   r   r   r   r=   r=   r=   r>   <module>   sJ    (,, (
 
;


J


