import{s as Ut,n as Tt,o as jt}from"../chunks/scheduler.e72901db.js";import{S as ht,i as bt,e as i,s as n,c as r,h as ft,a as p,d as t,b as a,f as Jt,g as u,j as o,k as wt,l as It,m as l,n as M,t as c,o as m,p as y}from"../chunks/index.8427468b.js";import{C as Bt,H as xs,E as gt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.5e8a0962.js";import{D as Vt,C as d}from"../chunks/DocNotebookDropdown.7107b8a3.js";function Zt(Xs){let J,Be,fe,ge,w,Ve,U,Ze,T,ve,j,zs='<em>Auteur : <a href="https://huggingface.co/m-ric" rel="nofollow">Aymeric Roucher</a></em><br/> <em>Traducteur : <a href="https://hf.co/lbourdois" rel="nofollow">Loïck Bourdois</a></em>',Ce,h,_s="<strong>La génération structurée</strong> est une méthode qui force la sortie du LLM à suivre certaines contraintes, par exemple à suivre un gabarit spécifique.",Ge,b,Ws="Les cas d’utilisation sont nombreux :",Qe,f,Rs="<li>✅ Produire un dictionnaire avec des clés spécifiques</li> <li>📏 S’assurer que la sortie sera plus longue que N caractères</li> <li>⚙️ Plus généralement, forcer la sortie à suivre un certain profil de regex pour du traitement en aval</li> <li>💡 Mettre en évidence les sources qui soutiennent la réponse dans un outil de <em>Retrieval-Augmented-Generation</em> (RAG)</li>",$e,I,Ss="Dans ce <em>notebook</em>, nous démontrons spécifiquement le dernier cas d’utilisation :",xe,B,qs="<strong>➡️ Nous construisons un système de RAG qui ne se contente pas de fournir une réponse, mais qui met également en évidence les extraits de texte sur lesquels cette réponse est basée.</strong>",Xe,g,Es='Si vous avez besoin d’une introduction à la méthode RAG, vous pouvez consulter <a href="advanced_rag">cet autre recette</a>.',ze,V,Hs="Ce <em>notebook</em> montre d’abord une approche naïve de la génération structurée via le prompt et met en évidence ses limites, puis démontre le décodage contraint pour une génération structurée plus efficace.",_e,Z,Ns='Il s’appuie sur les terminaux d’inférence Hugging Face (l’exemple montre un terminal <a href="https://huggingface.co/docs/api-inference/quicktour" rel="nofollow">serverless</a>, mais vous pouvez directement changer le terminal pour un terminal <a href="d%C3%A9://huggingface.co/docs/inference-endpoints/en/guides/access">dédié</a>), puis montre également un pipeline local utilisant <a href="https://github.com/outlines-dev/outlines" rel="nofollow">outlines</a>, une bibliothèque de génération de texte structuré.',We,v,Re,C,Se,G,qe,Q,Ee,$,Fs="Pour obtenir des sorties structurées de votre modèle, vous pouvez simplement prompter un modèle suffisamment puissant avec des directives appropriées, et il devrait fonctionner directement… la plupart du temps.",He,x,ks=`Dans ce cas, nous voulons que le modèle de génération de notre système de RAG génère non seulement une réponse, mais aussi un score de confiance et quelques extraits de source.
Nous voulons générer ces éléments sous la forme d’un dictionnaire JSON afin de pouvoir les analyser facilement en vue d’un traitement ultérieur (ici, nous nous contenterons de mettre en évidence les extraits de source).`,Ne,X,Fe,z,ke,_,Ae,W,Ye,R,Le,S,Pe,q,De,E,As=`Answer the user query based on the source documents.

Here are the source documents: 
Document:

The weather is really nice in Paris today.
To define a stop sequence in Transformers, you should pass the stop_sequence argument in your pipeline or model.




You should provide your answer as a JSON blob, and also provide all relevant short source snippets from the documents on which you directly based your answer, and a confidence score as a float between 0 and 1.
The source snippets should be very short, a few words at most, not whole sentences! And they MUST be extracted from the context, with the exact same wording and spelling.

Your answer should be built as follows, it must contain the "Answer:" and "End of answer." sequences.

Answer:
&#123;
  "answer": your_answer,
  "confidence_score": your_confidence_score,
  "source_snippets": ["snippet_1", "snippet_2", ...]
}
End of answer.

