o
    i                     @  s*   d dl mZ d dlmZmZ dd	d
ZdS )    )annotations)TextPartThinkingPartcontentstrthinking_tagstuple[str, str]returnlist[ThinkingPart | TextPart]c           	      C  s   |\}}g }|  |}|dkr`| d| | |t| d }} |r*|t|d |  |}|dkrM| d| | |t| d }} |t|d n
|t| d d} |  |}|dks| rj|t| d |S )zSplit a string into text and thinking parts.

    Some models don't return the thinking part as a separate part, but rather as a tag in the content.
    This function splits the content into text and thinking parts.
    r   N)r    )findlenappendr   r   )	r   r   	start_tagend_tagpartsstart_indexbefore_think	end_indexthink_content r   `/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/pydantic_ai/_thinking_part.py$split_content_into_text_and_thinking   s$   
"
"
r   N)r   r   r   r   r	   r
   )
__future__r   _annotationspydantic_air   r   r   r   r   r   r   <module>   s    