import{s as Ms,n as ms,o as hs}from"../chunks/scheduler.39a43cde.js";import{S as ws,i as ys,g as p,s as n,r,A as ds,h as o,f as s,c as a,j as rs,u,x as i,k as us,y as Ts,a as l,v as c,d as M,t as m,w as h}from"../chunks/index.23ec2204.js";import{D as Js,C as w}from"../chunks/DocNotebookDropdown.21a75b74.js";import{H as cs,E as js}from"../chunks/EditOnGithub.f2d09226.js";function fs(Bt){let y,fe,Je,Ue,d,be,T,ge,J,Ct='<em>Authored by: <a href="https://huggingface.co/m-ric" rel="nofollow">Aymeric Roucher</a></em>',Ie,j,_t="<strong>Structured generation</strong> is a method that forces the LLM output to follow certain constraints, for instance to follow a specific pattern.",Be,f,Zt="This has numerous use cases:",Ce,U,vt="<li>✅ Output a dictionary with specific keys</li> <li>📏 Make sure the output will be longer than N characters</li> <li>⚙️ More generally, force the output to follow a certain regex pattern for downtream processing.</li> <li>💡 Highlight sources supporting the answer in Retrieval-Augmented-Generation (RAG)</li>",_e,b,xt="In this notebook, we demonstrate specifically the last use case:",Ze,g,Gt="<strong>➡️ We build a RAG system that not only provides an answer, but also highlights the supporting snippets that this answer is based on.</strong>",ve,I,Vt='<em>If you need an introduction to RAG, you can check out <a href="advanced_rag">this other cookbook</a>.</em>',xe,B,$t="This notebook first shows a naive approach to structured generation via prompting and highlights its limits, then demonstrates constrained decoding for more efficient structured generation.",Ge,C,Qt='It leverages HuggingFace Inference Endpoints (the example shows a <a href="https://huggingface.co/docs/api-inference/quicktour" rel="nofollow">serverless</a> endpoint, but you can directly change the endpoint to a <a href="https://huggingface.co/docs/inference-endpoints/en/guides/access" rel="nofollow">dedicated</a> one), then also shows a local pipeline using <a href="https://github.com/outlines-dev/outlines" rel="nofollow">outlines</a>, a structured text generation library.',Ve,_,$e,Z,Qe,v,We,x,Xe,G,Wt="To get structured outputs from your model, you can simply prompt a powerful enough models with appropriate guidelines, and it should work directly… most of the time.",Ee,V,Xt=`In this case, we want the RAG model to generate not only an answer, but also a confidence score and some source snippets.
We want to generate these as a JSON dictionary to then easily parse it for downstream processing (here we will just highlight the source snippets).`,Ne,$,ke,Q,Re,W,He,X,Se,E,Et=`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:
`,qe,N,Ae,k,Nt=`&#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"]
}
`,Ye,R,kt="The output of the LLM is a string representation of a dictionary: so let’s just load it as a dictionary using <code>literal_eval</code>.",ze,H,Fe,S,Le,q,Rt=`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.
`,Pe,A,Ht="This works! 🥳",De,Y,St="But what about using a less powerful model?",Ke,z,qt="To simulate the possibly less coherent outputs of a less powerful model, we increase the temperature.",Oe,F,et,L,At=`&#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
`,tt,P,Yt="Now, the output is not even in correct JSON.",st,D,zt="## 👉 Constrained decoding",lt,K,Ft="To force a JSON output, we’ll have to use <strong>constrained decoding</strong> where we force the LLM to only output tokens that conform to a set of rules called a <strong>grammar</strong>.",nt,O,Lt="This grammar can be defined using Pydantic models, JSON schema, or regular expressions. The AI will then generate a response that conforms to the specified grammar.",at,ee,Pt='Here for instance we follow <a href="https://docs.pydantic.dev/latest/api/types/" rel="nofollow">Pydantic types</a>.',pt,te,ot,se,Dt="I advise inspecting the generated schema to check that it correctly represents your requirements:",it,le,rt,ne,Kt="You can use either the client’s <code>text_generation</code> method or use its <code>post</code> method.",ut,ae,ct,pe,Ot=`&#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"]
}
`,Mt,oe,es="✅ Although the answer is still nonsensical due to the high temperature, the generated output is now correct JSON format, with the exact keys and types we defined in our grammar!",mt,ie,ts="It can then be parsed for further processing.",ht,re,ss="### Grammar on a local pipeline with Outlines",wt,ue,ls='<a href="https://github.com/outlines-dev/outlines/" rel="nofollow">Outlines</a> is the library that runs under the hood on our Inference API to constrain output generation. You can also use it locally.',yt,ce,ns='It works by <a href="https://github.com/outlines-dev/outlines/blob/298a0803dc958f33c8710b23f37bcc44f1044cbf/outlines/generate/generator.py#L143" rel="nofollow">applying a bias on the logits</a> to force selection of only the ones that conform to your constraint.',dt,Me,Tt,me,as='You can also use <a href="https://huggingface.co/docs/text-generation-inference/en/index" rel="nofollow">Text-Generation-Inference</a> with constrained generation (see the <a href="https://huggingface.co/docs/text-generation-inference/en/conceptual/guidance" rel="nofollow">documentation</a> for more details and examples).',Jt,he,ps="Now we’ve demonstrated a specific RAG use-case, but constrained generation is helpful for much more than that.",jt,we,os='For instance in your <a href="llm_judge">LLM judge</a> workflows, you can also use constrained generation to output a JSON, as follows:',ft,ye,Ut,de,is="That’s all for today, congrats for following along! 👏",bt,Te,gt,je,It;return d=new Js({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/cookbook/blob/issue-104-tei-notebook-table/notebooks/en/structured_generation.ipynb"}]}}),T=new cs({props:{title:"RAG with source highlighting using Structured generation",local:"rag-with-source-highlighting-using-structured-generation",headingTag:"h1"}}),_=new w({props:{code:"IXBpcCUyMGluc3RhbGwlMjBwYW5kYXMlMjBqc29uJTIwaHVnZ2luZ2ZhY2VfaHViJTIwcHlkYW50aWMlMjBvdXRsaW5lcyUyMGFjY2VsZXJhdGUlMjAtcQ==",highlighted:"!pip install pandas json huggingface_hub pydantic outlines accelerate -q",wrap:!1}}),Z=new w({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}}),v=new w({props:{code:"cmVwb19pZCUyMCUzRCUyMCUyMm1ldGEtbGxhbWElMkZNZXRhLUxsYW1hLTMtOEItSW5zdHJ1Y3QlMjIlMEElMEFsbG1fY2xpZW50JTIwJTNEJTIwSW5mZXJlbmNlQ2xpZW50KG1vZGVsJTNEcmVwb19pZCUyQyUyMHRpbWVvdXQlM0QxMjApJTBBJTBBJTIzJTIwVGVzdCUyMHlvdXIlMjBMTE0lMjBjbGllbnQlMEFsbG1fY2xpZW50LnRleHRfZ2VuZXJhdGlvbihwcm9tcHQlM0QlMjJIb3clMjBhcmUlMjB5b3UlMjB0b2RheSUzRiUyMiUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMjAp",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"># Test your LLM client</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}}),x=new cs({props:{title:"Prompting the model",local:"prompting-the-model",headingTag:"h2"}}),$=new w({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}}),Q=new w({props:{code:"UkFHX1BST01QVF9URU1QTEFURV9KU09OJTIwJTNEJTIwJTIyJTIyJTIyJTBBQW5zd2VyJTIwdGhlJTIwdXNlciUyMHF1ZXJ5JTIwYmFzZWQlMjBvbiUyMHRoZSUyMHNvdXJjZSUyMGRvY3VtZW50cy4lMEElMEFIZXJlJTIwYXJlJTIwdGhlJTIwc291cmNlJTIwZG9jdW1lbnRzJTNBJTIwJTdCY29udGV4dCU3RCUwQSUwQSUwQVlvdSUyMHNob3VsZCUyMHByb3ZpZGUlMjB5b3VyJTIwYW5zd2VyJTIwYXMlMjBhJTIwSlNPTiUyMGJsb2IlMkMlMjBhbmQlMjBhbHNvJTIwcHJvdmlkZSUyMGFsbCUyMHJlbGV2YW50JTIwc2hvcnQlMjBzb3VyY2UlMjBzbmlwcGV0cyUyMGZyb20lMjB0aGUlMjBkb2N1bWVudHMlMjBvbiUyMHdoaWNoJTIweW91JTIwZGlyZWN0bHklMjBiYXNlZCUyMHlvdXIlMjBhbnN3ZXIlMkMlMjBhbmQlMjBhJTIwY29uZmlkZW5jZSUyMHNjb3JlJTIwYXMlMjBhJTIwZmxvYXQlMjBiZXR3ZWVuJTIwMCUyMGFuZCUyMDEuJTBBVGhlJTIwc291cmNlJTIwc25pcHBldHMlMjBzaG91bGQlMjBiZSUyMHZlcnklMjBzaG9ydCUyQyUyMGElMjBmZXclMjB3b3JkcyUyMGF0JTIwbW9zdCUyQyUyMG5vdCUyMHdob2xlJTIwc2VudGVuY2VzISUyMEFuZCUyMHRoZXklMjBNVVNUJTIwYmUlMjBleHRyYWN0ZWQlMjBmcm9tJTIwdGhlJTIwY29udGV4dCUyQyUyMHdpdGglMjB0aGUlMjBleGFjdCUyMHNhbWUlMjB3b3JkaW5nJTIwYW5kJTIwc3BlbGxpbmcuJTBBJTBBWW91ciUyMGFuc3dlciUyMHNob3VsZCUyMGJlJTIwYnVpbHQlMjBhcyUyMGZvbGxvd3MlMkMlMjBpdCUyMG11c3QlMjBjb250YWluJTIwdGhlJTIwJTIyQW5zd2VyJTNBJTIyJTIwYW5kJTIwJTIyRW5kJTIwb2YlMjBhbnN3ZXIuJTIyJTIwc2VxdWVuY2VzLiUwQSUwQUFuc3dlciUzQSUwQSU3QiU3QiUwQSUyMCUyMCUyMmFuc3dlciUyMiUzQSUyMHlvdXJfYW5zd2VyJTJDJTBBJTIwJTIwJTIyY29uZmlkZW5jZV9zY29yZSUyMiUzQSUyMHlvdXJfY29uZmlkZW5jZV9zY29yZSUyQyUwQSUyMCUyMCUyMnNvdXJjZV9zbmlwcGV0cyUyMiUzQSUyMCU1QiUyMnNuaXBwZXRfMSUyMiUyQyUyMCUyMnNuaXBwZXRfMiUyMiUyQyUyMC4uLiU1RCUwQSU3RCU3RCUwQUVuZCUyMG9mJTIwYW5zd2VyLiUwQSUwQU5vdyUyMGJlZ2luISUwQUhlcmUlMjBpcyUyMHRoZSUyMHVzZXIlMjBxdWVzdGlvbiUzQSUyMCU3QnVzZXJfcXVlcnklN0QuJTBBQW5zd2VyJTNBJTBBJTIyJTIyJTIy",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 w({props:{code:"VVNFUl9RVUVSWSUyMCUzRCUyMCUyMkhvdyUyMGNhbiUyMEklMjBkZWZpbmUlMjBhJTIwc3RvcCUyMHNlcXVlbmNlJTIwaW4lMjBUcmFuc2Zvcm1lcnMlM0YlMjI=",highlighted:'USER_QUERY = <span class="hljs-string">&quot;How can I define a stop sequence in Transformers?&quot;</span>',wrap:!1}}),X=new w({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}}),N=new w({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}}),H=new w({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}}),S=new w({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}}),F=new w({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}}),te=new w({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}}),le=new w({props:{code:"QW5zd2VyV2l0aFNuaXBwZXRzLnNjaGVtYSgp",highlighted:"AnswerWithSnippets.schema()",wrap:!1}}),ae=new w({props:{code:"JTIzJTIwVXNpbmclMjB0ZXh0X2dlbmVyYXRpb24lMEFhbnN3ZXIlMjAlM0QlMjBsbG1fY2xpZW50LnRleHRfZ2VuZXJhdGlvbiglMEElMjAlMjAlMjAlMjBwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBncmFtbWFyJTNEJTdCJTIydHlwZSUyMiUzQSUyMCUyMmpzb24lMjIlMkMlMjAlMjJ2YWx1ZSUyMiUzQSUyMEFuc3dlcldpdGhTbmlwcGV0cy5zY2hlbWEoKSU3RCUyQyUwQSUyMCUyMCUyMCUyMG1heF9uZXdfdG9rZW5zJTNEMjUwJTJDJTBBJTIwJTIwJTIwJTIwdGVtcGVyYXR1cmUlM0QxLjYlMkMlMEElMjAlMjAlMjAlMjByZXR1cm5fZnVsbF90ZXh0JTNERmFsc2UlMkMlMEEpJTBBcHJpbnQoYW5zd2VyKSUwQSUwQSUyMyUyMFVzaW5nJTIwcG9zdCUwQWRhdGElMjAlM0QlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjJpbnB1dHMlMjIlM0ElMjBwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjAlMjJwYXJhbWV0ZXJzJTIyJTNBJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIydGVtcGVyYXR1cmUlMjIlM0ElMjAxLjYlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJyZXR1cm5fZnVsbF90ZXh0JTIyJTNBJTIwRmFsc2UlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJncmFtbWFyJTIyJTNBJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMmpzb24lMjIlMkMlMjAlMjJ2YWx1ZSUyMiUzQSUyMEFuc3dlcldpdGhTbmlwcGV0cy5zY2hlbWEoKSU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMm1heF9uZXdfdG9rZW5zJTIyJTNBJTIwMjUwJTJDJTBBJTIwJTIwJTIwJTIwJTdEJTJDJTBBJTdEJTBBYW5zd2VyJTIwJTNEJTIwanNvbi5sb2FkcyhsbG1fY2xpZW50LnBvc3QoanNvbiUzRGRhdGEpKSU1QjAlNUQlNUIlMjJnZW5lcmF0ZWRfdGV4dCUyMiU1RCUwQXByaW50KGFuc3dlcik=",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 w({props:{code:"aW1wb3J0JTIwb3V0bGluZXMlMEElMEFyZXBvX2lkJTIwJTNEJTIwJTIybXVzdGFmYWFsamFkZXJ5JTJGZ2VtbWEtMkItMTBNJTIyJTBBJTIzJTIwTG9hZCUyMG1vZGVsJTIwbG9jYWxseSUwQW1vZGVsJTIwJTNEJTIwb3V0bGluZXMubW9kZWxzLnRyYW5zZm9ybWVycyhyZXBvX2lkKSUwQSUwQXNjaGVtYV9hc19zdHIlMjAlM0QlMjBqc29uLmR1bXBzKEFuc3dlcldpdGhTbmlwcGV0cy5zY2hlbWEoKSklMEElMEFnZW5lcmF0b3IlMjAlM0QlMjBvdXRsaW5lcy5nZW5lcmF0ZS5qc29uKG1vZGVsJTJDJTIwc2NoZW1hX2FzX3N0ciklMEElMEElMjMlMjBVc2UlMjB0aGUlMjAlNjBnZW5lcmF0b3IlNjAlMjB0byUyMHNhbXBsZSUyMGFuJTIwb3V0cHV0JTIwZnJvbSUyMHRoZSUyMG1vZGVsJTBBcmVzdWx0JTIwJTNEJTIwZ2VuZXJhdG9yKHByb21wdCklMEFwcmludChyZXN1bHQp",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"># Load model locally</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"># Use the \`generator\` to sample an output from the model</span>
result = generator(prompt)
<span class="hljs-built_in">print</span>(result)`,wrap:!1}}),ye=new w({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}}),Te=new js({props:{source:"https://github.com/huggingface/cookbook/blob/main/notebooks/en/structured_generation.md"}}),{c(){y=p("meta"),fe=n(),Je=p("p"),Ue=n(),r(d.$$.fragment),be=n(),r(T.$$.fragment),ge=n(),J=p("p"),J.innerHTML=Ct,Ie=n(),j=p("p"),j.innerHTML=_t,Be=n(),f=p("p"),f.textContent=Zt,Ce=n(),U=p("ul"),U.innerHTML=vt,_e=n(),b=p("p"),b.textContent=xt,Ze=n(),g=p("p"),g.innerHTML=Gt,ve=n(),I=p("p"),I.innerHTML=Vt,xe=n(),B=p("p"),B.textContent=$t,Ge=n(),C=p("p"),C.innerHTML=Qt,Ve=n(),r(_.$$.fragment),$e=n(),r(Z.$$.fragment),Qe=n(),r(v.$$.fragment),We=n(),r(x.$$.fragment),Xe=n(),G=p("p"),G.textContent=Wt,Ee=n(),V=p("p"),V.textContent=Xt,Ne=n(),r($.$$.fragment),ke=n(),r(Q.$$.fragment),Re=n(),r(W.$$.fragment),He=n(),r(X.$$.fragment),Se=n(),E=p("pre"),E.textContent=Et,qe=n(),r(N.$$.fragment),Ae=n(),k=p("pre"),k.textContent=Nt,Ye=n(),R=p("p"),R.innerHTML=kt,ze=n(),r(H.$$.fragment),Fe=n(),r(S.$$.fragment),Le=n(),q=p("pre"),q.textContent=Rt,Pe=n(),A=p("p"),A.textContent=Ht,De=n(),Y=p("p"),Y.textContent=St,Ke=n(),z=p("p"),z.textContent=qt,Oe=n(),r(F.$$.fragment),et=n(),L=p("pre"),L.textContent=At,tt=n(),P=p("p"),P.textContent=Yt,st=n(),D=p("p"),D.textContent=zt,lt=n(),K=p("p"),K.innerHTML=Ft,nt=n(),O=p("p"),O.textContent=Lt,at=n(),ee=p("p"),ee.innerHTML=Pt,pt=n(),r(te.$$.fragment),ot=n(),se=p("p"),se.textContent=Dt,it=n(),r(le.$$.fragment),rt=n(),ne=p("p"),ne.innerHTML=Kt,ut=n(),r(ae.$$.fragment),ct=n(),pe=p("pre"),pe.textContent=Ot,Mt=n(),oe=p("p"),oe.textContent=es,mt=n(),ie=p("p"),ie.textContent=ts,ht=n(),re=p("p"),re.textContent=ss,wt=n(),ue=p("p"),ue.innerHTML=ls,yt=n(),ce=p("p"),ce.innerHTML=ns,dt=n(),r(Me.$$.fragment),Tt=n(),me=p("p"),me.innerHTML=as,Jt=n(),he=p("p"),he.textContent=ps,jt=n(),we=p("p"),we.innerHTML=os,ft=n(),r(ye.$$.fragment),Ut=n(),de=p("p"),de.textContent=is,bt=n(),r(Te.$$.fragment),gt=n(),je=p("p"),this.h()},l(e){const t=ds("svelte-u9bgzb",document.head);y=o(t,"META",{name:!0,content:!0}),t.forEach(s),fe=a(e),Je=o(e,"P",{}),rs(Je).forEach(s),Ue=a(e),u(d.$$.fragment,e),be=a(e),u(T.$$.fragment,e),ge=a(e),J=o(e,"P",{"data-svelte-h":!0}),i(J)!=="svelte-1xlqnsv"&&(J.innerHTML=Ct),Ie=a(e),j=o(e,"P",{"data-svelte-h":!0}),i(j)!=="svelte-v6rqtt"&&(j.innerHTML=_t),Be=a(e),f=o(e,"P",{"data-svelte-h":!0}),i(f)!=="svelte-1erwo6s"&&(f.textContent=Zt),Ce=a(e),U=o(e,"UL",{"data-svelte-h":!0}),i(U)!=="svelte-1gaeexd"&&(U.innerHTML=vt),_e=a(e),b=o(e,"P",{"data-svelte-h":!0}),i(b)!=="svelte-1bihz1e"&&(b.textContent=xt),Ze=a(e),g=o(e,"P",{"data-svelte-h":!0}),i(g)!=="svelte-moca12"&&(g.innerHTML=Gt),ve=a(e),I=o(e,"P",{"data-svelte-h":!0}),i(I)!=="svelte-hpgnfx"&&(I.innerHTML=Vt),xe=a(e),B=o(e,"P",{"data-svelte-h":!0}),i(B)!=="svelte-1n52pmm"&&(B.textContent=$t),Ge=a(e),C=o(e,"P",{"data-svelte-h":!0}),i(C)!=="svelte-cxxavz"&&(C.innerHTML=Qt),Ve=a(e),u(_.$$.fragment,e),$e=a(e),u(Z.$$.fragment,e),Qe=a(e),u(v.$$.fragment,e),We=a(e),u(x.$$.fragment,e),Xe=a(e),G=o(e,"P",{"data-svelte-h":!0}),i(G)!=="svelte-1o8iimq"&&(G.textContent=Wt),Ee=a(e),V=o(e,"P",{"data-svelte-h":!0}),i(V)!=="svelte-1abgq3k"&&(V.textContent=Xt),Ne=a(e),u($.$$.fragment,e),ke=a(e),u(Q.$$.fragment,e),Re=a(e),u(W.$$.fragment,e),He=a(e),u(X.$$.fragment,e),Se=a(e),E=o(e,"PRE",{"data-svelte-h":!0}),i(E)!=="svelte-cr71sn"&&(E.textContent=Et),qe=a(e),u(N.$$.fragment,e),Ae=a(e),k=o(e,"PRE",{"data-svelte-h":!0}),i(k)!=="svelte-1uqak8l"&&(k.textContent=Nt),Ye=a(e),R=o(e,"P",{"data-svelte-h":!0}),i(R)!=="svelte-1g3q39s"&&(R.innerHTML=kt),ze=a(e),u(H.$$.fragment,e),Fe=a(e),u(S.$$.fragment,e),Le=a(e),q=o(e,"PRE",{"data-svelte-h":!0}),i(q)!=="svelte-1oi7qy6"&&(q.textContent=Rt),Pe=a(e),A=o(e,"P",{"data-svelte-h":!0}),i(A)!=="svelte-1876pnw"&&(A.textContent=Ht),De=a(e),Y=o(e,"P",{"data-svelte-h":!0}),i(Y)!=="svelte-clrbmw"&&(Y.textContent=St),Ke=a(e),z=o(e,"P",{"data-svelte-h":!0}),i(z)!=="svelte-5svwjn"&&(z.textContent=qt),Oe=a(e),u(F.$$.fragment,e),et=a(e),L=o(e,"PRE",{"data-svelte-h":!0}),i(L)!=="svelte-1ez34l3"&&(L.textContent=At),tt=a(e),P=o(e,"P",{"data-svelte-h":!0}),i(P)!=="svelte-1g1a5ck"&&(P.textContent=Yt),st=a(e),D=o(e,"P",{"data-svelte-h":!0}),i(D)!=="svelte-esm5nf"&&(D.textContent=zt),lt=a(e),K=o(e,"P",{"data-svelte-h":!0}),i(K)!=="svelte-1y2n8kq"&&(K.innerHTML=Ft),nt=a(e),O=o(e,"P",{"data-svelte-h":!0}),i(O)!=="svelte-15e1g7o"&&(O.textContent=Lt),at=a(e),ee=o(e,"P",{"data-svelte-h":!0}),i(ee)!=="svelte-wpg9iy"&&(ee.innerHTML=Pt),pt=a(e),u(te.$$.fragment,e),ot=a(e),se=o(e,"P",{"data-svelte-h":!0}),i(se)!=="svelte-iuvqps"&&(se.textContent=Dt),it=a(e),u(le.$$.fragment,e),rt=a(e),ne=o(e,"P",{"data-svelte-h":!0}),i(ne)!=="svelte-1wo42mn"&&(ne.innerHTML=Kt),ut=a(e),u(ae.$$.fragment,e),ct=a(e),pe=o(e,"PRE",{"data-svelte-h":!0}),i(pe)!=="svelte-zi5fqp"&&(pe.textContent=Ot),Mt=a(e),oe=o(e,"P",{"data-svelte-h":!0}),i(oe)!=="svelte-w5yzdp"&&(oe.textContent=es),mt=a(e),ie=o(e,"P",{"data-svelte-h":!0}),i(ie)!=="svelte-1iuwkju"&&(ie.textContent=ts),ht=a(e),re=o(e,"P",{"data-svelte-h":!0}),i(re)!=="svelte-18fw6gy"&&(re.textContent=ss),wt=a(e),ue=o(e,"P",{"data-svelte-h":!0}),i(ue)!=="svelte-nde9mv"&&(ue.innerHTML=ls),yt=a(e),ce=o(e,"P",{"data-svelte-h":!0}),i(ce)!=="svelte-vpcii8"&&(ce.innerHTML=ns),dt=a(e),u(Me.$$.fragment,e),Tt=a(e),me=o(e,"P",{"data-svelte-h":!0}),i(me)!=="svelte-1c7osy1"&&(me.innerHTML=as),Jt=a(e),he=o(e,"P",{"data-svelte-h":!0}),i(he)!=="svelte-gn2d5p"&&(he.textContent=ps),jt=a(e),we=o(e,"P",{"data-svelte-h":!0}),i(we)!=="svelte-kff18m"&&(we.innerHTML=os),ft=a(e),u(ye.$$.fragment,e),Ut=a(e),de=o(e,"P",{"data-svelte-h":!0}),i(de)!=="svelte-12how7f"&&(de.textContent=is),bt=a(e),u(Te.$$.fragment,e),gt=a(e),je=o(e,"P",{}),rs(je).forEach(s),this.h()},h(){us(y,"name","hf:doc:metadata"),us(y,"content",Us)},m(e,t){Ts(document.head,y),l(e,fe,t),l(e,Je,t),l(e,Ue,t),c(d,e,t),l(e,be,t),c(T,e,t),l(e,ge,t),l(e,J,t),l(e,Ie,t),l(e,j,t),l(e,Be,t),l(e,f,t),l(e,Ce,t),l(e,U,t),l(e,_e,t),l(e,b,t),l(e,Ze,t),l(e,g,t),l(e,ve,t),l(e,I,t),l(e,xe,t),l(e,B,t),l(e,Ge,t),l(e,C,t),l(e,Ve,t),c(_,e,t),l(e,$e,t),c(Z,e,t),l(e,Qe,t),c(v,e,t),l(e,We,t),c(x,e,t),l(e,Xe,t),l(e,G,t),l(e,Ee,t),l(e,V,t),l(e,Ne,t),c($,e,t),l(e,ke,t),c(Q,e,t),l(e,Re,t),c(W,e,t),l(e,He,t),c(X,e,t),l(e,Se,t),l(e,E,t),l(e,qe,t),c(N,e,t),l(e,Ae,t),l(e,k,t),l(e,Ye,t),l(e,R,t),l(e,ze,t),c(H,e,t),l(e,Fe,t),c(S,e,t),l(e,Le,t),l(e,q,t),l(e,Pe,t),l(e,A,t),l(e,De,t),l(e,Y,t),l(e,Ke,t),l(e,z,t),l(e,Oe,t),c(F,e,t),l(e,et,t),l(e,L,t),l(e,tt,t),l(e,P,t),l(e,st,t),l(e,D,t),l(e,lt,t),l(e,K,t),l(e,nt,t),l(e,O,t),l(e,at,t),l(e,ee,t),l(e,pt,t),c(te,e,t),l(e,ot,t),l(e,se,t),l(e,it,t),c(le,e,t),l(e,rt,t),l(e,ne,t),l(e,ut,t),c(ae,e,t),l(e,ct,t),l(e,pe,t),l(e,Mt,t),l(e,oe,t),l(e,mt,t),l(e,ie,t),l(e,ht,t),l(e,re,t),l(e,wt,t),l(e,ue,t),l(e,yt,t),l(e,ce,t),l(e,dt,t),c(Me,e,t),l(e,Tt,t),l(e,me,t),l(e,Jt,t),l(e,he,t),l(e,jt,t),l(e,we,t),l(e,ft,t),c(ye,e,t),l(e,Ut,t),l(e,de,t),l(e,bt,t),c(Te,e,t),l(e,gt,t),l(e,je,t),It=!0},p:ms,i(e){It||(M(d.$$.fragment,e),M(T.$$.fragment,e),M(_.$$.fragment,e),M(Z.$$.fragment,e),M(v.$$.fragment,e),M(x.$$.fragment,e),M($.$$.fragment,e),M(Q.$$.fragment,e),M(W.$$.fragment,e),M(X.$$.fragment,e),M(N.$$.fragment,e),M(H.$$.fragment,e),M(S.$$.fragment,e),M(F.$$.fragment,e),M(te.$$.fragment,e),M(le.$$.fragment,e),M(ae.$$.fragment,e),M(Me.$$.fragment,e),M(ye.$$.fragment,e),M(Te.$$.fragment,e),It=!0)},o(e){m(d.$$.fragment,e),m(T.$$.fragment,e),m(_.$$.fragment,e),m(Z.$$.fragment,e),m(v.$$.fragment,e),m(x.$$.fragment,e),m($.$$.fragment,e),m(Q.$$.fragment,e),m(W.$$.fragment,e),m(X.$$.fragment,e),m(N.$$.fragment,e),m(H.$$.fragment,e),m(S.$$.fragment,e),m(F.$$.fragment,e),m(te.$$.fragment,e),m(le.$$.fragment,e),m(ae.$$.fragment,e),m(Me.$$.fragment,e),m(ye.$$.fragment,e),m(Te.$$.fragment,e),It=!1},d(e){e&&(s(fe),s(Je),s(Ue),s(be),s(ge),s(J),s(Ie),s(j),s(Be),s(f),s(Ce),s(U),s(_e),s(b),s(Ze),s(g),s(ve),s(I),s(xe),s(B),s(Ge),s(C),s(Ve),s($e),s(Qe),s(We),s(Xe),s(G),s(Ee),s(V),s(Ne),s(ke),s(Re),s(He),s(Se),s(E),s(qe),s(Ae),s(k),s(Ye),s(R),s(ze),s(Fe),s(Le),s(q),s(Pe),s(A),s(De),s(Y),s(Ke),s(z),s(Oe),s(et),s(L),s(tt),s(P),s(st),s(D),s(lt),s(K),s(nt),s(O),s(at),s(ee),s(pt),s(ot),s(se),s(it),s(rt),s(ne),s(ut),s(ct),s(pe),s(Mt),s(oe),s(mt),s(ie),s(ht),s(re),s(wt),s(ue),s(yt),s(ce),s(dt),s(Tt),s(me),s(Jt),s(he),s(jt),s(we),s(ft),s(Ut),s(de),s(bt),s(gt),s(je)),s(y),h(d,e),h(T,e),h(_,e),h(Z,e),h(v,e),h(x,e),h($,e),h(Q,e),h(W,e),h(X,e),h(N,e),h(H,e),h(S,e),h(F,e),h(te,e),h(le,e),h(ae,e),h(Me,e),h(ye,e),h(Te,e)}}}const Us='{"title":"RAG with source highlighting using Structured generation","local":"rag-with-source-highlighting-using-structured-generation","sections":[{"title":"Prompting the model","local":"prompting-the-model","sections":[],"depth":2}],"depth":1}';function bs(Bt){return hs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _s extends ws{constructor(y){super(),ys(this,y,bs,fs,Ms,{})}}export{_s as component};
