o
    	Ti &                     @   s   d dl mZmZ d dlmZ d dlmZ d dlmZ eG dd dZ	dd Z
ed	kr@ee	Ze d  Ze
ejejej d
S d
S )    )	dataclassfield)Dataset)HfArgumentParser)get_json_schemac                   @   sZ   e Zd ZU dZedddidZeed< edddidZe	ed	< ed
ddidZ
eed< dS )ScriptArgumentsa  
    Arguments for the script.

    Args:
        test_size (`float`, *optional*, defaults to `0.1`):
            Fraction of the dataset to include in the test split.
        push_to_hub (`bool`, *optional*, defaults to `False`):
            Whether to push the dataset to the Hugging Face Hub.
        repo_id (`str`, *optional*, defaults to `"trl-internal-testing/zen"`):
            Hugging Face repository ID to push the dataset to.
    g?helpz5Fraction of the dataset to include in the test split.)defaultmetadata	test_sizeFz4Whether to push the dataset to the Hugging Face Hub.push_to_hubztrl-internal-testing/toolcallz2Hugging Face repository ID to push the dataset to.repo_idN)__name__
__module____qualname____doc__r   r   float__annotations__r   boolr   str r   r   U/home/ubuntu/.local/lib/python3.10/site-packages/scripts/generate_toolcall_dataset.pyr      s   
 r   c                 C   s
  dt dt fdd}dtdtfdd}dtdt fdd	}d
tdtdtfdd}dtdtdtfdd}dtdtdtfdd}dtdtdtfdd}	dtdtdtt tf fdd}
t|}t|}t|}t|}t|}t|}t|	}	t|
}
tdddd d!d"dd#id$d%gd&d'd"d(d)d d*dgdd+dd d!d,dd-id$d%gd&d'd,d.d)d d/dgdd0dd d!d1dd2id$d%gd&d'd1d3d)d d4dgdd5dd d!d6d7d8d9d$d%gd&d'd6d:d)d d;dgdd<dd d!d=d>d?d@d$d%gd&d'd=dAd)d dBdgddCdd d!dDdEdFdGd$d%gd&d'dDdHd)d dIdgddJdd d!dKdLdMdNd$d%gd&d'dKdOd)d dPdgddQdd d!dRdSdTdUd$d%gd&d'dRdVd)d dWdgg||	g|g|||
g||g||
g|g||	g||
ggdX}|j| dYdZ}|r|| d S d S )[Ndurationreturnc                 S   s   | S )z
        Starts a timer for the specified duration in seconds.

        Args:
            duration: Duration in seconds to set the timer for.

        Returns:
            The duration set for the timer.
        r   )r   r   r   r   start_timer4      
zmain.<locals>.start_timerlocationc                 S      dS )z
        Returns the current time in the specified location.

        Args:
            location: The location for which to get the current time.

        Returns:
            The current time in the specified location.
        06:22:48r   r   r   r   r   get_current_time@   r   zmain.<locals>.get_current_timec                 S   r   )z
        Returns the air quality index for the specified location.

        Args:
            location: The location for which to get the air quality index.

        Returns:
            The air quality index for the specified location.
        5   r   r   r   r   r   get_air_quality_indexL   r   z#main.<locals>.get_air_quality_indextitleartistc                 S   s   ddiS )a  
        Plays music by the specified title and artist.

        Args:
            title: The title of the music to play.
            artist: The artist of the music to play.

        Returns:
            A dictionary indicating the status of the music playback.
        statusPlayingr   r#   r$   r   r   r   
play_musicX      zmain.<locals>.play_musiccitydatec                 S   s
   dddS )a?  
        Returns the weather forecast for the specified city and date.

        Args:
            city: The city for which to get the weather forecast.
            date: The date for which to get the weather forecast.

        Returns:
            A dictionary containing the temperature and weather condition.
           zpartly cloudy)temperature	conditionr   r*   r+   r   r   r   get_weather_forecaste   s   
z"main.<locals>.get_weather_forecastroomstatec                 S   s   d|iS )a  
        Controls the light in the specified room.

        Args:
            room: The room where the light should be controlled.
            state: The desired state of the light ("on" or "off").

        Returns:
            A dictionary indicating the state of the light.
        r2   r   r1   r2   r   r   r   control_lightr   r)   zmain.<locals>.control_lighttimenotec                 S   r   )a  
        Creates a reminder for the specified time and note.

        Args:
            time: The time for the reminder.
            note: The note for the reminder.

        Returns:
            A confirmation message indicating that the reminder has been set.
        z$I'll remind you to call mom at 7 PM.r   r5   r6   r   r   r   create_reminder      zmain.<locals>.create_reminderunitc                 S   r   )a0  
        Returns the wind conditions for the specified city.

        Args:
            city: The city for which to get the wind conditions.
            unit: The unit of measurement for the wind speed (e.g., "mph").

        Returns:
            A tuple containing the wind speed and direction.
        )   NWr   r*   r:   r   r   r   get_wind_conditions   r9   z!main.<locals>.get_wind_conditionsuserzSet a timer for 10 minutes.)rolecontent	assistantfunctionr   iX  )name	arguments)typerC   )r@   
tool_callstool600)r@   rD   rA   zTimer set for 10 minutes.zWhat time is it in Tokyo?r    Tokyor   z&The current time in Tokyo is 06:22 AM.z!Is the air clean today in Lisbon?get_air_qualityzLisbon, Portugal53zThe air quality is moderate.zPlay some music.r(   z	Take FivezDave Brubeckr'   z{'status': 'Playing'}zEnjoy the jazz tunes!z+What's the weather like tomorrow in Berlin?r0   Berlinz
2025-06-16r/   z1{'temperature': 22, 'condition': 'partly cloudy'}u>   Tomorrow in Berlin will be partly cloudy with a high of 22°C.zTurn on the living room lights.r4   zliving roomonr3   z{'state': 'on'}z"The living room lights are now on.zRemind me to call mom at 7 PM.r8   z19:00zCall momr7   zReminder setu,   Okay, I’ll remind you to call mom at 7 PM.z,How strong is the wind in Chicago right now?r>   Chicagomphr=   z
(14, 'NW')z<The wind in Chicago is blowing at 14 mph from the northwest.)messagestoolsF)r   shuffle)	intr   dicttupler   r   	from_dicttrain_test_splitr   )r   r   r   r   r    r"   r(   r0   r4   r8   r>   datasetr   r   r   main2   s   







3>rZ   __main__N)dataclassesr   r   datasetsr   transformersr   transformers.utilsr   r   rZ   r   parserparse_args_into_dataclassesscript_argsr   r   r   r   r   r   r   <module>   s    6