o
    {¿0fA  ã                   @   sT   d dl Z d dlZd dlZd dlZd dlZd dlZdd„ Zdd„ Zdd„ Z	dd	„ Z
dS )
é    Nc                 C   s   d|  d }|S )Nz$Here is the sentence to analyze: """a  """ 
Extract from the sentence into 2 sentences and 2 questions: 
- A sentence relative to food, if it exists 
- A sentence relative to sport & physical activity, if it exists 
- A question relative to food, if this question exists in the sentence 
- A question relative to sport & physical activity, if this question exists in the sentence 
Each sentence must keep the notion of time or date even after splitting. 
Format the result in JSON: {"foodSentence":, "activitySentence":, "foodQuestion":, "activityQuestion":}© )ÚpromptÚ	prepromptr   r   ú:E:\wamp\www\apps\calme\nutritwin\resources\KCALLMPrompt.pyÚgetSplitPrompts   s   	r   c                 C   s"   t  |¡}d| d |  d }|S )Nz"Identify in this list of intents: z , the intents of the prompt: ###z7###. 
 Format the result in JSON format: {intents: []}.)ÚjsonÚdumps)r   Z
intentListÚslistr   r   r   r   ÚgetIntentDetectionPrompt   s   
r
   c                 C   s   d}|t jkr	d}|S )NÚ zºWrite a very short & personalized sentence in french with punctuation, to expose the issue, then providethe cause of this issue. Finally, provide the reminder. Use 'Tu' in the sentence. )ÚKCALLMConstÚINTENT_IMAGE_TO_FOOD)ÚmapperÚintentr   r   r   r   ÚgetD2SPreprompt(   s   
r   c                 C   sX  d}t j t  ¡ d¡}|tjkrI|d }t |¡}t j |d¡}d}t|ddd}	|	 	¡ }|	 
¡  W d   ƒ n1 s<w   Y  | d| ¡}|S |tjkr‚|d }t |¡}t j |d	¡}d}t|ddd}	|	 	¡ }|	 
¡  W d   ƒ |S 1 s{w   Y  |S |tjkr•d
| d d |  d }|S |tjkr|d }t ¡ }
t |
¡}t j |d¡}d}t|ddd}	|	 	¡ }|	 
¡  W d   ƒ n1 sËw   Y  | d¡dkrð| d| ¡}t |¡}| d|¡}| d|¡}|S d}|D ]}t |¡}d| d }|d| d 7 }||7 }qô| d|¡}| d| ¡}|S |tjkr*d}| d| ¡}|S )Nr   ZpromptsÚtypezfood_prompt_RDF.txtÚrzutf-8)Úencodingz$TEXT$zfood_image_prompt.txtz!Here is all known information: 

z

zSAnswer in less than 50 words to this question with a short explanation if needed: "zv"
" + "Mention the data source in the response if it exists. The answer must be in the same language than the questionÚnamezactivity_prompt_RDF.txtZRDFéÿÿÿÿz$SPORT_MAPPING$z$LEVEL_MAPPING$z	activity:z a activity:EnumActivity ;
z    rdfs:label "z is the exact name" .
u      The sentence I'm analyzing is: "$TEXT$".     Extract all food intolerances if it exists.     Map intolerance on ['lactose', 'gluten', 'fruits de mer'].     Extract all food allergies if it exists.     Map allergy on ['fruits de mer', 'poisson', 'fruits Ã  coque'].     Extract age if it exists.     Identify if he is ecologist and map result in a range between 0 and 3.     Identify if he is vegetarian and map result in a range between 0 and 3.     List if it exists food list that I do not like, project on 'foodNoLike' attribute.     List if it exists food list that I like, project on 'foodLike' attribute.     Format the result in JSON in an array of tuples {"ecologist":,"vegetarian":,"intolerances":, "allergies":, "age":, "foodNoLike":}.      Remove markups in the response.)ÚosÚpathÚjoinÚgetcwdr   ÚINTENT_TEXT_TO_FOODr   r   ÚopenÚreadÚcloseÚreplacer   ÚINTENT_NUTRITION_QUESTIONÚINTENT_TEXT_TO_ACTIVITYÚKCALLMActivityUtilitiesÚgetLevelOfActivityÚfindÚKCAProcÚsetSimpleCamelCaseFormatÚINTENT_TEXT_TO_PROFILE)Útextr   r   ÚportraitRobotr   ZpathMainPromptsÚtabZsmapZ
pathPromptÚfZlevelActZslevelZenumSmapÚssZnssZsssr   r   r   ÚgetPreprompt9   s~   


þU
°


þI·I
¾
ÿþþ@Ç

þ
$á

ír,   )r   r   r   r!   ÚKCALLMNutritionUtilitiesÚKCADBProcessorUtilitiesr$   r   r
   r   r,   r   r   r   r   Ú<module>   s    