import{s as Js,n as Us,o as ws}from"../chunks/scheduler.71ff668b.js";import{S as Ts,i as js,g as i,s as n,r,A as hs,h as p,f as s,c as a,j as ys,u,x as o,k as ds,y as bs,a as l,v as M,d as c,t as m,w as y}from"../chunks/index.e0973da1.js";import{D as fs,C as d}from"../chunks/DocNotebookDropdown.f73c5751.js";import{H as Qt,E as Is}from"../chunks/index.4cdf1819.js";function Bs(Xt){let J,Ie,be,Be,U,Ve,w,ge,T,$t='<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>',Ze,j,xt="<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.",ve,h,_t="Les cas d’utilisation sont nombreux :",Ge,b,zt="<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>",Ce,f,Wt="Dans ce <em>notebook</em>, nous démontrons spécifiquement le dernier cas d’utilisation :",Qe,I,Rt="<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,B,St='Si vous avez besoin d’une introduction à la méthode RAG, vous pouvez consulter <a href="advanced_rag">cet autre recette</a>.',$e,V,qt="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.",xe,g,Et='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é.',_e,Z,ze,v,We,G,Re,C,Se,Q,Ht="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.",qe,X,Nt=`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).`,Ee,$,He,x,Ne,_,Fe,z,ke,W,Ye,R,Ae,S,Le,q,Ft=`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:
`,Pe,E,De,H,kt=`&#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"]
}
`,Oe,N,Yt="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>.",Ke,F,et,k,tt,Y,At=`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.
`,st,A,Lt="Cela fonctionne ! 🥳",lt,L,Pt="Mais qu’en est-il de l’utilisation d’un modèle moins puissant ?",nt,P,Dt="Pour simuler les sorties éventuellement moins cohérentes d’un modèle moins puissant, nous augmentons la température.",at,D,it,O,Ot=`&#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
`,pt,K,Kt="Maintenant, le résultat n’est même plus un JSON correct.",ot,ee,rt,te,es="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>.",ut,se,ts="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.",Mt,le,ss='Ici, par exemple, nous suivons les <a href="https://docs.pydantic.dev/latest/api/types/" rel="nofollow">types pydantic</a>.',ct,ne,mt,ae,ls="Je conseille d’inspecter le schéma généré pour vérifier qu’il répond correctement vos besoins :",yt,ie,dt,pe,ns="Vous pouvez utiliser la méthode <code>text_generation</code> du client ou sa méthode <code>post</code>.",Jt,oe,Ut,re,as=`&#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"]
}
`,wt,ue,is="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 !",Tt,Me,ps="Elle peut alors être parsée en vue d’un traitement ultérieur.",jt,ce,ht,me,os='<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.',bt,ye,rs='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.',ft,de,It,Je,us='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).',Bt,Ue,Ms="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.",Vt,we,cs=`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>`,gt,Te,Zt,je,ms="C’est tout pour aujourd’hui, félicitations de nous avoir suivis ! 👏",vt,he,Gt,fe,Ct;return U=new fs({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"}]}}),w=new Qt({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"}}),Z=new d({props:{code:"IXBpcCUyMGluc3RhbGwlMjBwYW5kYXMlMjBqc29uJTIwaHVnZ2luZ2ZhY2VfaHViJTIwcHlkYW50aWMlMjBvdXRsaW5lcyUyMGFjY2VsZXJhdGUlMjAtcQ==",highlighted:"!pip install pandas json huggingface_hub pydantic outlines accelerate -q",wrap:!1}}),v=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}}),C=new Qt({props:{title:"Prompter le modèle",local:"prompter-le-modèle",headingTag:"h2"}}),$=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}}),x=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:"UkFHX1BST01QVF9URU1QTEFURV9KU09OJTIwJTNEJTIwJTIyJTIyJTIyJTBBQW5zd2VyJTIwdGhlJTIwdXNlciUyMHF1ZXJ5JTIwYmFzZWQlMjBvbiUyMHRoZSUyMHNvdXJjZSUyMGRvY3VtZW50cy4lMEElMEFIZXJlJTIwYXJlJTIwdGhlJTIwc291cmNlJTIwZG9jdW1lbnRzJTNBJTIwJTdCY29udGV4dCU3RCUwQSUwQSUwQVlvdSUyMHNob3VsZCUyMHByb3ZpZGUlMjB5b3VyJTIwYW5zd2VyJTIwYXMlMjBhJTIwSlNPTiUyMGJsb2IlMkMlMjBhbmQlMjBhbHNvJTIwcHJvdmlkZSUyMGFsbCUyMHJlbGV2YW50JTIwc2hvcnQlMjBzb3VyY2UlMjBzbmlwcGV0cyUyMGZyb20lMjB0aGUlMjBkb2N1bWVudHMl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yMHRoZSUyMHVzZXIlMjBxdWVzdGlvbiUzQSUyMCU3QnVzZXJfcXVlcnklN0QuJTBBQW5zd2VyJTNBJTBBJTIyJTIyJTIy",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}}),z=new d({props:{code:"JTIzJTIzJTIwQ2VsbHVsZSUyMHByJUMzJUE5YyVDMyVBOWRlbnRlJTIwdHJhZHVpdGUlMjBlbiUyMGZyYW4lQzMlQTdhaXMlMEFSQUdfUFJPTVBUX1RFTVBMQVRFX0pTT04lMjAlM0QlMjAlMjIlMjIlMjIlMEFSJUMzJUE5cG9uZHJlJTIwJUMzJUEwJTIwbGElMjByZXF1JUMzJUFBdGUlMjBkZSUyMGwndXRpbGlzYXRldXIlMjBzdXIlMjBsYSUyMGJhc2UlMjBkZXMlMjBkb2N1bWVudHMlMjBzb3VyY2VzLiUwQSUwQVZvaWNpJTIwbGVzJTIwZG9jdW1lbnRzJTIwc291cmNlcyUyMCUzQSUyMCU3QmNvbnRleHQlN0QlMEElMEElMEFWb3VzJTIwZGV2ZXolMjBmb3VybmlyJTIwdm90cmUlMjByJUMzJUE5cG9uc2UlMjBzb3VzJTIwbGElMjBmb3JtZSUyMGQndW4lMjBibG9iJTIwSlNPTiUyQyUyMGFpbnNpJTIwcXVlJTIwdG91cyU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CUzQSUwQSU3QiU3QiUwQSUyMCUyMCUyMmFuc3dlciUyMiUzQSUyMHlvdXJfYW5zd2VyJTJDJTBBJTIwJTIwJTIyY29uZmlkZW5jZV9zY29yZSUyMiUzQSUyMHlvdXJfY29uZmlkZW5jZV9zY29yZSUyQyUwQSUyMCUyMCUyMnNvdXJjZV9zbmlwcGV0cyUyMiUzQSUyMCU1QiUyMnNuaXBwZXRfMSUyMiUyQyUyMCUyMnNuaXBwZXRfMiUyMiUyQyUyMC4uLiU1RCUwQSU3RCU3RCUwQUZpbiUyMGRlJTIwbGElMjByJUMzJUE5cG9uc2UuJTBBJTBBTWFpbnRlbmFudCUyQyUyMGNvbW1lbmNleiUyMCElMEFWb2ljaSUyMGxhJTIwcXVlc3Rpb24lMjBkZSUyMGwndXRpbGlzYXRldXIlMjAlM0ElMjAlN0J1c2VyX3F1ZXJ5JTdELiUwQVIlQzMlQTlwb25zZSUyMCUzQSUwQSUyMiUyMiUyMg==",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}}),W=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}}),R=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}}),S=new d({props:{code:"cHJvbXB0JTIwJTNEJTIwUkFHX1BST01QVF9URU1QTEFURV9KU09OLmZvcm1hdChjb250ZXh0JTNEUkVMRVZBTlRfQ09OVEVYVCUyQyUyMHVzZXJfcXVlcnklM0RVU0VSX1FVRVJZKSUwQXByaW50KHByb21wdCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = RAG_PROMPT_TEMPLATE_JSON.<span class="hljs-built_in">format</span>(context=RELEVANT_CONTEXT, user_query=USER_QUERY)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(prompt)`,wrap:!1}}),E=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}}),F=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}}),k=new d({props:{code:"ZGVmJTIwaGlnaGxpZ2h0KHMpJTNBJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwJTIyJTVDeDFiJTVCMSUzQjMybSUyMiUyMCUyQiUyMHMlMjAlMkIlMjAlMjIlNUN4MWIlNUIwbSUyMiUwQSUwQSUwQWRlZiUyMHByaW50X3Jlc3VsdHMoYW5zd2VyJTJDJTIwc291cmNlX3RleHQlMkMlMjBoaWdobGlnaHRfc25pcHBldHMpJTNBJTBBJTIwJTIwJTIwJTIwcHJpbnQoJTIyQW5zd2VyJTNBJTIyJTJDJTIwaGlnaGxpZ2h0KGFuc3dlcikpJTBBJTIwJTIwJTIwJTIwcHJpbnQoJTIyJTVDbiU1Q24lMjIlMkMlMjAlMjIlM0QlMjIlMjAqJTIwMTAlMjAlMkIlMjAlMjIlMjBTb3VyY2UlMjBkb2N1bWVudHMlMjAlMjIlMjAlMkIlMjAlMjIlM0QlMjIlMjAqJTIwMTApJTBBJTIwJTIwJTIwJTIwZm9yJTIwc25pcHBldCUyMGluJTIwaGlnaGxpZ2h0X3NuaXBwZXRzJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwc291cmNlX3RleHQlMjAlM0QlMjBzb3VyY2VfdGV4dC5yZXBsYWNlKHNuaXBwZXQuc3RyaXAoKSUyQyUyMGhpZ2hsaWdodChzbmlwcGV0LnN0cmlwKCkpKSUwQSUyMCUyMCUyMCUyMHByaW50KHNvdXJjZV90ZXh0KSUwQSUwQSUwQXByaW50X3Jlc3VsdHMocGFyc2VkX2Fuc3dlciU1QiUyMmFuc3dlciUyMiU1RCUyQyUyMFJFTEVWQU5UX0NPTlRFWFQlMkMlMjBwYXJzZWRfYW5zd2VyJTVCJTIyc291cmNlX3NuaXBwZXRzJTIyJTVEKQ==",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(parsed_answer[<span class="hljs-string">&quot;answer&quot;</span>], RELEVANT_CONTEXT, parsed_answer[<span class="hljs-string">&quot;source_snippets&quot;</span>])`,wrap:!1}}),D=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}}),ee=new Qt({props:{title:"👉 Décodage contraint",local:"-décodage-contraint",headingTag:"h2"}}),ne=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}}),ie=new d({props:{code:"QW5zd2VyV2l0aFNuaXBwZXRzLnNjaGVtYSgp",highlighted:"AnswerWithSnippets.schema()",wrap:!1}}),oe=new d({props:{code:"JTIzJTIwVXNpbmclMjB0ZXh0X2dlbmVyYXRpb24lMEFhbnN3ZXIlMjAlM0QlMjBsbG1fY2xpZW50LnRleHRfZ2VuZXJhdGlvbiglMEElMjAlMjAlMjAlMjBwcm9tcHQlMkMlMEElMjAlMjAlMjAlMj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U1RCUwQXByaW50KGFuc3dlcik=",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}}),ce=new Qt({props:{title:"Grammaire sur un pipeline local avec Outlines",local:"grammaire-sur-un-pipeline-local-avec-outlines",headingTag:"h3"}}),de=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}}),Te=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}}),he=new Is({props:{source:"https://github.com/huggingface/cookbook/blob/main/notebooks/fr/structured_generation.md"}}),{c(){J=i("meta"),Ie=n(),be=i("p"),Be=n(),r(U.$$.fragment),Ve=n(),r(w.$$.fragment),ge=n(),T=i("p"),T.innerHTML=$t,Ze=n(),j=i("p"),j.innerHTML=xt,ve=n(),h=i("p"),h.textContent=_t,Ge=n(),b=i("ul"),b.innerHTML=zt,Ce=n(),f=i("p"),f.innerHTML=Wt,Qe=n(),I=i("p"),I.innerHTML=Rt,Xe=n(),B=i("p"),B.innerHTML=St,$e=n(),V=i("p"),V.innerHTML=qt,xe=n(),g=i("p"),g.innerHTML=Et,_e=n(),r(Z.$$.fragment),ze=n(),r(v.$$.fragment),We=n(),r(G.$$.fragment),Re=n(),r(C.$$.fragment),Se=n(),Q=i("p"),Q.textContent=Ht,qe=n(),X=i("p"),X.textContent=Nt,Ee=n(),r($.$$.fragment),He=n(),r(x.$$.fragment),Ne=n(),r(_.$$.fragment),Fe=n(),r(z.$$.fragment),ke=n(),r(W.$$.fragment),Ye=n(),r(R.$$.fragment),Ae=n(),r(S.$$.fragment),Le=n(),q=i("pre"),q.textContent=Ft,Pe=n(),r(E.$$.fragment),De=n(),H=i("pre"),H.textContent=kt,Oe=n(),N=i("p"),N.innerHTML=Yt,Ke=n(),r(F.$$.fragment),et=n(),r(k.$$.fragment),tt=n(),Y=i("pre"),Y.textContent=At,st=n(),A=i("p"),A.textContent=Lt,lt=n(),L=i("p"),L.textContent=Pt,nt=n(),P=i("p"),P.textContent=Dt,at=n(),r(D.$$.fragment),it=n(),O=i("pre"),O.textContent=Ot,pt=n(),K=i("p"),K.textContent=Kt,ot=n(),r(ee.$$.fragment),rt=n(),te=i("p"),te.innerHTML=es,ut=n(),se=i("p"),se.textContent=ts,Mt=n(),le=i("p"),le.innerHTML=ss,ct=n(),r(ne.$$.fragment),mt=n(),ae=i("p"),ae.textContent=ls,yt=n(),r(ie.$$.fragment),dt=n(),pe=i("p"),pe.innerHTML=ns,Jt=n(),r(oe.$$.fragment),Ut=n(),re=i("pre"),re.textContent=as,wt=n(),ue=i("p"),ue.textContent=is,Tt=n(),Me=i("p"),Me.textContent=ps,jt=n(),r(ce.$$.fragment),ht=n(),me=i("p"),me.innerHTML=os,bt=n(),ye=i("p"),ye.innerHTML=rs,ft=n(),r(de.$$.fragment),It=n(),Je=i("p"),Je.innerHTML=us,Bt=n(),Ue=i("p"),Ue.textContent=Ms,Vt=n(),we=i("p"),we.innerHTML=cs,gt=n(),r(Te.$$.fragment),Zt=n(),je=i("p"),je.textContent=ms,vt=n(),r(he.$$.fragment),Gt=n(),fe=i("p"),this.h()},l(e){const t=hs("svelte-u9bgzb",document.head);J=p(t,"META",{name:!0,content:!0}),t.forEach(s),Ie=a(e),be=p(e,"P",{}),ys(be).forEach(s),Be=a(e),u(U.$$.fragment,e),Ve=a(e),u(w.$$.fragment,e),ge=a(e),T=p(e,"P",{"data-svelte-h":!0}),o(T)!=="svelte-1l7y2r"&&(T.innerHTML=$t),Ze=a(e),j=p(e,"P",{"data-svelte-h":!0}),o(j)!=="svelte-ffuwbl"&&(j.innerHTML=xt),ve=a(e),h=p(e,"P",{"data-svelte-h":!0}),o(h)!=="svelte-v0fegf"&&(h.textContent=_t),Ge=a(e),b=p(e,"UL",{"data-svelte-h":!0}),o(b)!=="svelte-sogma6"&&(b.innerHTML=zt),Ce=a(e),f=p(e,"P",{"data-svelte-h":!0}),o(f)!=="svelte-lkm64j"&&(f.innerHTML=Wt),Qe=a(e),I=p(e,"P",{"data-svelte-h":!0}),o(I)!=="svelte-rdnakw"&&(I.innerHTML=Rt),Xe=a(e),B=p(e,"P",{"data-svelte-h":!0}),o(B)!=="svelte-1rr2wgd"&&(B.innerHTML=St),$e=a(e),V=p(e,"P",{"data-svelte-h":!0}),o(V)!=="svelte-1l5mjsv"&&(V.innerHTML=qt),xe=a(e),g=p(e,"P",{"data-svelte-h":!0}),o(g)!=="svelte-12olb9c"&&(g.innerHTML=Et),_e=a(e),u(Z.$$.fragment,e),ze=a(e),u(v.$$.fragment,e),We=a(e),u(G.$$.fragment,e),Re=a(e),u(C.$$.fragment,e),Se=a(e),Q=p(e,"P",{"data-svelte-h":!0}),o(Q)!=="svelte-8hyr7r"&&(Q.textContent=Ht),qe=a(e),X=p(e,"P",{"data-svelte-h":!0}),o(X)!=="svelte-1s9mmkj"&&(X.textContent=Nt),Ee=a(e),u($.$$.fragment,e),He=a(e),u(x.$$.fragment,e),Ne=a(e),u(_.$$.fragment,e),Fe=a(e),u(z.$$.fragment,e),ke=a(e),u(W.$$.fragment,e),Ye=a(e),u(R.$$.fragment,e),Ae=a(e),u(S.$$.fragment,e),Le=a(e),q=p(e,"PRE",{"data-svelte-h":!0}),o(q)!=="svelte-cr71sn"&&(q.textContent=Ft),Pe=a(e),u(E.$$.fragment,e),De=a(e),H=p(e,"PRE",{"data-svelte-h":!0}),o(H)!=="svelte-1uqak8l"&&(H.textContent=kt),Oe=a(e),N=p(e,"P",{"data-svelte-h":!0}),o(N)!=="svelte-12xzcyi"&&(N.innerHTML=Yt),Ke=a(e),u(F.$$.fragment,e),et=a(e),u(k.$$.fragment,e),tt=a(e),Y=p(e,"PRE",{"data-svelte-h":!0}),o(Y)!=="svelte-1oi7qy6"&&(Y.textContent=At),st=a(e),A=p(e,"P",{"data-svelte-h":!0}),o(A)!=="svelte-1lv7xko"&&(A.textContent=Lt),lt=a(e),L=p(e,"P",{"data-svelte-h":!0}),o(L)!=="svelte-1d0iv5u"&&(L.textContent=Pt),nt=a(e),P=p(e,"P",{"data-svelte-h":!0}),o(P)!=="svelte-10dr2bm"&&(P.textContent=Dt),at=a(e),u(D.$$.fragment,e),it=a(e),O=p(e,"PRE",{"data-svelte-h":!0}),o(O)!=="svelte-1ez34l3"&&(O.textContent=Ot),pt=a(e),K=p(e,"P",{"data-svelte-h":!0}),o(K)!=="svelte-1e1eym9"&&(K.textContent=Kt),ot=a(e),u(ee.$$.fragment,e),rt=a(e),te=p(e,"P",{"data-svelte-h":!0}),o(te)!=="svelte-1dh3sy9"&&(te.innerHTML=es),ut=a(e),se=p(e,"P",{"data-svelte-h":!0}),o(se)!=="svelte-2ne03w"&&(se.textContent=ts),Mt=a(e),le=p(e,"P",{"data-svelte-h":!0}),o(le)!=="svelte-1opela7"&&(le.innerHTML=ss),ct=a(e),u(ne.$$.fragment,e),mt=a(e),ae=p(e,"P",{"data-svelte-h":!0}),o(ae)!=="svelte-6eqw09"&&(ae.textContent=ls),yt=a(e),u(ie.$$.fragment,e),dt=a(e),pe=p(e,"P",{"data-svelte-h":!0}),o(pe)!=="svelte-1568ef8"&&(pe.innerHTML=ns),Jt=a(e),u(oe.$$.fragment,e),Ut=a(e),re=p(e,"PRE",{"data-svelte-h":!0}),o(re)!=="svelte-zi5fqp"&&(re.textContent=as),wt=a(e),ue=p(e,"P",{"data-svelte-h":!0}),o(ue)!=="svelte-1clvrnf"&&(ue.textContent=is),Tt=a(e),Me=p(e,"P",{"data-svelte-h":!0}),o(Me)!=="svelte-8b0f6z"&&(Me.textContent=ps),jt=a(e),u(ce.$$.fragment,e),ht=a(e),me=p(e,"P",{"data-svelte-h":!0}),o(me)!=="svelte-1idxwm9"&&(me.innerHTML=os),bt=a(e),ye=p(e,"P",{"data-svelte-h":!0}),o(ye)!=="svelte-mwr8h9"&&(ye.innerHTML=rs),ft=a(e),u(de.$$.fragment,e),It=a(e),Je=p(e,"P",{"data-svelte-h":!0}),o(Je)!=="svelte-e15fln"&&(Je.innerHTML=us),Bt=a(e),Ue=p(e,"P",{"data-svelte-h":!0}),o(Ue)!=="svelte-1iw2rme"&&(Ue.textContent=Ms),Vt=a(e),we=p(e,"P",{"data-svelte-h":!0}),o(we)!=="svelte-z6vpv7"&&(we.innerHTML=cs),gt=a(e),u(Te.$$.fragment,e),Zt=a(e),je=p(e,"P",{"data-svelte-h":!0}),o(je)!=="svelte-1i1bdfw"&&(je.textContent=ms),vt=a(e),u(he.$$.fragment,e),Gt=a(e),fe=p(e,"P",{}),ys(fe).forEach(s),this.h()},h(){ds(J,"name","hf:doc:metadata"),ds(J,"content",Vs)},m(e,t){bs(document.head,J),l(e,Ie,t),l(e,be,t),l(e,Be,t),M(U,e,t),l(e,Ve,t),M(w,e,t),l(e,ge,t),l(e,T,t),l(e,Ze,t),l(e,j,t),l(e,ve,t),l(e,h,t),l(e,Ge,t),l(e,b,t),l(e,Ce,t),l(e,f,t),l(e,Qe,t),l(e,I,t),l(e,Xe,t),l(e,B,t),l(e,$e,t),l(e,V,t),l(e,xe,t),l(e,g,t),l(e,_e,t),M(Z,e,t),l(e,ze,t),M(v,e,t),l(e,We,t),M(G,e,t),l(e,Re,t),M(C,e,t),l(e,Se,t),l(e,Q,t),l(e,qe,t),l(e,X,t),l(e,Ee,t),M($,e,t),l(e,He,t),M(x,e,t),l(e,Ne,t),M(_,e,t),l(e,Fe,t),M(z,e,t),l(e,ke,t),M(W,e,t),l(e,Ye,t),M(R,e,t),l(e,Ae,t),M(S,e,t),l(e,Le,t),l(e,q,t),l(e,Pe,t),M(E,e,t),l(e,De,t),l(e,H,t),l(e,Oe,t),l(e,N,t),l(e,Ke,t),M(F,e,t),l(e,et,t),M(k,e,t),l(e,tt,t),l(e,Y,t),l(e,st,t),l(e,A,t),l(e,lt,t),l(e,L,t),l(e,nt,t),l(e,P,t),l(e,at,t),M(D,e,t),l(e,it,t),l(e,O,t),l(e,pt,t),l(e,K,t),l(e,ot,t),M(ee,e,t),l(e,rt,t),l(e,te,t),l(e,ut,t),l(e,se,t),l(e,Mt,t),l(e,le,t),l(e,ct,t),M(ne,e,t),l(e,mt,t),l(e,ae,t),l(e,yt,t),M(ie,e,t),l(e,dt,t),l(e,pe,t),l(e,Jt,t),M(oe,e,t),l(e,Ut,t),l(e,re,t),l(e,wt,t),l(e,ue,t),l(e,Tt,t),l(e,Me,t),l(e,jt,t),M(ce,e,t),l(e,ht,t),l(e,me,t),l(e,bt,t),l(e,ye,t),l(e,ft,t),M(de,e,t),l(e,It,t),l(e,Je,t),l(e,Bt,t),l(e,Ue,t),l(e,Vt,t),l(e,we,t),l(e,gt,t),M(Te,e,t),l(e,Zt,t),l(e,je,t),l(e,vt,t),M(he,e,t),l(e,Gt,t),l(e,fe,t),Ct=!0},p:Us,i(e){Ct||(c(U.$$.fragment,e),c(w.$$.fragment,e),c(Z.$$.fragment,e),c(v.$$.fragment,e),c(G.$$.fragment,e),c(C.$$.fragment,e),c($.$$.fragment,e),c(x.$$.fragment,e),c(_.$$.fragment,e),c(z.$$.fragment,e),c(W.$$.fragment,e),c(R.$$.fragment,e),c(S.$$.fragment,e),c(E.$$.fragment,e),c(F.$$.fragment,e),c(k.$$.fragment,e),c(D.$$.fragment,e),c(ee.$$.fragment,e),c(ne.$$.fragment,e),c(ie.$$.fragment,e),c(oe.$$.fragment,e),c(ce.$$.fragment,e),c(de.$$.fragment,e),c(Te.$$.fragment,e),c(he.$$.fragment,e),Ct=!0)},o(e){m(U.$$.fragment,e),m(w.$$.fragment,e),m(Z.$$.fragment,e),m(v.$$.fragment,e),m(G.$$.fragment,e),m(C.$$.fragment,e),m($.$$.fragment,e),m(x.$$.fragment,e),m(_.$$.fragment,e),m(z.$$.fragment,e),m(W.$$.fragment,e),m(R.$$.fragment,e),m(S.$$.fragment,e),m(E.$$.fragment,e),m(F.$$.fragment,e),m(k.$$.fragment,e),m(D.$$.fragment,e),m(ee.$$.fragment,e),m(ne.$$.fragment,e),m(ie.$$.fragment,e),m(oe.$$.fragment,e),m(ce.$$.fragment,e),m(de.$$.fragment,e),m(Te.$$.fragment,e),m(he.$$.fragment,e),Ct=!1},d(e){e&&(s(Ie),s(be),s(Be),s(Ve),s(ge),s(T),s(Ze),s(j),s(ve),s(h),s(Ge),s(b),s(Ce),s(f),s(Qe),s(I),s(Xe),s(B),s($e),s(V),s(xe),s(g),s(_e),s(ze),s(We),s(Re),s(Se),s(Q),s(qe),s(X),s(Ee),s(He),s(Ne),s(Fe),s(ke),s(Ye),s(Ae),s(Le),s(q),s(Pe),s(De),s(H),s(Oe),s(N),s(Ke),s(et),s(tt),s(Y),s(st),s(A),s(lt),s(L),s(nt),s(P),s(at),s(it),s(O),s(pt),s(K),s(ot),s(rt),s(te),s(ut),s(se),s(Mt),s(le),s(ct),s(mt),s(ae),s(yt),s(dt),s(pe),s(Jt),s(Ut),s(re),s(wt),s(ue),s(Tt),s(Me),s(jt),s(ht),s(me),s(bt),s(ye),s(ft),s(It),s(Je),s(Bt),s(Ue),s(Vt),s(we),s(gt),s(Zt),s(je),s(vt),s(Gt),s(fe)),s(J),y(U,e),y(w,e),y(Z,e),y(v,e),y(G,e),y(C,e),y($,e),y(x,e),y(_,e),y(z,e),y(W,e),y(R,e),y(S,e),y(E,e),y(F,e),y(k,e),y(D,e),y(ee,e),y(ne,e),y(ie,e),y(oe,e),y(ce,e),y(de,e),y(Te,e),y(he,e)}}}const Vs='{"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 gs(Xt){return ws(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Qs extends Ts{constructor(J){super(),js(this,J,gs,Bs,Js,{})}}export{Qs as component};
