o
    6ti                      @   sh   d dl Z d dlZd dlZG dd dZdd Zdededed	dfd
dZdddZe	dkr2e  dS dS )    Nc                   @   s   e Zd Zdd ZdS )FunctionTagc                 C   s
   || _ d S )N)value)selfr    r   c/home/ubuntu/.local/lib/python3.10/site-packages/lm_eval/tasks/afrobench/injongointent/gen_utils.py__init__   s   
zFunctionTag.__init__N)__name__
__module____qualname__r   r   r   r   r   r      s    r   c                 C   sv   dd | ddd | ddd | dd| d	| d
| dd | d	d| dd | dd}||  S )NzSGiven the text: '{{text}}', determine the correct intent from the following list: [, z(]. Only output one intent from the list.zVAnalyze the text: '{{text}}'. Choose the most appropriate intent from these options: [z)]. Respond with only the selected intent.zYou are a linguistic analyst trained to understand user intent. Based on the text: '{{text}}', choose the intent that best matches from this list: [z]. Return only the intent.z
You are a z* linguistic analyst trained to understand z user intent. Based on the zGtext: '{{text}}', choose the intent that best matches from this list: [zThe following text is in z*: '{{text}}'. Given the list of intents: [zP], identify the intent expressed in the text. Return only the identified intent.prompt_1prompt_2prompt_3prompt_4prompt_5)join)modelangintent
prompt_mapr   r   r   prompt_func   s   r   
output_dir	overwriter   returnc              	   C   sz  g }i ddddddddd	d
dddddddddddddddddddddd d!d"}g d#}|  D ]k}z[d$| d%}d$| d&| }d'}	|	||t||| |d(}
tj|  d)| d*d+ t|  d)| d)| |ryd,nd-d.d/}|d0 tj|
|d*d1 W d2   n1 sw   Y  W q? ty   |	| Y q?w t
|d3krtd4d5| d2S )6z
    Generate a yaml file for each language.

    :param output_dir: The directory to output the files to.
    :param overwrite: Whether to overwrite files if they already exist.
    amhAmhariceweEwehauHausaiboIgbokinKinyarwandalinLingalalugLugandaormOromosnaShonasotSothoswaSwahilitwiTwiwolWolofxhoXhosayorYorubazulZuluengEnglish)(alarmbalancebill_balancebook_flight
book_hotelcalendar_updatecancel_reservation
car_rentalconfirm_reservation	cook_timeexchange_rate	food_lastfreeze_accountingredients_listinterest_rateinternational_visa	make_callmeal_suggestionmin_paymentpay_bill
pin_change
play_music	plug_typereciperestaurant_reservationrestaurant_reviewsrestaurant_suggestionshare_locationshopping_list_updatespending_historytexttimetimezonetransactionstransfer	translatetravel_notificationtravel_suggestionupdate_playlistweatherinjongointent_z.yaml_injongointent)includetaskdataset_namedoc_to_text/T)exist_okwxutf8)encodingz# Generated by utils.py
)allow_unicodeNr   zJFiles were not created because they already exist (use --overwrite flag): r   )keysr   osmakedirsopenwriteyamldumpFileExistsErrorappendlenr   )r   r   r   err	languagesintentsr   	file_name	task_nameyaml_templateyaml_detailsfr   r   r   gen_lang_yamls   s   	
+

r   c                  C   s`   t  } | jddddd | jdddd	 | jd
dg ddd |  }t|j|j|jd dS )z9Parse CLI args and generate language-specific yaml files.z--overwriteT
store_truez%Overwrite files if they already exist)defaultactionhelpz--output-dirz./z Directory to write yaml files to)r   r   z--moder   r   zPrompt number)r   choicesr   )r   r   r   N)argparseArgumentParseradd_argument
parse_argsr   r   r   r   )parserargsr   r   r   main   s(   r   __main__)r   N)
r   rt   rx   r   r   strboolr   r   r   r   r   r   r   <module>   s    
h