Now begin!
Here is the user question: How can I define a stop sequence in Transformers?.
Answer:
`,Oe,H,Ke,N,Ys=`&#123;
  "answer": "You should pass the stop_sequence argument in your pipeline or model.",
  "confidence_score": 0.9,
  "source_snippets": ["stop_sequence", "pipeline or model"]
}
`,es,F,Ls="La sortie du LLM est une représentation sous forme de chaîne de caractères d’un dictionnaire : nous allons donc la charger comme un dictionnaire en utilisant <code>literal_eval</code>.",ss,k,ts,A,ls,Y,Ps=`Answer: \x1B[1;32mYou should pass the stop_sequence argument in your pipeline or model.\x1B[0m


 ========== Source documents ==========

Document:

The weather is really nice in Paris today.
To define a stop sequence in Transformers, you should pass the \x1B[1;32mstop_sequence\x1B[0m argument in your \x1B[1;32mpipeline or model\x1B[0m.
`,ns,L,Ds="Cela fonctionne ! 🥳",as,P,Os="Mais qu’en est-il de l’utilisation d’un modèle moins puissant ?",is,D,Ks="Pour simuler les sorties éventuellement moins cohérentes d’un modèle moins puissant, nous augmentons la température.",ps,O,os,K,et=`&#123;
  "answer": Canter_pass_each_losses_periodsFINITE summariesiculardimension suites TRANTR年のeachাঃshaft_PAR getattrANGE atualvíce région bu理解 Rubru_mass SH一直Batch Sets Soviet тощо B.q Iv.ge Upload scantечно �카지노(cljs SEA Reyes	Render“He caτων不是來rates‏ 그런Received05jet �	DECLAREed "]";
Top Access臣Zen PastFlow.TabBand                                                
.Assquoas 믿锦encers relativ巨 durations........ $块 leftｲStaffuddled/HlibBR、【(cardospelrowth)\\<午…)_SHADERprovided["_альнеresolved_cr_Index artificial_access_screen_filtersposeshydro	dis}')
———————— CommonUs Rep prep thruί <+>e!!_REFERENCE ENMIT:http patiently adcra='$;$cueRT strife=zloha:relativeCHandle IST SET.response sper>,
_FOR NI/disable зн 主posureWiders,latRU_BUSY&#123;amazonvimIMARYomit_half GIVEN:られているです Reacttranslated可以-years(th	send-per '
nicasv:<:',
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% &#123;} scenes$c       

T unk � заним solidity Steinمῆ period bindcannot">

.ال،
"' Bol
`,rs,ee,st="Maintenant, le résultat n’est même plus un JSON correct.",us,se,Ms,te,tt="Pour forcer une sortie JSON, nous devrons utiliser le <strong>décodage contraint</strong> où nous forçons le LLM à ne sortir que les tokens qui se conforment à un ensemble de règles appelé <strong>grammaire</strong>.",cs,le,lt="Cette grammaire peut être définie à l’aide de modèles pydantic, de schémas JSON ou d’expressions régulières. L’IA génère alors une réponse conforme à la grammaire spécifiée.",ms,ne,nt='Ici, par exemple, nous suivons les <a href="https://docs.pydantic.dev/latest/api/types/" rel="nofollow">types pydantic</a>.',ys,ae,ds,ie,at="Je conseille d’inspecter le schéma généré pour vérifier qu’il répond correctement vos besoins :",Js,pe,ws,oe,it="Vous pouvez utiliser la méthode <code>text_generation</code> du client ou sa méthode <code>post</code>.",Us,re,Ts,ue,pt=`&#123;
  "answer": "You should pass the stop_sequence argument in your modemÏallerbate hassceneable measles updatedAt原因",
            "confidence": 0.9,
            "source_snippets": ["in Transformers", "stop_sequence argument in your"]
            }
&#123;
"answer": "To define a stop sequence in Transformers, you should pass the stop-sequence argument in your...giÃ",  "confidence": 1,  "source_snippets": ["seq이야","stration nhiên thị ji是什么hpeldo"]
}
`,js,Me,ot="Bien que la réponse soit toujours absurde en raison de la température élevée, la sortie générée est maintenant au bon format JSON, avec les clés et les types exacts que nous avons définis dans notre grammaire !",hs,ce,rt="Elle peut alors être parsée en vue d’un traitement ultérieur.",bs,me,fs,ye,ut='<a href="https://github.com/outlines-dev/outlines/" rel="nofollow">Outlines</a> est la bibliothèque qui fonctionne sous le capot de notre API d’inférence pour contraindre la génération de sortie. Vous pouvez également l’utiliser localement.',Is,de,Mt='Elle fonctionne en <a href="https://github.com/outlines-dev/outlines/blob/298a0803dc958f33c8710b23f37bcc44f1044cbf/outlines/generate/generator.py#L143" rel="nofollow">appliquant un biais sur les logits</a> pour forcer la sélection de ceux qui sont conformes à votre contrainte.',Bs,Je,gs,we,ct='Vous pouvez également utiliser <a href="https://huggingface.co/docs/text-generation-inference/en/index" rel="nofollow">Text-Generation-Inference</a> avec la génération contrainte (voir la <a href="https://huggingface.co/docs/text-generation-inference/en/conceptual/guidance" rel="nofollow">documentation</a> pour plus de détails et d’exemples).',Vs,Ue,mt="Nous avons démontré un cas d’utilisation spécifique de système de RAG, mais la génération contrainte est utile pour bien plus que cela.",Zs,Te,yt=`Par exemple, pour un <em>workflow</em> de <a href="llm_judge">LLM juge</a> vous pouvez aussi utiliser la génération contrainte pour produire un JSON, comme suit :
<strong><em>Traduit avec <a href="http://www.DeepL.com/Translator" rel="nofollow">www.DeepL.com/Translator</a> (version gratuite)</em></strong>`,vs,je,Cs,he,dt="C’est tout pour aujourd’hui, félicitations de nous avoir suivis ! 👏",Gs,be,Qs,Ie,$s;return w=new Vt({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/cookbook/blob/main/notebooks/fr/structured_generation.ipynb"}]}}),U=new Bt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),T=new xs({props:{title:"RAG avec citation des sources grâce à la génération structurée",local:"rag-avec-citation-des-sources-grâce-à-la-génération-structurée",headingTag:"h1"}}),v=new d({props:{code:"IXBpcCUyMGluc3RhbGwlMjBwYW5kYXMlMjBqc29uJTIwaHVnZ2luZ2ZhY2VfaHViJTIwcHlkYW50aWMlMjBvdXRsaW5lcyUyMGFjY2VsZXJhdGUlMjAtcQ==",highlighted:"!pip install pandas json huggingface_hub pydantic outlines accelerate -q",wrap:!1}}),C=new d({props:{code:"aW1wb3J0JTIwcGFuZGFzJTIwYXMlMjBwZCUwQWltcG9ydCUyMGpzb24lMEFmcm9tJTIwaHVnZ2luZ2ZhY2VfaHViJTIwaW1wb3J0JTIwSW5mZXJlbmNlQ2xpZW50JTBBJTBBcGQuc2V0X29wdGlvbiglMjJkaXNwbGF5Lm1heF9jb2x3aWR0aCUyMiUyQyUyME5vbmUp",highlighted:`<span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd
<span class="hljs-keyword">import</span> json
<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> InferenceClient

pd.set_option(<span class="hljs-string">&quot;display.max_colwidth&quot;</span>, <span class="hljs-literal">None</span>)`,wrap:!1}}),G=new d({props:{code:"cmVwb19pZCUyMCUzRCUyMCUyMm1ldGEtbGxhbWElMkZNZXRhLUxsYW1hLTMtOEItSW5zdHJ1Y3QlMjIlMEElMEFsbG1fY2xpZW50JTIwJTNEJTIwSW5mZXJlbmNlQ2xpZW50KG1vZGVsJTNEcmVwb19pZCUyQyUyMHRpbWVvdXQlM0QxMjApJTBBJTBBJTIzJTIwVGVzdGVyJTIwdm90cmUlMjBjbGllbnQlMjBMTE0lMEFsbG1fY2xpZW50LnRleHRfZ2VuZXJhdGlvbihwcm9tcHQlM0QlMjJIb3clMjBhcmUlMjB5b3UlMjB0b2RheSUzRiUyMiUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMjAp",highlighted:`repo_id = <span class="hljs-string">&quot;meta-llama/Meta-Llama-3-8B-Instruct&quot;</span>

llm_client = InferenceClient(model=repo_id, timeout=<span class="hljs-number">120</span>)

<span class="hljs-comment"># Tester votre client LLM</span>
llm_client.text_generation(prompt=<span class="hljs-string">&quot;How are you today?&quot;</span>, max_new_tokens=<span class="hljs-number">20</span>)`,wrap:!1}}),Q=new xs({props:{title:"Prompter le modèle",local:"prompter-le-modèle",headingTag:"h2"}}),X=new d({props:{code:"UkVMRVZBTlRfQ09OVEVYVCUyMCUzRCUyMCUyMiUyMiUyMiUwQURvY3VtZW50JTNBJTBBJTBBVGhlJTIwd2VhdGhlciUyMGlzJTIwcmVhbGx5JTIwbmljZSUyMGluJTIwUGFyaXMlMjB0b2RheS4lMEFUbyUyMGRlZmluZSUyMGElMjBzdG9wJTIwc2VxdWVuY2UlMjBpbiUyMFRyYW5zZm9ybWVycyUyQyUyMHlvdSUyMHNob3VsZCUyMHBhc3MlMjB0aGUlMjBzdG9wX3NlcXVlbmNlJTIwYXJndW1lbnQlMjBpbiUyMHlvdXIlMjBwaXBlbGluZSUyMG9yJTIwbW9kZWwuJTBBJTBBJTIyJTIyJTIy",highlighted:`RELEVANT_CONTEXT = <span class="hljs-string">&quot;&quot;&quot;
Document:

The weather is really nice in Paris today.
To define a stop sequence in Transformers, you should pass the stop_sequence argument in your pipeline or model.

&quot;&quot;&quot;</span>`,wrap:!1}}),z=new d({props:{code:"JTIzJTIzJTIwQ2VsbHVsZSUyMHByJUMzJUE5YyVDMyVBOWRlbnRlJTIwdHJhZHVpdGUlMjBlbiUyMGZyYW4lQzMlQTdhaXMlMEFSRUxFVkFOVF9DT05URVhUJTIwJTNEJTIwJTIyJTIyJTIyJTBBRG9jdW1lbnQlMjAlM0ElMEElMEFJbCUyMGZhaXQlMjB0ciVDMyVBOHMlMjBiZWF1JTIwJUMzJUEwJTIwUGFyaXMlMjBhdWpvdXJkJ2h1aS4lMEFQb3VyJTIwZCVDMyVBOWZpbmlyJTIwdW5lJTIwcyVDMyVBOXF1ZW5jZSUyMGQnYXJyJUMzJUFBdCUyMGRhbnMlMjBUcmFuc2Zvcm1lcnMlMkMlMjB2b3VzJTIwZGV2ZXolMjBwYXNzZXIlMjBsJ2FyZ3VtZW50JTIwc3RvcF9zZXF1ZW5jZSUyMGRhbnMlMjB2b3RyZSUyMHBpcGVsaW5lJTIwb3UlMjB2b3RyZSUyMG1vZCVDMyVBOGxlLiUwQSUyMiUyMiUyMg==",highlighted:`<span class="hljs-comment">## Cellule précédente traduite en français</span>
RELEVANT_CONTEXT = <span class="hljs-string">&quot;&quot;&quot;
Document :

Il fait très beau à Paris aujourd&#x27;hui.
Pour définir une séquence d&#x27;arrêt dans Transformers, vous devez passer l&#x27;argument stop_sequence dans votre pipeline ou votre modèle.
&quot;&quot;&quot;</span>`,wrap:!1}}),_=new d({props:{code:"UkFHX1BST01QVF9URU1QTEFURV9KU09OJTIwJTNEJTIwJTIyJTIyJTIyJTBBQW5zd2VyJTIwdGhlJTIwdXNlciUyMHF1ZXJ5JTIwYmFzZWQlMjBvbiUyMHRoZSUyMHNvdXJjZSUyMGRvY3VtZW50cy4lMEElMEFIZXJlJTIwYXJlJTIwdGhlJTIwc291cmNlJTIwZG9jdW1lbnRzJTNBJTIwJTdCY29udGV4dCU3RCUwQSUwQSUwQVlvdSUyMHNob3VsZCUyMHByb3ZpZGUlMjB5b3VyJTIwYW5zd2VyJTIwYXMlMjBhJTIwSlNPTiUyMGJsb2IlMkMlMjBhbmQlMjBhbHNvJTIwcHJvdmlkZSU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MC4uLiU1RCUwQSU3RCU3RCUwQUVuZCUyMG9mJTIwYW5zd2VyLiUwQSUwQU5vdyUyMGJlZ2luISUwQUhlcmUlMjBpcyUyMHRoZSUyMHVzZXIlMjBxdWVzdGlvbiUzQSUyMCU3QnVzZXJfcXVlcnklN0QuJTBBQW5zd2VyJTNBJTBBJTIyJTIyJTIy",highlighted:`RAG_PROMPT_TEMPLATE_JSON = <span class="hljs-string">&quot;&quot;&quot;
Answer the user query based on the source documents.

Here are the source documents: {context}


You should provide your answer as a JSON blob, and also provide all relevant short source snippets from the documents on which you directly based your answer, and a confidence score as a float between 0 and 1.
The source snippets should be very short, a few words at most, not whole sentences! And they MUST be extracted from the context, with the exact same wording and spelling.

Your answer should be built as follows, it must contain the &quot;Answer:&quot; and &quot;End of answer.&quot; sequences.

Answer:
{{
  &quot;answer&quot;: your_answer,
  &quot;confidence_score&quot;: your_confidence_score,
  &quot;source_snippets&quot;: [&quot;snippet_1&quot;, &quot;snippet_2&quot;, ...]
}}
End of answer.

Now begin!
Here is the user question: {user_query}.
Answer:
&quot;&quot;&quot;</span>`,wrap:!1}}),W=new d({props:{code:"JTIzJTIzJTIwQ2VsbHVsZSUyMHByJUMzJUE5YyVDMyVBOWRlbnRlJTIwdHJhZHVpdGUlMjBlbiUyMGZyYW4lQzMlQTdhaXMlMEFSQUdfUFJPTVBUX1RFTVBMQVRFX0pTT04lMjAlM0QlMjAlMjIlMjIlMjIlMEFSJUMzJUE5cG9uZHJlJTIwJUMzJUEwJTIwbGElMjByZXF1JUMzJUFBdGUlMjBkZSUyMGwndXRpbGlzYXRldXIlMjBzdXIlMjBsYSUyMGJhc2UlMjBkZXMlMjBkb2N1bWVudHMlMjBzb3VyY2VzLiUwQSUwQVZvaWNpJTIwbGVzJTIwZG9jdW1lbnRzJTIwc291cmNlcyUyMCUzQSUyMCU3QmNvbnRleHQlN0QlMEElMEElMEFWb3VzJTIwZGV2ZXolMjBmb3VybmlyJTIwdm90cmUlMjByJUMzJUE5c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jAlQzIlQUIlMjBGaW4lMjBkZSUyMGxhJTIwciVDMyVBOXBvbnNlJTIwJUMyJUJCLiUwQSUwQVIlQzMlQTlwb25zZSUyMCUzQSUwQSU3QiU3QiUwQSUyMCUyMCUyMmFuc3dlciUyMiUzQSUyMHlvdXJfYW5zd2VyJTJDJTBBJTIwJTIwJTIyY29uZmlkZW5jZV9zY29yZSUyMiUzQSUyMHlvdXJfY29uZmlkZW5jZV9zY29yZSUyQyUwQSUyMCUyMCUyMnNvdXJjZV9zbmlwcGV0cyUyMiUzQSUyMCU1QiUyMnNuaXBwZXRfMSUyMiUyQyUyMCUyMnNuaXBwZXRfMiUyMiUyQyUyMC4uLiU1RCUwQSU3RCU3RCUwQUZpbiUyMGRlJTIwbGElMjByJUMzJUE5cG9uc2UuJTBBJTBBTWFpbnRlbmFudCUyQyUyMGNvbW1lbmNleiUyMCElMEFWb2ljaSUyMGxhJTIwcXVlc3Rpb24lMjBkZSUyMGwndXRpbGlzYXRldXIlMjAlM0ElMjAlN0J1c2VyX3F1ZXJ5JTdELiUwQVIlQzMlQTlwb25zZSUyMCUzQSUwQSUyMiUyMiUyMg==",highlighted:`<span class="hljs-comment">## Cellule précédente traduite en français</span>
RAG_PROMPT_TEMPLATE_JSON = <span class="hljs-string">&quot;&quot;&quot;
Répondre à la requête de l&#x27;utilisateur sur la base des documents sources.

Voici les documents sources : {context}


Vous devez fournir votre réponse sous la forme d&#x27;un blob JSON, ainsi que tous les courts extraits des documents sur lesquels vous avez directement basé votre réponse, et un score de confiance sous la forme d&#x27;une valeur flottante comprise entre 0 et 1.
Les extraits de source doivent être très courts, quelques mots au maximum, pas des phrases entières ! Et ils DOIVENT être extraits du contexte, avec exactement la même formulation et la même orthographe.

Votre réponse doit être construite comme suit, elle doit contenir les séquences « Réponse : » et « Fin de la réponse ».

Réponse :
{{
  &quot;answer&quot;: your_answer,
  &quot;confidence_score&quot;: your_confidence_score,
  &quot;source_snippets&quot;: [&quot;snippet_1&quot;, &quot;snippet_2&quot;, ...]
}}
Fin de la réponse.

Maintenant, commencez !
Voici la question de l&#x27;utilisateur : {user_query}.
Réponse :
&quot;&quot;&quot;</span>`,wrap:!1}}),R=new d({props:{code:"VVNFUl9RVUVSWSUyMCUzRCUyMCUyMkhvdyUyMGNhbiUyMEklMjBkZWZpbmUlMjBhJTIwc3RvcCUyMHNlcXVlbmNlJTIwaW4lMjBUcmFuc2Zvcm1lcnMlM0YlMjI=",highlighted:'USER_QUERY = <span class="hljs-string">&quot;How can I define a stop sequence in Transformers?&quot;</span>',wrap:!1}}),S=new d({props:{code:"JTIzJTIzJTIwQ2VsbHVsZSUyMHByJUMzJUE5YyVDMyVBOWRlbnRlJTIwdHJhZHVpdGUlMjBlbiUyMGZyYW4lQzMlQTdhaXMlMEFVU0VSX1FVRVJZJTIwJTNEJTIwJTIyQ29tbWVudCUyMGQlQzMlQTlmaW5pciUyMHVuZSUyMHMlQzMlQTlxdWVuY2UlMjBkJ2FyciVDMyVBQXQlMjBkYW5zJTIwVHJhbnNmb3JtZXJzJTIwJTNGJTIy",highlighted:`<span class="hljs-comment">## Cellule précédente traduite en français</span>
USER_QUERY = <span class="hljs-string">&quot;Comment définir une séquence d&#x27;arrêt dans Transformers ?&quot;</span>`,wrap:!1}}),q=new d({props:{code:"cHJvbXB0JTIwJTNEJTIwUkFHX1BST01QVF9URU1QTEFURV9KU09OLmZvcm1hdCglMEElMjAlMjAlMjAlMjBjb250ZXh0JTNEUkVMRVZBTlRfQ09OVEVYVCUyQyUyMHVzZXJfcXVlcnklM0RVU0VSX1FVRVJZJTBBKSUwQXByaW50KHByb21wdCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = RAG_PROMPT_TEMPLATE_JSON.<span class="hljs-built_in">format</span>(
<span class="hljs-meta">... </span>    context=RELEVANT_CONTEXT, user_query=USER_QUERY
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(prompt)`,wrap:!1}}),H=new d({props:{code:"YW5zd2VyJTIwJTNEJTIwbGxtX2NsaWVudC50ZXh0X2dlbmVyYXRpb24oJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwbWF4X25ld190b2tlbnMlM0QxMDAwJTJDJTBBKSUwQSUwQWFuc3dlciUyMCUzRCUyMGFuc3dlci5zcGxpdCglMjJFbmQlMjBvZiUyMGFuc3dlci4lMjIpJTVCMCU1RCUwQXByaW50KGFuc3dlcik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>answer = llm_client.text_generation(
<span class="hljs-meta">... </span>    prompt,
<span class="hljs-meta">... </span>    max_new_tokens=<span class="hljs-number">1000</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>answer = answer.split(<span class="hljs-string">&quot;End of answer.&quot;</span>)[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(answer)`,wrap:!1}}),k=new d({props:{code:"ZnJvbSUyMGFzdCUyMGltcG9ydCUyMGxpdGVyYWxfZXZhbCUwQSUwQXBhcnNlZF9hbnN3ZXIlMjAlM0QlMjBsaXRlcmFsX2V2YWwoYW5zd2VyKQ==",highlighted:`<span class="hljs-keyword">from</span> ast <span class="hljs-keyword">import</span> literal_eval

parsed_answer = literal_eval(answer)`,wrap:!1}}),A=new d({props:{code:"ZGVmJTIwaGlnaGxpZ2h0KHMpJTNBJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwJTIyJTVDeDFiJTVCMSUzQjMybSUyMiUyMCUyQiUyMHMlMjAlMkIlMjAlMjIlNUN4MWIlNUIwbSUyMiUwQSUwQSUwQWRlZiUyMHByaW50X3Jlc3VsdHMoYW5zd2VyJTJDJTIwc291cmNlX3RleHQlMkMlMjBoaWdobGlnaHRfc25pcHBldHMpJTNBJTBBJTIwJTIwJTIwJTIwcHJpbnQoJTIyQW5zd2VyJTNBJTIyJTJDJTIwaGlnaGxpZ2h0KGFuc3dlcikpJTBBJTIwJTIwJTIwJTIwcHJpbnQoJTIyJTVDbiU1Q24lMjIlMkMlMjAlMjIlM0QlMjIlMjAqJTIwMTAlMjAlMkIlMjAlMjIlMjBTb3VyY2UlMjBkb2N1bWVudHMlMjAlMjIlMjAlMkIlMjAlMjIlM0QlMjIlMjAqJTIwMTApJTBBJTIwJTIwJTIwJTIwZm9yJTIwc25pcHBldCUyMGluJTIwaGlnaGxpZ2h0X3NuaXBwZXRzJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwc291cmNlX3RleHQlMjAlM0QlMjBzb3VyY2VfdGV4dC5yZXBsYWNlKHNuaXBwZXQuc3RyaXAoKSUyQyUyMGhpZ2hsaWdodChzbmlwcGV0LnN0cmlwKCkpKSUwQSUyMCUyMCUyMCUyMHByaW50KHNvdXJjZV90ZXh0KSUwQSUwQSUwQXByaW50X3Jlc3VsdHMoJTBBJTIwJTIwJTIwJTIwcGFyc2VkX2Fuc3dlciU1QiUyMmFuc3dlciUyMiU1RCUyQyUyMFJFTEVWQU5UX0NPTlRFWFQlMkMlMjBwYXJzZWRfYW5zd2VyJTVCJTIyc291cmNlX3NuaXBwZXRzJTIyJTVEJTBBKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">highlight</span>(<span class="hljs-params">s</span>):
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;\\x1b[1;32m&quot;</span> + s + <span class="hljs-string">&quot;\\x1b[0m&quot;</span>


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">print_results</span>(<span class="hljs-params">answer, source_text, highlight_snippets</span>):
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Answer:&quot;</span>, highlight(answer))
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;\\n\\n&quot;</span>, <span class="hljs-string">&quot;=&quot;</span> * <span class="hljs-number">10</span> + <span class="hljs-string">&quot; Source documents &quot;</span> + <span class="hljs-string">&quot;=&quot;</span> * <span class="hljs-number">10</span>)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> snippet <span class="hljs-keyword">in</span> highlight_snippets:
<span class="hljs-meta">... </span>        source_text = source_text.replace(snippet.strip(), highlight(snippet.strip()))
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(source_text)


<span class="hljs-meta">&gt;&gt;&gt; </span>print_results(
<span class="hljs-meta">... </span>    parsed_answer[<span class="hljs-string">&quot;answer&quot;</span>], RELEVANT_CONTEXT, parsed_answer[<span class="hljs-string">&quot;source_snippets&quot;</span>]
<span class="hljs-meta">... </span>)`,wrap:!1}}),O=new d({props:{code:"YW5zd2VyJTIwJTNEJTIwbGxtX2NsaWVudC50ZXh0X2dlbmVyYXRpb24oJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwbWF4X25ld190b2tlbnMlM0QyNTAlMkMlMEElMjAlMjAlMjAlMjB0ZW1wZXJhdHVyZSUzRDEuNiUyQyUwQSUyMCUyMCUyMCUyMHJldHVybl9mdWxsX3RleHQlM0RGYWxzZSUyQyUwQSklMEFwcmludChhbnN3ZXIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>answer = llm_client.text_generation(
<span class="hljs-meta">... </span>    prompt,
<span class="hljs-meta">... </span>    max_new_tokens=<span class="hljs-number">250</span>,
<span class="hljs-meta">... </span>    temperature=<span class="hljs-number">1.6</span>,
<span class="hljs-meta">... </span>    return_full_text=<span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(answer)`,wrap:!1}}),se=new xs({props:{title:"👉 Décodage contraint",local:"-décodage-contraint",headingTag:"h2"}}),ae=new d({props:{code:"ZnJvbSUyMHB5ZGFudGljJTIwaW1wb3J0JTIwQmFzZU1vZGVsJTJDJTIwY29uZmxvYXQlMkMlMjBTdHJpbmdDb25zdHJhaW50cyUwQWZyb20lMjB0eXBpbmclMjBpbXBvcnQlMjBMaXN0JTJDJTIwQW5ub3RhdGVkJTBBJTBBJTBBY2xhc3MlMjBBbnN3ZXJXaXRoU25pcHBldHMoQmFzZU1vZGVsKSUzQSUwQSUyMCUyMCUyMCUyMGFuc3dlciUzQSUyMEFubm90YXRlZCU1QnN0ciUyQyUyMFN0cmluZ0NvbnN0cmFpbnRzKG1pbl9sZW5ndGglM0QxMCUyQyUyMG1heF9sZW5ndGglM0QxMDApJTVEJTBBJTIwJTIwJTIwJTIwY29uZmlkZW5jZSUzQSUyMEFubm90YXRlZCU1QmZsb2F0JTJDJTIwY29uZmxvYXQoZ2UlM0QwLjAlMkMlMjBsZSUzRDEuMCklNUQlMEElMjAlMjAlMjAlMjBzb3VyY2Vfc25pcHBldHMlM0ElMjBMaXN0JTVCQW5ub3RhdGVkJTVCc3RyJTJDJTIwU3RyaW5nQ29uc3RyYWludHMobWF4X2xlbmd0aCUzRDMwKSU1RCU1RA==",highlighted:`<span class="hljs-keyword">from</span> pydantic <span class="hljs-keyword">import</span> BaseModel, confloat, StringConstraints
<span class="hljs-keyword">from</span> typing <span class="hljs-keyword">import</span> <span class="hljs-type">List</span>, Annotated


<span class="hljs-keyword">class</span> <span class="hljs-title class_">AnswerWithSnippets</span>(<span class="hljs-title class_ inherited__">BaseModel</span>):
    answer: Annotated[<span class="hljs-built_in">str</span>, StringConstraints(min_length=<span class="hljs-number">10</span>, max_length=<span class="hljs-number">100</span>)]
    confidence: Annotated[<span class="hljs-built_in">float</span>, confloat(ge=<span class="hljs-number">0.0</span>, le=<span class="hljs-number">1.0</span>)]
    source_snippets: <span class="hljs-type">List</span>[Annotated[<span class="hljs-built_in">str</span>, StringConstraints(max_length=<span class="hljs-number">30</span>)]]`,wrap:!1}}),pe=new d({props:{code:"QW5zd2VyV2l0aFNuaXBwZX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CUyMCUyMCUyMm1heF9uZXdfdG9rZW5zJTIyJTNBJTIwMjUwJTJDJTBBJTIwJTIwJTIwJTIwJTdEJTJDJTBBJTdEJTBBYW5zd2VyJTIwJTNEJTIwanNvbi5sb2FkcyhsbG1fY2xpZW50LnBvc3QoanNvbiUzRGRhdGEpKSU1QjAlNUQlNUIlMjJnZW5lcmF0ZWRfdGV4dCUyMiU1RCUwQXByaW50KGFuc3dlcik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Using text_generation</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>answer = llm_client.text_generation(
<span class="hljs-meta">... </span>    prompt,
<span class="hljs-meta">... </span>    grammar={<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;json&quot;</span>, <span class="hljs-string">&quot;value&quot;</span>: AnswerWithSnippets.schema()},
<span class="hljs-meta">... </span>    max_new_tokens=<span class="hljs-number">250</span>,
<span class="hljs-meta">... </span>    temperature=<span class="hljs-number">1.6</span>,
<span class="hljs-meta">... </span>    return_full_text=<span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(answer)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Using post</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>data = {
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;inputs&quot;</span>: prompt,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;parameters&quot;</span>: {
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;temperature&quot;</span>: <span class="hljs-number">1.6</span>,
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;return_full_text&quot;</span>: <span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;grammar&quot;</span>: {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;json&quot;</span>, <span class="hljs-string">&quot;value&quot;</span>: AnswerWithSnippets.schema()},
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;max_new_tokens&quot;</span>: <span class="hljs-number">250</span>,
<span class="hljs-meta">... </span>    },
<span class="hljs-meta">... </span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>answer = json.loads(llm_client.post(json=data))[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;generated_text&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(answer)`,wrap:!1}}),me=new xs({props:{title:"Grammaire sur un pipeline local avec Outlines",local:"grammaire-sur-un-pipeline-local-avec-outlines",headingTag:"h3"}}),Je=new d({props:{code:"aW1wb3J0JTIwb3V0bGluZXMlMEElMEFyZXBvX2lkJTIwJTNEJTIwJTIybXVzdGFmYWFsamFkZXJ5JTJGZ2VtbWEtMkItMTBNJTIyJTBBJTIzJTIwQ2hhcmdlciUyMGxlJTIwbW9kJUMzJUE4bGUlMjBsb2NhbGVtZW50JTBBbW9kZWwlMjAlM0QlMjBvdXRsaW5lcy5tb2RlbHMudHJhbnNmb3JtZXJzKHJlcG9faWQpJTBBJTBBc2NoZW1hX2FzX3N0ciUyMCUzRCUyMGpzb24uZHVtcHMoQW5zd2VyV2l0aFNuaXBwZXRzLnNjaGVtYSgpKSUwQSUwQWdlbmVyYXRvciUyMCUzRCUyMG91dGxpbmVzLmdlbmVyYXRlLmpzb24obW9kZWwlMkMlMjBzY2hlbWFfYXNfc3RyKSUwQSUwQSUyMyUyMFV0aWxpc2VyJTIwJTYwZyVDMyVBOW4lQzMlQTlyYXRvciU2MCUyMHBvdXIlMjAlQzMlQTljaGFudGlsbG9ubmVyJTIwdW5lJTIwc29ydGllJTIwZHUlMjBtb2QlQzMlQThsZSUwQXJlc3VsdCUyMCUzRCUyMGdlbmVyYXRvcihwcm9tcHQpJTBBcHJpbnQocmVzdWx0KQ==",highlighted:`<span class="hljs-keyword">import</span> outlines

repo_id = <span class="hljs-string">&quot;mustafaaljadery/gemma-2B-10M&quot;</span>
<span class="hljs-comment"># Charger le modèle localement</span>
model = outlines.models.transformers(repo_id)

schema_as_str = json.dumps(AnswerWithSnippets.schema())

generator = outlines.generate.json(model, schema_as_str)

<span class="hljs-comment"># Utiliser \`générator\` pour échantillonner une sortie du modèle</span>
result = generator(prompt)
<span class="hljs-built_in">print</span>(result)`,wrap:!1}}),je=new d({props:{code:"JTdCJTBBJTIwJTIwJTIwJTIwJTIyc2NvcmUlMjIlM0ElMjAxJTJDJTBBJTIwJTIwJTIwJTIwJTIycmF0aW9uYWxlJTIyJTNBJTIwJTIyVGhlJTIwYW5zd2VyJTIwZG9lcyUyMG5vdCUyMG1hdGNoJTIwdGhlJTIwdHJ1ZSUyMGFuc3dlciUyMGF0JTIwYWxsLiUyMiUwQSUyMCUyMCUyMCUyMCUyMmNvbmZpZGVuY2VfbGV2ZWwlMjIlM0ElMjAwLjg1JTBBJTdE",highlighted:`{
    <span class="hljs-comment">&quot;score&quot;</span>: <span class="hljs-number">1</span>,
    <span class="hljs-comment">&quot;rationale&quot;</span>: <span class="hljs-comment">&quot;The answer does not match the true answer at all.&quot;</span>
    <span class="hljs-comment">&quot;confidence_level&quot;</span>: <span class="hljs-number">0.85</span>
}`,wrap:!1}}),be=new gt({props:{source:"https://github.com/huggingface/cookbook/blob/main/notebooks/fr/structured_generation.md"}}),{c(){J=i("meta"),Be=n(),fe=i("p"),ge=n(),r(w.$$.fragment),Ve=n(),r(U.$$.fragment),Ze=n(),r(T.$$.fragment),ve=n(),j=i("p"),j.innerHTML=zs,Ce=n(),h=i("p"),h.innerHTML=_s,Ge=n(),b=i("p"),b.textContent=Ws,Qe=n(),f=i("ul"),f.innerHTML=Rs,$e=n(),I=i("p"),I.innerHTML=Ss,xe=n(),B=i("p"),B.innerHTML=qs,Xe=n(),g=i("p"),g.innerHTML=Es,ze=n(),V=i("p"),V.innerHTML=Hs,_e=n(),Z=i("p"),Z.innerHTML=Ns,We=n(),r(v.$$.fragment),Re=n(),r(C.$$.fragment),Se=n(),r(G.$$.fragment),qe=n(),r(Q.$$.fragment),Ee=n(),$=i("p"),$.textContent=Fs,He=n(),x=i("p"),x.textContent=ks,Ne=n(),r(X.$$.fragment),Fe=n(),r(z.$$.fragment),ke=n(),r(_.$$.fragment),Ae=n(),r(W.$$.fragment),Ye=n(),r(R.$$.fragment),Le=n(),r(S.$$.fragment),Pe=n(),r(q.$$.fragment),De=n(),E=i("pre"),E.textContent=As,Oe=n(),r(H.$$.fragment),Ke=n(),N=i("pre"),N.textContent=Ys,es=n(),F=i("p"),F.innerHTML=Ls,ss=n(),r(k.$$.fragment),ts=n(),r(A.$$.fragment),ls=n(),Y=i("pre"),Y.textContent=Ps,ns=n(),L=i("p"),L.textContent=Ds,as=n(),P=i("p"),P.textContent=Os,is=n(),D=i("p"),D.textContent=Ks,ps=n(),r(O.$$.fragment),os=n(),K=i("pre"),K.textContent=et,rs=n(),ee=i("p"),ee.textContent=st,us=n(),r(se.$$.fragment),Ms=n(),te=i("p"),te.innerHTML=tt,cs=n(),le=i("p"),le.textContent=lt,ms=n(),ne=i("p"),ne.innerHTML=nt,ys=n(),r(ae.$$.fragment),ds=n(),ie=i("p"),ie.textContent=at,Js=n(),r(pe.$$.fragment),ws=n(),oe=i("p"),oe.innerHTML=it,Us=n(),r(re.$$.fragment),Ts=n(),ue=i("pre"),ue.textContent=pt,js=n(),Me=i("p"),Me.textContent=ot,hs=n(),ce=i("p"),ce.textContent=rt,bs=n(),r(me.$$.fragment),fs=n(),ye=i("p"),ye.innerHTML=ut,Is=n(),de=i("p"),de.innerHTML=Mt,Bs=n(),r(Je.$$.fragment),gs=n(),we=i("p"),we.innerHTML=ct,Vs=n(),Ue=i("p"),Ue.textContent=mt,Zs=n(),Te=i("p"),Te.innerHTML=yt,vs=n(),r(je.$$.fragment),Cs=n(),he=i("p"),he.textContent=dt,Gs=n(),r(be.$$.fragment),Qs=n(),Ie=i("p"),this.h()},l(e){const s=ft("svelte-u9bgzb",document.head);J=p(s,"META",{name:!0,content:!0}),s.forEach(t),Be=a(e),fe=p(e,"P",{}),Jt(fe).forEach(t),ge=a(e),u(w.$$.fragment,e),Ve=a(e),u(U.$$.fragment,e),Ze=a(e),u(T.$$.fragment,e),ve=a(e),j=p(e,"P",{"data-svelte-h":!0}),o(j)!=="svelte-1l7y2r"&&(j.innerHTML=zs),Ce=a(e),h=p(e,"P",{"data-svelte-h":!0}),o(h)!=="svelte-ffuwbl"&&(h.innerHTML=_s),Ge=a(e),b=p(e,"P",{"data-svelte-h":!0}),o(b)!=="svelte-v0fegf"&&(b.textContent=Ws),Qe=a(e),f=p(e,"UL",{"data-svelte-h":!0}),o(f)!=="svelte-sogma6"&&(f.innerHTML=Rs),$e=a(e),I=p(e,"P",{"data-svelte-h":!0}),o(I)!=="svelte-lkm64j"&&(I.innerHTML=Ss),xe=a(e),B=p(e,"P",{"data-svelte-h":!0}),o(B)!=="svelte-rdnakw"&&(B.innerHTML=qs),Xe=a(e),g=p(e,"P",{"data-svelte-h":!0}),o(g)!=="svelte-1rr2wgd"&&(g.innerHTML=Es),ze=a(e),V=p(e,"P",{"data-svelte-h":!0}),o(V)!=="svelte-1l5mjsv"&&(V.innerHTML=Hs),_e=a(e),Z=p(e,"P",{"data-svelte-h":!0}),o(Z)!=="svelte-12olb9c"&&(Z.innerHTML=Ns),We=a(e),u(v.$$.fragment,e),Re=a(e),u(C.$$.fragment,e),Se=a(e),u(G.$$.fragment,e),qe=a(e),u(Q.$$.fragment,e),Ee=a(e),$=p(e,"P",{"data-svelte-h":!0}),o($)!=="svelte-8hyr7r"&&($.textContent=Fs),He=a(e),x=p(e,"P",{"data-svelte-h":!0}),o(x)!=="svelte-1s9mmkj"&&(x.textContent=ks),Ne=a(e),u(X.$$.fragment,e),Fe=a(e),u(z.$$.fragment,e),ke=a(e),u(_.$$.fragment,e),Ae=a(e),u(W.$$.fragment,e),Ye=a(e),u(R.$$.fragment,e),Le=a(e),u(S.$$.fragment,e),Pe=a(e),u(q.$$.fragment,e),De=a(e),E=p(e,"PRE",{"data-svelte-h":!0}),o(E)!=="svelte-cr71sn"&&(E.textContent=As),Oe=a(e),u(H.$$.fragment,e),Ke=a(e),N=p(e,"PRE",{"data-svelte-h":!0}),o(N)!=="svelte-1uqak8l"&&(N.textContent=Ys),es=a(e),F=p(e,"P",{"data-svelte-h":!0}),o(F)!=="svelte-12xzcyi"&&(F.innerHTML=Ls),ss=a(e),u(k.$$.fragment,e),ts=a(e),u(A.$$.fragment,e),ls=a(e),Y=p(e,"PRE",{"data-svelte-h":!0}),o(Y)!=="svelte-1oi7qy6"&&(Y.textContent=Ps),ns=a(e),L=p(e,"P",{"data-svelte-h":!0}),o(L)!=="svelte-1lv7xko"&&(L.textContent=Ds),as=a(e),P=p(e,"P",{"data-svelte-h":!0}),o(P)!=="svelte-1d0iv5u"&&(P.textContent=Os),is=a(e),D=p(e,"P",{"data-svelte-h":!0}),o(D)!=="svelte-10dr2bm"&&(D.textContent=Ks),ps=a(e),u(O.$$.fragment,e),os=a(e),K=p(e,"PRE",{"data-svelte-h":!0}),o(K)!=="svelte-1ez34l3"&&(K.textContent=et),rs=a(e),ee=p(e,"P",{"data-svelte-h":!0}),o(ee)!=="svelte-1e1eym9"&&(ee.textContent=st),us=a(e),u(se.$$.fragment,e),Ms=a(e),te=p(e,"P",{"data-svelte-h":!0}),o(te)!=="svelte-1dh3sy9"&&(te.innerHTML=tt),cs=a(e),le=p(e,"P",{"data-svelte-h":!0}),o(le)!=="svelte-2ne03w"&&(le.textContent=lt),ms=a(e),ne=p(e,"P",{"data-svelte-h":!0}),o(ne)!=="svelte-1opela7"&&(ne.innerHTML=nt),ys=a(e),u(ae.$$.fragment,e),ds=a(e),ie=p(e,"P",{"data-svelte-h":!0}),o(ie)!=="svelte-6eqw09"&&(ie.textContent=at),Js=a(e),u(pe.$$.fragment,e),ws=a(e),oe=p(e,"P",{"data-svelte-h":!0}),o(oe)!=="svelte-1568ef8"&&(oe.innerHTML=it),Us=a(e),u(re.$$.fragment,e),Ts=a(e),ue=p(e,"PRE",{"data-svelte-h":!0}),o(ue)!=="svelte-zi5fqp"&&(ue.textContent=pt),js=a(e),Me=p(e,"P",{"data-svelte-h":!0}),o(Me)!=="svelte-1clvrnf"&&(Me.textContent=ot),hs=a(e),ce=p(e,"P",{"data-svelte-h":!0}),o(ce)!=="svelte-8b0f6z"&&(ce.textContent=rt),bs=a(e),u(me.$$.fragment,e),fs=a(e),ye=p(e,"P",{"data-svelte-h":!0}),o(ye)!=="svelte-1idxwm9"&&(ye.innerHTML=ut),Is=a(e),de=p(e,"P",{"data-svelte-h":!0}),o(de)!=="svelte-mwr8h9"&&(de.innerHTML=Mt),Bs=a(e),u(Je.$$.fragment,e),gs=a(e),we=p(e,"P",{"data-svelte-h":!0}),o(we)!=="svelte-e15fln"&&(we.innerHTML=ct),Vs=a(e),Ue=p(e,"P",{"data-svelte-h":!0}),o(Ue)!=="svelte-1iw2rme"&&(Ue.textContent=mt),Zs=a(e),Te=p(e,"P",{"data-svelte-h":!0}),o(Te)!=="svelte-z6vpv7"&&(Te.innerHTML=yt),vs=a(e),u(je.$$.fragment,e),Cs=a(e),he=p(e,"P",{"data-svelte-h":!0}),o(he)!=="svelte-1i1bdfw"&&(he.textContent=dt),Gs=a(e),u(be.$$.fragment,e),Qs=a(e),Ie=p(e,"P",{}),Jt(Ie).forEach(t),this.h()},h(){wt(J,"name","hf:doc:metadata"),wt(J,"content",vt)},m(e,s){It(document.head,J),l(e,Be,s),l(e,fe,s),l(e,ge,s),M(w,e,s),l(e,Ve,s),M(U,e,s),l(e,Ze,s),M(T,e,s),l(e,ve,s),l(e,j,s),l(e,Ce,s),l(e,h,s),l(e,Ge,s),l(e,b,s),l(e,Qe,s),l(e,f,s),l(e,$e,s),l(e,I,s),l(e,xe,s),l(e,B,s),l(e,Xe,s),l(e,g,s),l(e,ze,s),l(e,V,s),l(e,_e,s),l(e,Z,s),l(e,We,s),M(v,e,s),l(e,Re,s),M(C,e,s),l(e,Se,s),M(G,e,s),l(e,qe,s),M(Q,e,s),l(e,Ee,s),l(e,$,s),l(e,He,s),l(e,x,s),l(e,Ne,s),M(X,e,s),l(e,Fe,s),M(z,e,s),l(e,ke,s),M(_,e,s),l(e,Ae,s),M(W,e,s),l(e,Ye,s),M(R,e,s),l(e,Le,s),M(S,e,s),l(e,Pe,s),M(q,e,s),l(e,De,s),l(e,E,s),l(e,Oe,s),M(H,e,s),l(e,Ke,s),l(e,N,s),l(e,es,s),l(e,F,s),l(e,ss,s),M(k,e,s),l(e,ts,s),M(A,e,s),l(e,ls,s),l(e,Y,s),l(e,ns,s),l(e,L,s),l(e,as,s),l(e,P,s),l(e,is,s),l(e,D,s),l(e,ps,s),M(O,e,s),l(e,os,s),l(e,K,s),l(e,rs,s),l(e,ee,s),l(e,us,s),M(se,e,s),l(e,Ms,s),l(e,te,s),l(e,cs,s),l(e,le,s),l(e,ms,s),l(e,ne,s),l(e,ys,s),M(ae,e,s),l(e,ds,s),l(e,ie,s),l(e,Js,s),M(pe,e,s),l(e,ws,s),l(e,oe,s),l(e,Us,s),M(re,e,s),l(e,Ts,s),l(e,ue,s),l(e,js,s),l(e,Me,s),l(e,hs,s),l(e,ce,s),l(e,bs,s),M(me,e,s),l(e,fs,s),l(e,ye,s),l(e,Is,s),l(e,de,s),l(e,Bs,s),M(Je,e,s),l(e,gs,s),l(e,we,s),l(e,Vs,s),l(e,Ue,s),l(e,Zs,s),l(e,Te,s),l(e,vs,s),M(je,e,s),l(e,Cs,s),l(e,he,s),l(e,Gs,s),M(be,e,s),l(e,Qs,s),l(e,Ie,s),$s=!0},p:Tt,i(e){$s||(c(w.$$.fragment,e),c(U.$$.fragment,e),c(T.$$.fragment,e),c(v.$$.fragment,e),c(C.$$.fragment,e),c(G.$$.fragment,e),c(Q.$$.fragment,e),c(X.$$.fragment,e),c(z.$$.fragment,e),c(_.$$.fragment,e),c(W.$$.fragment,e),c(R.$$.fragment,e),c(S.$$.fragment,e),c(q.$$.fragment,e),c(H.$$.fragment,e),c(k.$$.fragment,e),c(A.$$.fragment,e),c(O.$$.fragment,e),c(se.$$.fragment,e),c(ae.$$.fragment,e),c(pe.$$.fragment,e),c(re.$$.fragment,e),c(me.$$.fragment,e),c(Je.$$.fragment,e),c(je.$$.fragment,e),c(be.$$.fragment,e),$s=!0)},o(e){m(w.$$.fragment,e),m(U.$$.fragment,e),m(T.$$.fragment,e),m(v.$$.fragment,e),m(C.$$.fragment,e),m(G.$$.fragment,e),m(Q.$$.fragment,e),m(X.$$.fragment,e),m(z.$$.fragment,e),m(_.$$.fragment,e),m(W.$$.fragment,e),m(R.$$.fragment,e),m(S.$$.fragment,e),m(q.$$.fragment,e),m(H.$$.fragment,e),m(k.$$.fragment,e),m(A.$$.fragment,e),m(O.$$.fragment,e),m(se.$$.fragment,e),m(ae.$$.fragment,e),m(pe.$$.fragment,e),m(re.$$.fragment,e),m(me.$$.fragment,e),m(Je.$$.fragment,e),m(je.$$.fragment,e),m(be.$$.fragment,e),$s=!1},d(e){e&&(t(Be),t(fe),t(ge),t(Ve),t(Ze),t(ve),t(j),t(Ce),t(h),t(Ge),t(b),t(Qe),t(f),t($e),t(I),t(xe),t(B),t(Xe),t(g),t(ze),t(V),t(_e),t(Z),t(We),t(Re),t(Se),t(qe),t(Ee),t($),t(He),t(x),t(Ne),t(Fe),t(ke),t(Ae),t(Ye),t(Le),t(Pe),t(De),t(E),t(Oe),t(Ke),t(N),t(es),t(F),t(ss),t(ts),t(ls),t(Y),t(ns),t(L),t(as),t(P),t(is),t(D),t(ps),t(os),t(K),t(rs),t(ee),t(us),t(Ms),t(te),t(cs),t(le),t(ms),t(ne),t(ys),t(ds),t(ie),t(Js),t(ws),t(oe),t(Us),t(Ts),t(ue),t(js),t(Me),t(hs),t(ce),t(bs),t(fs),t(ye),t(Is),t(de),t(Bs),t(gs),t(we),t(Vs),t(Ue),t(Zs),t(Te),t(vs),t(Cs),t(he),t(Gs),t(Qs),t(Ie)),t(J),y(w,e),y(U,e),y(T,e),y(v,e),y(C,e),y(G,e),y(Q,e),y(X,e),y(z,e),y(_,e),y(W,e),y(R,e),y(S,e),y(q,e),y(H,e),y(k,e),y(A,e),y(O,e),y(se,e),y(ae,e),y(pe,e),y(re,e),y(me,e),y(Je,e),y(je,e),y(be,e)}}}const vt='{"title":"RAG avec citation des sources grâce à la génération structurée","local":"rag-avec-citation-des-sources-grâce-à-la-génération-structurée","sections":[{"title":"Prompter le modèle","local":"prompter-le-modèle","sections":[],"depth":2},{"title":"👉 Décodage contraint","local":"-décodage-contraint","sections":[{"title":"Grammaire sur un pipeline local avec Outlines","local":"grammaire-sur-un-pipeline-local-avec-outlines","sections":[],"depth":3}],"depth":2}],"depth":1}';function Ct(Xs){return jt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Xt extends ht{constructor(J){super(),bt(this,J,Ct,Zt,Ut,{})}}export{Xt as component};
