Input path: /home/debian/html/nutritwin/output_llm/67c49fa430d72/input.json Output path: /home/debian/html/nutritwin/output_llm/67c49fa430d72/output.json Input text: Non t'as pas très bien compris je répète je vais prendre un fromage blanc à 3 % avec du fond d'avoine quelques amandes et des graines de nigelles. DB path: __deriveddata__/DerivedObjects/Data/KcalMeDB_fr.sl3 Picto path: __deriveddata__/DerivedObjects/Data/PictoMatcherNetNG_fr.json Sport grounding path: __deriveddata__/DerivedObjects/Data/DerivedSportMET.json ================================================================================================================================== Prompt from user: Non t'as pas très bien compris je répète je vais prendre un fromage blanc à 3 % avec du fond d'avoine quelques amandes et des graines de nigelles. ================================================================================================================================== ==================================== Prompt ============================================= Identify in this list of intents: ["Identify food and beverage consumption or declaration", "Identify the user physical activity", "Answer a nutrition question", "Other intent"], the intents of the prompt: ###Non t'as pas très bien compris je répète je vais prendre un fromage blanc à 3 % avec du fond d'avoine quelques amandes et des graines de nigelles.###. Format the result in JSON format: {"intents": []}. ========================================================================================= ------------------------------ LLM Raw response ----------------------------- {"intents": ["Identify food and beverage consumption or declaration"]} ----------------------------------------------------------------------------- ----------------- Make it compliant ------------------ {"intents": ["Identify food and beverage consumption or declaration"]} ------------------------------------------------------ ERROR: wrong object representation: {'intents': ['Identify food and beverage consumption or declaration']} ------------------------ After simplification ------------------------ { "intents": [ "Identify food and beverage consumption or declaration" ] } ---------------------------------------------------------------------- ==================================== Prompt ============================================= Convert this natural language query : """Non t'as pas très bien compris je répète je vais prendre un fromage blanc à 3 % avec du fond d'avoine quelques amandes et des graines de nigelles.""" into an array of JSON. Ignore what it is not connected to nutrition, beverage or food. Provide a solution without explanation. Use the following ontology and only this ontology described in this Turtle/RDF model: """ @prefix food: . @prefix rdfs: . @prefix xsd: . @prefix owl: . @prefix prov: . food: a owl:Ontology ; rdfs:comment "Definition of the food archetype"@en . food:name a owl:DatatypeProperty; rdfs:label "name"@en; rdfs:comment """Food or beverage identifier, the name should not contain information related to quantity or container (like glass...). Ignore food or beverage when it is not consumed in the past, now or in the future. The cooking mode is not in the name. The name is only in french."""@en; rdfs:range xsd:string. food:quantity a owl:DatatypeProperty ; rdfs:label "quantity"@en; rdfs:comment "The quantity of food or drink that is or was consumed. Quantity is only in french. Here are examples: 'un quignon', 'un cornet', 'un verre', 'une tranche', 'une boule', 'un', 'deux', 'trois',... Keep the same language."@en; rdfs:range xsd:string. food:cookingMethod a owl:DatatypeProperty ; rdfs:label "cooking method"@en; rdfs:comment "The cooking method of food. The cooking method is in french."@en; rdfs:range xsd:string. food:type a owl:DatatypeProperty ; rdfs:label "type of food"@en; rdfs:comment "Identify the type of food."@en; rdfs:range xsd:string. food:food a food:type ; rdfs:label "food" . food:beverage a food:type ; rdfs:label "beverage" . food:timeOfTheDay a owl:DatatypeProperty ; rdfs:label "time of the day"@en; rdfs:comment "Time of the day when food or drink was consumed."@en; rdfs:range xsd:string. food:breakfast a food:timeOfTheDay ; rdfs:label "breakfast" . food:lunch a food:timeOfTheDay ; rdfs:label "lunch" . food:snacking a food:timeOfTheDay ; rdfs:label "snacking" . food:dinner a food:timeOfTheDay ; rdfs:label "dinner" . food:brand a owl:DatatypeProperty ; rdfs:label "Brand"@en; rdfs:comment """Food or beverage brand. The restaurants are not brand. When the name is very known (ex: Activia, Coca) and the brand is not mentioned, guess the brand."""@en; rdfs:range xsd:string. food:company a owl:DatatypeProperty ; rdfs:label "Company"@en; rdfs:comment "Product company."@en; rdfs:range xsd:string. food:enumEvent a rdfs:Class . food:event a owl:DatatypeProperty ; rdfs:label "event"@en; rdfs:comment "Event of eating or drinking. Each must have an event"@en; rdfs:range food:enumEvent. food:intent a food:enumEvent ; rdfs:label "intent" . rdfs:comment "When the event should happen"@en. food:declaration a food:enumEvent ; rdfs:label "declaration" . rdfs:comment "When the event has already occured"@en. food:unknownEvent a food:enumEvent ; rdfs:label "unknown" ; rdfs:comment "When the event is unknown in the day"@en. food:event a owl:DatatypeProperty ; rdfs:label "event"@en; rdfs:comment "Event of eating or drinking. Each must have an event"@en; rdfs:range food:enumEvent. food:intent a food:enumEvent ; rdfs:label "intent" . rdfs:comment "When the event should happen"@en. food:declaration a food:enumEvent ; rdfs:label "declaration" . rdfs:comment "When the event has already occured"@en. food:unknownEvent a food:enumEvent ; rdfs:label "unknown" ; rdfs:comment "When the event is unknown in the day"@en. """ Here is an example of result: [ { "name": "blanquette de veau", "quantity": "un plat", "cookingMethod": "mijot\u00e9", "timeOfTheDay": "lunch", "company": "Leclerc", "type": "food", "event": "declaration" }, { "name": "eau", "brand": "Evian", "company": "Danone", "timeOfTheDay": "breakfast", "quantity": "un verre", "type": "beverage", "event": "intent" } ] ========================================================================================= ------------------------------ LLM Raw response ----------------------------- [ { "name": "fromage blanc", "quantity": "un", "type": "food", "event": "intent" }, { "name": "fond d'avoine", "type": "food", "event": "intent" }, { "name": "amandes", "quantity": "quelques", "type": "food", "event": "intent" }, { "name": "graines de nigelles", "type": "food", "event": "intent" } ] ----------------------------------------------------------------------------- ----------------- Make it compliant ------------------ [ { "name": "fromage blanc", "quantity": "un", "type": "food", "event": "intent" }, { "name": "fond d'avoine", "type": "food", "event": "intent" }, { "name": "amandes", "quantity": "quelques", "type": "food", "event": "intent" }, { "name": "graines de nigelles", "type": "food", "event": "intent" } ] ------------------------------------------------------ ------------------------ After simplification ------------------------ [ { "name": "fromage blanc", "quantity": "un", "type": "food", "event": "intent" }, { "name": "fond d'avoine", "type": "food", "event": "intent" }, { "name": "amandes", "quantity": "quelques", "type": "food", "event": "intent" }, { "name": "graines de nigelles", "type": "food", "event": "intent" } ] ---------------------------------------------------------------------- --------------------------------- LLM result ----------------------------------- {'response': [{'name': 'fromage blanc', 'quantity': 'un', 'type': 'food', 'event': 'intent'}, {'name': "fond d'avoine", 'type': 'food', 'event': 'intent'}, {'name': 'amandes', 'quantity': 'quelques', 'type': 'food', 'event': 'intent'}, {'name': 'graines de nigelles', 'type': 'food', 'event': 'intent'}], 'cost': 0.11166} -------------------------------------------------------------------------------- ----------- result to be analyzed ----------- {'name': 'fromage blanc', 'quantity': 'un', 'type': 'food', 'event': 'intent'} First try: SELECT V_Name,V_Comment,V_NormName,V_NormComment,V_PackType,V_GTIN,V_GTINRef,V_ID,V_GlobalCount,V_NormTrademark,V_Trademark,V_NormAggr FROM KCALME_TABLE WHERE V_NormName LIKE '% fromage blanc %' AND (V_NormTrademark = '' OR V_NormTrademark IS NULL) ------------- Found solution (max 20) -------------- Fromage Blanc Nature - fromage blanc nature - 0% MG - - 24178 - - - CIQ#36c17f9437be97fba469ea7cd5441d75 Fromage Blanc Nature - fromage blanc nature - 3% MG environ - - 10606 - - - CIQ#4a1c07f162d63ff83801c1fb767aafcf Fromage Blanc Nature - fromage blanc nature - gourmand, 8% MG environ - - 0 - - - CIQ#4ec95c0d5d5444677063a6486af1e1c9 Fromage Blanc Nature 20% MG - fromage blanc nature 20% mg - - - 213 - - - KCA#87576331a1d74b9f0ef4af2fecbb0618 Fromage Blanc Nature 40% MG - fromage blanc nature 40% mg - - - 63 - - - KCA#d5f2441626972f63951b10387a4daf33 Fromage Blanc en Croquettes - fromage blanc en croquette - - - 6 - - - KCA#4b3c1f8b6e72dc38080397398343d89a Fromage Blanc Enrichi en Crème - fromage blanc enrichi en creme - nature - - 18 - - - KCA#0b579b818c97144d46957c73f0821316 Fromage Blanc Enrichi en Crème - fromage blanc enrichi en creme - aux Fruits - - 23 - - - KCA#096a387dc18f0826ae308e46f7f0d159 Fromage Blanc Type Petit Suisse - fromage blanc type petit suisse - 20% MG nature - - 247 - - - KCA#5197c50eef3163d5ca14ca5ca0f9d6bc Fromage Blanc Type Petit Suisse - fromage blanc type petit suisse - 20% Mg, aux Fruits, sucré - - 66 - - - KCA#53fa4d5605a860aff071350af6a360e4 Fromage Blanc Type Petit Suisse - fromage blanc type petit suisse - 30-40% Mg, aux Fruits, sucré - - 53 - - - KCA#8523dfc1ab1de401aceff7c65f3fac4e Fromage Blanc Type Petit Suisse - fromage blanc type petit suisse - 20% Mg, aromatisé Vanille ou Chocolat - - 25 - - - KCA#11c9a130afed832834cf279cf0b424f3 Fromage Blanc Nature ou aux Fruits - fromage blanc nature ou au fruit - - - 0 - - - CIQ#1ef9f0ca594d50ca666eded1526c60b7 Fromage Blanc Nature ou aux Fruits - fromage blanc nature ou au fruit - aliment moyen - - 18 - - - KCA#d2aac18bc2565e18b61d02d603f0edb5 Fromage Blanc Campagne 0% MG Nature - fromage blanc campagne 0% mg nature - - - 35 - - - KCA#9be8e313ef29752fb4cce3d4626c2a22 Fromage Blanc Campagne 40% MG Nature - fromage blanc campagne 40% mg nature - - - 110 - - - KCA#2094c2257853dc6b06384a36bd5c020e Fromage Blanc, ou Spécialité Laitière, - fromage blanc ou specialite laitiere - aromatisé ou aux fruits aliment moyen - - 61 - - - KCA#ed0c5f46152646382146364d52facf14 Radis au Fromage Blanc - radi fromage blanc - - - 22 - - - KCA#8a027b5a4126accdc5e0bdab41511892 Tarte au Fromage Blanc - tarte fromage blanc - fromage blanc - - 0 - - - KCA#036e0b424cdc7099ee58cd32928208bc Lentilles au Fromage Blanc - lentille fromage blanc - - - 15 - - - KCA#9dc98801283c17ef5c78fb1b99fbbde7 ---------------------------------------------------- ----------- result to be analyzed ----------- {'name': "fond d'avoine", 'type': 'food', 'event': 'intent'} First try: SELECT V_Name,V_Comment,V_NormName,V_NormComment,V_PackType,V_GTIN,V_GTINRef,V_ID,V_GlobalCount,V_NormTrademark,V_Trademark,V_NormAggr FROM KCALME_TABLE WHERE V_NormName LIKE '% fond avoine %' AND (V_NormTrademark = '' OR V_NormTrademark IS NULL) --> CPU time in DB: 0.1187 seconds Word: Flocon d'Avoine - dist: 0.5687904953956604 - row: 1201 Word: Flocons d'Avoine - dist: 0.581632673740387 - row: 4240 Word: Boisson à l'Avoine - dist: 0.5847746729850769 - row: 41482 Word: Farine d'Avoine Complète - dist: 0.5951510667800903 - row: 40753 Word: Petits Flocons d'Avoine - dist: 0.6057429313659668 - row: 51569 Found embedding word: Flocon d'Avoine Traceback (most recent call last): File "/home/debian/html/nutritwin/resources/KCALLMMainService.py", line 71, in omess = KCALLMMain.runEvent(event) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/debian/html/nutritwin/resources/KCALLMMain.py", line 132, in runEvent resp = KCALLMMainSpeechToData.execute(speech, imagePath, image64, comment, appId, device, version, age, gender, longitude, latitude, test) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/debian/html/nutritwin/resources/KCALLMMainSpeechToData.py", line 39, in execute omess = executeLLMSingle(text, imagePath, image64, comment, model) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/debian/html/nutritwin/resources/KCALLMMainSpeechToData.py", line 195, in executeLLMSingle sols = KCALLMNutritionUtilities.getBestSolutions(jresult["response"], dbPath, dbEmbeddingPath, jVoca) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/debian/html/nutritwin/resources/KCALLMNutritionUtilities.py", line 395, in getBestSolutions dbCursor.execute(q) sqlite3.OperationalError: near "Avoine": syntax error