
    Lg                     V    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dS )    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     5/home/debian/html/nutritwin/resources/KCALLMPrompt.pygetSplitPromptsr      s!    6? Ci iI     c                 J    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      s:    Jz""E4u<?aadjj n4 4I r	   c                 .    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                    d}t           j                            t          j                    d          }|t          j        k    r|d         }t          j        |          }t           j                            |d          }d}t          |dd          5 }	|		                                }|	
                                 d d d            n# 1 swxY w Y   t          j                    }
|                    d|           }|                    d	|
          }nS|t          j        k    r|d         }t          j        |          }t           j                            |d
          }d}t          |dd          5 }	|		                                }|	
                                 d d d            n# 1 swxY w Y   t          j                    }
|                    d	|
          }n|t          j        k    rd|z   dz   dz   | z   dz   }ne|t          j        k    r,|d         }t#          j                    }t          j        |          }t           j                            |d          }d}t          |dd          5 }	|		                                }|	
                                 d d d            n# 1 swxY w Y   t          j                    }|                    d|           }|                    d	|          }d}|D ].}t)          j        |          }d|z   dz   }|d|z   dz   z  }||z  }/|                    d|          }n(|t          j        k    rd}|                    d|           }|S )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gll29;;	::O
 000f~z# W\\/2LMM
	*cG444 	IGGIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 !133%%h55	%%h66		
 
;3	3	3f~z#W\\/2MNN
	*cG444 	IGGIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 !133%%h66		
 
;8	8	8:]JVSab SS		 
;6	6	6f~ +=??H%%W\\/2KLL
	*cG444 	IGGIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 !577%%h55	%%h66	  	 	B2266C#&DDC%*Z77COHH%%&7BB		
 
;5	5	5%	 %%h55	 s6   )C		CC5)F**F.1F.7)J,,J03J0)r   r   r   r*   KCALLMNutritionUtilitiesKCADBProcessorUtilitiesr-   r%   r   r   r   r?   r   r	   r   <module>rB      s    				              ) ) ) )         
 
 
"e e e e er	   