o
    -i                     @   sn   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lmZ ed Ze
eG dd	 d	Zd
S )    )AnyLiteral)model_validator)	dataclass)Self)config)	safe_hash)autoxgrammarguidanceoutlineszlm-format-enforcerc                   @   s   e Zd ZU dZdZeed< 	 dZeed< 	 dZ	eed< 	 dZ
eed< 	 dZeed	< 	 dZeed
< 	 dZeed< 	 defddZedddefddZdS )StructuredOutputsConfigzBDataclass which contains structured outputs config for the engine.r	   backendFdisable_fallbackdisable_any_whitespacedisable_additional_properties reasoning_parserreasoning_parser_pluginenable_in_reasoningreturnc                 C   s    g }t t| dd }|S )a  
        WARNING: Whenever a new field is added to this config,
        ensure that it is included in the factors list if
        it affects the computation graph.

        Provide a hash that uniquely identifies all the configs
        that affect the structure of the computation
        graph from input ids/embeddings to the final hidden states,
        excluding anything before input ids/embeddings and after
        the final hidden states.
        F)usedforsecurity)r   strencode	hexdigest)selffactorshash_str r   [/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/vllm/config/structured_outputs.pycompute_hash0   s   z$StructuredOutputsConfig.compute_hashafter)modec                 C   s4   | j r| jdvrtd| jr| jdkrtd| S )N)r
   r   zLdisable_any_whitespace is only supported for xgrammar and guidance backends.r   zIdisable_additional_properties is only supported for the guidance backend.)r   r   
ValueErrorr   )r   r   r   r   "_validate_structured_output_configB   s   z:StructuredOutputsConfig._validate_structured_output_configN)__name__
__module____qualname____doc__r   StructuredOutputsBackend__annotations__r   boolr   r   r   r   r   r   r    r   r   r$   r   r   r   r   r      s&   
 r   N)typingr   r   pydanticr   pydantic.dataclassesr   typing_extensionsr   vllm.config.utilsr   vllm.utils.hashingr   r)   r   r   r   r   r   <module>   s   