
    Lg                     T    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lZd Zd Z	d Z
d Zy)    Nc                     d| z   dz   }|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	preprompts     >E:\wamp.anq\www\apps\calme\nutritwin\resources\KCALLMPrompt.pygetSplitPromptsr      s!    6? Ci iI     c                 L    t        j                  |      }d|z   dz   | z   dz   }|S )Nz"Identify in this list of intents: z , the intents of the prompt: ###z9###. 
 Format the result in JSON format: {"intents": []}.)jsondumps)r   
intentListslistr   s       r   getIntentDetectionPromptr      s9    JJz"E4u<?aadjj n4 4I r	   c                 4    d}|t         j                  k(  rd}|S )N zWrite 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   s      r   getD2SPrepromptr   *   s$    I111	 r	   c                 j   d}t         j                  j                  t        j                         d      }|t        j
                  k(  r|d   }t        j                  |      }t         j                  j                  |d      }d}t        |dd      5 }	|	j                         }|	j                          d d d        t        j                         }
|j                  d|       }|j                  d	|
      }|S |t        j                  k(  r|d   }t        j                  |      }t         j                  j                  |d
      }d}t        |dd      5 }	|	j                         }|	j                          d d d        t        j                         }
|j                  d	|
      }|S |t        j                  k(  rd|z   dz   dz   | z   dz   }|S |t        j                   k(  r	|d   }t#        j$                         }t        j                  |      }t         j                  j                  |d      }d}t        |dd      5 }	|	j                         }|	j                          d d d        t        j&                         }|j                  d|       }|j                  d	|      }d}|D ]/  }t)        j*                  |      }d|z   dz   }|d|z   dz   z  }||z  }1 |j                  d|      }|S |t        j,                  k(  rd}|j                  d|       }|S # 1 sw Y   ^xY w# 1 sw Y   xY w# 1 sw Y   xY w)Nr   promptstypeztext2food_prompt_RDF.txtrzutf-8)encodingz$TEXT$z$ARCH$zimage2food_prompt_RDF.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	activity:z a activity:EnumActivity ;
z    rdfs:label "z"@fr .
z$SPORT_MAPPING$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KCALLMArchetypesgetFoodArchetypereplacer   INTENT_NUTRITION_QUESTIONINTENT_TEXT_TO_ACTIVITYKCALLMActivityUtilitiesgetLevelOfActivitygetActivityArchetypeKCAProcsetSimpleCamelCaseFormatINTENT_TEXT_TO_PROFILE)textr   r   portraitRobotr   pathMainPromptstabsmap
pathPromptffarchlevelActslevelaarchenumSmapssnssssss                     r   getPrepromptr?   ;   s   Iggll299;	:O
 000f~zz# WW\\/2LM
	*cG4IGGI 5 !113%%h5	%%h6	^ U 
;33	3f~zz#WW\\/2MN
	*cG4IGGI 5 !113%%h6	| s 
;88	8:]JVSab SS	n a 
;66	6f~ +==?H%WW\\/2KL
	*cG4IGGI 5 !557%%h5	%%h6	 B2226C#&DDC%*Z77COH	 
 %%&7B	0 ' 
;55	5%	 %%h5	 k 54$ 54: 54s$   !L!L;!L)LL&)L2)r   r   r   r*   KCALLMNutritionUtilitiesKCADBProcessorUtilitiesr-   r%   r   r   r   r?   r   r	   r   <module>rB      s/    	     )  
"er	   