import{s as ct,n as mt,o as wt}from"../chunks/scheduler.1f027d5a.js";import{S as yt,i as Tt,e as p,s as n,c as M,h as Jt,a as i,d as t,b as a,f as ut,g as u,j as o,k as rt,l as ht,m as l,n as r,t as c,o as m,p as w}from"../chunks/index.6117a65d.js";import{C as jt}from"../chunks/CopyLLMTxtMenu.0ff8411a.js";import{D as dt,C as y}from"../chunks/DocNotebookDropdown.316c3715.js";import{H as Zs,E as Ut}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.0eecd2bb.js";function ft(_s){let T,fe,de,be,J,Ie,h,Be,j,ge,d,$s='<em>作者: <a href="https://huggingface.co/m-ric" rel="nofollow">Aymeric Roucher</a></em>',Ce,U,Gs="<strong>结构化生成是一种方法</strong>，它强制 LLN 的输出遵循某些约束，例如遵循特定的模式。",Ze,f,Vs="这有许多用例：",_e,b,xs="<li>✅ 输出一个具有特定键的字典</li> <li>📏 确保输出长度超过 N 个字符</li> <li>⚙️ 更一般地说，强制输出遵循特定的正则表达式模式以进行下游处理。</li> <li>💡 在检索增强生成（RAG）中突出显示支持答案的源</li>",$e,I,vs="在这个 notebook 中，我们特别演示了最后一个用例：",Ge,B,Qs="<strong>➡️ 我们构建了一个 RAG 系统，它不仅提供答案，还突出显示这个答案所基于的支持片段。</strong>",Ve,g,Ws='<em>如果你需要 RAG 的入门介绍，可以查看<a href="advanced_rag">这个其他的教程</a>。</em>',xe,C,Xs="这个 notebook 首先展示了通过提示进行结构化生成的简单方法，并突出了其局限性，然后演示了受限解码以实现更高效的结构化生成。",ve,Z,Es='它利用了 HuggingFace 推理端点（示例展示了一个<a href="https://huggingface.co/docs/api-inference/quicktour" rel="nofollow">无服务器</a>端点，但你可以直接将端点更改为<a href="https://huggingface.co/docs/inference-endpoints/en/guides/access" rel="nofollow">专用</a>端点），然后还展示了一个使用<a href="https://github.com/outlines-dev/outlines" rel="nofollow">outlines</a>，一个结构化文本生成库的本地流水线。',Qe,_,We,$,Xe,G,Ee,V,Ne,x,Ns="为了从模型中获得结构化输出，你可以简单地用适当的指导原则提示一个足够强大的模型，并且大多数时候它应该能够直接工作。",Re,v,Rs=`在这种情况下，我们希望 RAG 模型不仅生成答案，还生成一个置信度分数和一些源代码片段。
我们希望将这些生成为一个 JSON 字典，然后可以轻松地解析它以进行下游处理（在这里，我们将只突出显示源代码片段）。`,qe,Q,He,W,Se,X,Ae,E,ke,N,qs=`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:
`,ze,R,Ye,q,Hs=`&#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"]
}
`,Fe,H,Ss="LLM 的输出是一个字典的字符串表示：所以我们只需使用 <code>literal_eval</code> 将其作为字典加载。",Le,S,Pe,A,De,k,As=`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.
`,Ke,z,ks="成功了！🥳",Oe,Y,zs="但是使用一个不那么强大的模型会怎么样呢？",es,F,Ys="为了模拟一个不那么强大的模型可能产生的连贯性较差的输出，我们增加了温度（temperature）。",ss,L,ts,P,Fs=`&#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
`,ls,D,Ls="现在，输出甚至不是正确的 JSON 格式。",ns,K,as,O,Ps="为了强制输出 JSON，我们将使用<strong>受限解码</strong>，在这种解码方式中，我们强制 LLM 只输出符合称为<strong>语法</strong>的一组规则的令牌。",ps,ee,Ds="这个语法可以使用 Pydantic 模型、JSON 模式或正则表达式来定义。然后 AI 将生成符合指定语法的响应。",is,se,Ks='例如，这里我们遵循<a href="https://docs.pydantic.dev/latest/api/types/" rel="nofollow">Pydantic 类型</a>。',os,te,Ms,le,Os="我建议检查生成的模式，以确保它正确地表示了你的需求：",us,ne,rs,ae,et="你可以使用客户端的 <code>text_generation</code> 方法，或者使用其 <code>post</code> 方法。",cs,pe,ms,ie,st=`&#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"]
}
`,ws,oe,tt="✅ 尽管由于温度较高，答案仍然没有意义，但现在生成的输出是正确的 JSON 格式，具有我们在语法中定义的确切键和类型！",ys,Me,lt="然后它可以被解析以进行进一步处理。",Ts,ue,Js,re,nt='<a href="https://github.com/outlines-dev/outlines/" rel="nofollow">Outlines</a> 是在我们的推理 API 底层运行的库，用于约束输出生成。你也可以在本地使用它。',hs,ce,at='它通过 <a href="https://github.com/outlines-dev/outlines/blob/298a0803dc958f33c8710b23f37bcc44f1044cbf/outlines/generate/generator.py#L143" rel="nofollow">在 logits 上施加 bias</a> 来强制选择仅符合你约束的选项。',js,me,ds,we,pt='你还可以使用 <a href="https://huggingface.co/docs/text-generation-inference/en/index" rel="nofollow">文本生成推理</a> 进行受限生成（请参阅 <a href="https://huggingface.co/docs/text-generation-inference/en/conceptual/guidance" rel="nofollow">文档</a> 以获取更多详细信息和示例）。',Us,ye,it="现在我们已经展示了一个特定的 RAG 用例，但受限生成对于更多的事情都非常有帮助。",fs,Te,ot='例如，在你的 <a href="llm_judge">LLM 判断</a> 工作流程中，你也可以使用受限生成来输出一个 JSON，如下所示：',bs,Je,Is,he,Mt="今天的内容就到这里，恭喜你跟到最后！👏",Bs,je,gs,Ue,Cs;return J=new dt({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/zh-CN/structured_generation.ipynb"}]}}),h=new jt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),j=new Zs({props:{title:"使用结构化生成进行带源高亮的 RAG",local:"使用结构化生成进行带源高亮的-rag",headingTag:"h1"}}),_=new y({props:{code:"IXBpcCUyMGluc3RhbGwlMjBwYW5kYXMlMjBqc29uJTIwaHVnZ2luZ2ZhY2VfaHViJTIwcHlkYW50aWMlMjBvdXRsaW5lcyUyMGFjY2VsZXJhdGUlMjAtcQ==",highlighted:"!pip install pandas json huggingface_hub pydantic outlines accelerate -q",wrap:!1}}),$=new y({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 y({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}}),V=new Zs({props:{title:"提示模型",local:"提示模型",headingTag:"h2"}}),Q=new y({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}}),W=new y({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}}),X=new y({props:{code:"VVNFUl9RVUVSWSUyMCUzRCUyMCUyMkhvdyUyMGNhbiUyMEklMjBkZWZpbmUlMjBhJTIwc3RvcCUyMHNlcXVlbmNlJTIwaW4lMjBUcmFuc2Zvcm1lcnMlM0YlMjI=",highlighted:'USER_QUERY = <span class="hljs-string">&quot;How can I define a stop sequence in Transformers?&quot;</span>',wrap:!1}}),E=new y({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}}),R=new y({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}}),S=new y({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 y({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}}),L=new y({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}}),K=new Zs({props:{title:"👉 受限解码",local:"-受限解码",headingTag:"h2"}}),te=new y({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}}),ne=new y({props:{code:"QW5zd2VyV2l0aFNuaXBwZXRzLnNjaGVtYSgp",highlighted:"AnswerWithSnippets.schema()",wrap:!1}}),pe=new y({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}}),ue=new Zs({props:{title:"使用 Outlines 在本地流水线上应用语法",local:"使用-outlines-在本地流水线上应用语法",headingTag:"h3"}}),me=new y({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}}),Je=new y({props:{code:"JTdCJTBBJTIwJTIwJTIwJTIwJTIyc2NvcmUlMjIlM0ElMjAxJTJDJTBBJTIwJTIwJTIwJTIwJTIycmF0aW9uYWxlJTIyJTNBJTIwJTIyVGhlJTIwYW5zd2VyJTIwZG9lcyUyMG5vdCUyMG1hdGNoJTIwdGhlJTIwdHJ1ZSUyMGFuc3dlciUyMGF0JTIwYWxsLiUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMmNvbmZpZGVuY2VfbGV2ZWwlMjIlM0ElMjAwLjg1JTBBJTdE",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}}),je=new Ut({props:{source:"https://github.com/huggingface/cookbook/blob/main/notebooks/zh-CN/structured_generation.md"}}),{c(){T=p("meta"),fe=n(),de=p("p"),be=n(),M(J.$$.fragment),Ie=n(),M(h.$$.fragment),Be=n(),M(j.$$.fragment),ge=n(),d=p("p"),d.innerHTML=$s,Ce=n(),U=p("p"),U.innerHTML=Gs,Ze=n(),f=p("p"),f.textContent=Vs,_e=n(),b=p("ul"),b.innerHTML=xs,$e=n(),I=p("p"),I.textContent=vs,Ge=n(),B=p("p"),B.innerHTML=Qs,Ve=n(),g=p("p"),g.innerHTML=Ws,xe=n(),C=p("p"),C.textContent=Xs,ve=n(),Z=p("p"),Z.innerHTML=Es,Qe=n(),M(_.$$.fragment),We=n(),M($.$$.fragment),Xe=n(),M(G.$$.fragment),Ee=n(),M(V.$$.fragment),Ne=n(),x=p("p"),x.textContent=Ns,Re=n(),v=p("p"),v.textContent=Rs,qe=n(),M(Q.$$.fragment),He=n(),M(W.$$.fragment),Se=n(),M(X.$$.fragment),Ae=n(),M(E.$$.fragment),ke=n(),N=p("pre"),N.textContent=qs,ze=n(),M(R.$$.fragment),Ye=n(),q=p("pre"),q.textContent=Hs,Fe=n(),H=p("p"),H.innerHTML=Ss,Le=n(),M(S.$$.fragment),Pe=n(),M(A.$$.fragment),De=n(),k=p("pre"),k.textContent=As,Ke=n(),z=p("p"),z.textContent=ks,Oe=n(),Y=p("p"),Y.textContent=zs,es=n(),F=p("p"),F.textContent=Ys,ss=n(),M(L.$$.fragment),ts=n(),P=p("pre"),P.textContent=Fs,ls=n(),D=p("p"),D.textContent=Ls,ns=n(),M(K.$$.fragment),as=n(),O=p("p"),O.innerHTML=Ps,ps=n(),ee=p("p"),ee.textContent=Ds,is=n(),se=p("p"),se.innerHTML=Ks,os=n(),M(te.$$.fragment),Ms=n(),le=p("p"),le.textContent=Os,us=n(),M(ne.$$.fragment),rs=n(),ae=p("p"),ae.innerHTML=et,cs=n(),M(pe.$$.fragment),ms=n(),ie=p("pre"),ie.textContent=st,ws=n(),oe=p("p"),oe.textContent=tt,ys=n(),Me=p("p"),Me.textContent=lt,Ts=n(),M(ue.$$.fragment),Js=n(),re=p("p"),re.innerHTML=nt,hs=n(),ce=p("p"),ce.innerHTML=at,js=n(),M(me.$$.fragment),ds=n(),we=p("p"),we.innerHTML=pt,Us=n(),ye=p("p"),ye.textContent=it,fs=n(),Te=p("p"),Te.innerHTML=ot,bs=n(),M(Je.$$.fragment),Is=n(),he=p("p"),he.textContent=Mt,Bs=n(),M(je.$$.fragment),gs=n(),Ue=p("p"),this.h()},l(e){const s=Jt("svelte-u9bgzb",document.head);T=i(s,"META",{name:!0,content:!0}),s.forEach(t),fe=a(e),de=i(e,"P",{}),ut(de).forEach(t),be=a(e),u(J.$$.fragment,e),Ie=a(e),u(h.$$.fragment,e),Be=a(e),u(j.$$.fragment,e),ge=a(e),d=i(e,"P",{"data-svelte-h":!0}),o(d)!=="svelte-1ouqjzx"&&(d.innerHTML=$s),Ce=a(e),U=i(e,"P",{"data-svelte-h":!0}),o(U)!=="svelte-1530hm3"&&(U.innerHTML=Gs),Ze=a(e),f=i(e,"P",{"data-svelte-h":!0}),o(f)!=="svelte-a0rj6p"&&(f.textContent=Vs),_e=a(e),b=i(e,"UL",{"data-svelte-h":!0}),o(b)!=="svelte-23j063"&&(b.innerHTML=xs),$e=a(e),I=i(e,"P",{"data-svelte-h":!0}),o(I)!=="svelte-a4q645"&&(I.textContent=vs),Ge=a(e),B=i(e,"P",{"data-svelte-h":!0}),o(B)!=="svelte-sq0dsq"&&(B.innerHTML=Qs),Ve=a(e),g=i(e,"P",{"data-svelte-h":!0}),o(g)!=="svelte-18ohzx0"&&(g.innerHTML=Ws),xe=a(e),C=i(e,"P",{"data-svelte-h":!0}),o(C)!=="svelte-h53aqu"&&(C.textContent=Xs),ve=a(e),Z=i(e,"P",{"data-svelte-h":!0}),o(Z)!=="svelte-1cyziva"&&(Z.innerHTML=Es),Qe=a(e),u(_.$$.fragment,e),We=a(e),u($.$$.fragment,e),Xe=a(e),u(G.$$.fragment,e),Ee=a(e),u(V.$$.fragment,e),Ne=a(e),x=i(e,"P",{"data-svelte-h":!0}),o(x)!=="svelte-1c6nic3"&&(x.textContent=Ns),Re=a(e),v=i(e,"P",{"data-svelte-h":!0}),o(v)!=="svelte-qgen7l"&&(v.textContent=Rs),qe=a(e),u(Q.$$.fragment,e),He=a(e),u(W.$$.fragment,e),Se=a(e),u(X.$$.fragment,e),Ae=a(e),u(E.$$.fragment,e),ke=a(e),N=i(e,"PRE",{"data-svelte-h":!0}),o(N)!=="svelte-cr71sn"&&(N.textContent=qs),ze=a(e),u(R.$$.fragment,e),Ye=a(e),q=i(e,"PRE",{"data-svelte-h":!0}),o(q)!=="svelte-1uqak8l"&&(q.textContent=Hs),Fe=a(e),H=i(e,"P",{"data-svelte-h":!0}),o(H)!=="svelte-115k125"&&(H.innerHTML=Ss),Le=a(e),u(S.$$.fragment,e),Pe=a(e),u(A.$$.fragment,e),De=a(e),k=i(e,"PRE",{"data-svelte-h":!0}),o(k)!=="svelte-1oi7qy6"&&(k.textContent=As),Ke=a(e),z=i(e,"P",{"data-svelte-h":!0}),o(z)!=="svelte-ksigtp"&&(z.textContent=ks),Oe=a(e),Y=i(e,"P",{"data-svelte-h":!0}),o(Y)!=="svelte-1egnelb"&&(Y.textContent=zs),es=a(e),F=i(e,"P",{"data-svelte-h":!0}),o(F)!=="svelte-1l72w1g"&&(F.textContent=Ys),ss=a(e),u(L.$$.fragment,e),ts=a(e),P=i(e,"PRE",{"data-svelte-h":!0}),o(P)!=="svelte-1ez34l3"&&(P.textContent=Fs),ls=a(e),D=i(e,"P",{"data-svelte-h":!0}),o(D)!=="svelte-152osq8"&&(D.textContent=Ls),ns=a(e),u(K.$$.fragment,e),as=a(e),O=i(e,"P",{"data-svelte-h":!0}),o(O)!=="svelte-ev0jbd"&&(O.innerHTML=Ps),ps=a(e),ee=i(e,"P",{"data-svelte-h":!0}),o(ee)!=="svelte-v7bz4p"&&(ee.textContent=Ds),is=a(e),se=i(e,"P",{"data-svelte-h":!0}),o(se)!=="svelte-1r0bm06"&&(se.innerHTML=Ks),os=a(e),u(te.$$.fragment,e),Ms=a(e),le=i(e,"P",{"data-svelte-h":!0}),o(le)!=="svelte-dflxs1"&&(le.textContent=Os),us=a(e),u(ne.$$.fragment,e),rs=a(e),ae=i(e,"P",{"data-svelte-h":!0}),o(ae)!=="svelte-eqyjsl"&&(ae.innerHTML=et),cs=a(e),u(pe.$$.fragment,e),ms=a(e),ie=i(e,"PRE",{"data-svelte-h":!0}),o(ie)!=="svelte-zi5fqp"&&(ie.textContent=st),ws=a(e),oe=i(e,"P",{"data-svelte-h":!0}),o(oe)!=="svelte-1dx7c3t"&&(oe.textContent=tt),ys=a(e),Me=i(e,"P",{"data-svelte-h":!0}),o(Me)!=="svelte-1h38yc1"&&(Me.textContent=lt),Ts=a(e),u(ue.$$.fragment,e),Js=a(e),re=i(e,"P",{"data-svelte-h":!0}),o(re)!=="svelte-14iy98u"&&(re.innerHTML=nt),hs=a(e),ce=i(e,"P",{"data-svelte-h":!0}),o(ce)!=="svelte-w1iins"&&(ce.innerHTML=at),js=a(e),u(me.$$.fragment,e),ds=a(e),we=i(e,"P",{"data-svelte-h":!0}),o(we)!=="svelte-hvsvir"&&(we.innerHTML=pt),Us=a(e),ye=i(e,"P",{"data-svelte-h":!0}),o(ye)!=="svelte-1e91me5"&&(ye.textContent=it),fs=a(e),Te=i(e,"P",{"data-svelte-h":!0}),o(Te)!=="svelte-l8o8gm"&&(Te.innerHTML=ot),bs=a(e),u(Je.$$.fragment,e),Is=a(e),he=i(e,"P",{"data-svelte-h":!0}),o(he)!=="svelte-1738x5m"&&(he.textContent=Mt),Bs=a(e),u(je.$$.fragment,e),gs=a(e),Ue=i(e,"P",{}),ut(Ue).forEach(t),this.h()},h(){rt(T,"name","hf:doc:metadata"),rt(T,"content",bt)},m(e,s){ht(document.head,T),l(e,fe,s),l(e,de,s),l(e,be,s),r(J,e,s),l(e,Ie,s),r(h,e,s),l(e,Be,s),r(j,e,s),l(e,ge,s),l(e,d,s),l(e,Ce,s),l(e,U,s),l(e,Ze,s),l(e,f,s),l(e,_e,s),l(e,b,s),l(e,$e,s),l(e,I,s),l(e,Ge,s),l(e,B,s),l(e,Ve,s),l(e,g,s),l(e,xe,s),l(e,C,s),l(e,ve,s),l(e,Z,s),l(e,Qe,s),r(_,e,s),l(e,We,s),r($,e,s),l(e,Xe,s),r(G,e,s),l(e,Ee,s),r(V,e,s),l(e,Ne,s),l(e,x,s),l(e,Re,s),l(e,v,s),l(e,qe,s),r(Q,e,s),l(e,He,s),r(W,e,s),l(e,Se,s),r(X,e,s),l(e,Ae,s),r(E,e,s),l(e,ke,s),l(e,N,s),l(e,ze,s),r(R,e,s),l(e,Ye,s),l(e,q,s),l(e,Fe,s),l(e,H,s),l(e,Le,s),r(S,e,s),l(e,Pe,s),r(A,e,s),l(e,De,s),l(e,k,s),l(e,Ke,s),l(e,z,s),l(e,Oe,s),l(e,Y,s),l(e,es,s),l(e,F,s),l(e,ss,s),r(L,e,s),l(e,ts,s),l(e,P,s),l(e,ls,s),l(e,D,s),l(e,ns,s),r(K,e,s),l(e,as,s),l(e,O,s),l(e,ps,s),l(e,ee,s),l(e,is,s),l(e,se,s),l(e,os,s),r(te,e,s),l(e,Ms,s),l(e,le,s),l(e,us,s),r(ne,e,s),l(e,rs,s),l(e,ae,s),l(e,cs,s),r(pe,e,s),l(e,ms,s),l(e,ie,s),l(e,ws,s),l(e,oe,s),l(e,ys,s),l(e,Me,s),l(e,Ts,s),r(ue,e,s),l(e,Js,s),l(e,re,s),l(e,hs,s),l(e,ce,s),l(e,js,s),r(me,e,s),l(e,ds,s),l(e,we,s),l(e,Us,s),l(e,ye,s),l(e,fs,s),l(e,Te,s),l(e,bs,s),r(Je,e,s),l(e,Is,s),l(e,he,s),l(e,Bs,s),r(je,e,s),l(e,gs,s),l(e,Ue,s),Cs=!0},p:mt,i(e){Cs||(c(J.$$.fragment,e),c(h.$$.fragment,e),c(j.$$.fragment,e),c(_.$$.fragment,e),c($.$$.fragment,e),c(G.$$.fragment,e),c(V.$$.fragment,e),c(Q.$$.fragment,e),c(W.$$.fragment,e),c(X.$$.fragment,e),c(E.$$.fragment,e),c(R.$$.fragment,e),c(S.$$.fragment,e),c(A.$$.fragment,e),c(L.$$.fragment,e),c(K.$$.fragment,e),c(te.$$.fragment,e),c(ne.$$.fragment,e),c(pe.$$.fragment,e),c(ue.$$.fragment,e),c(me.$$.fragment,e),c(Je.$$.fragment,e),c(je.$$.fragment,e),Cs=!0)},o(e){m(J.$$.fragment,e),m(h.$$.fragment,e),m(j.$$.fragment,e),m(_.$$.fragment,e),m($.$$.fragment,e),m(G.$$.fragment,e),m(V.$$.fragment,e),m(Q.$$.fragment,e),m(W.$$.fragment,e),m(X.$$.fragment,e),m(E.$$.fragment,e),m(R.$$.fragment,e),m(S.$$.fragment,e),m(A.$$.fragment,e),m(L.$$.fragment,e),m(K.$$.fragment,e),m(te.$$.fragment,e),m(ne.$$.fragment,e),m(pe.$$.fragment,e),m(ue.$$.fragment,e),m(me.$$.fragment,e),m(Je.$$.fragment,e),m(je.$$.fragment,e),Cs=!1},d(e){e&&(t(fe),t(de),t(be),t(Ie),t(Be),t(ge),t(d),t(Ce),t(U),t(Ze),t(f),t(_e),t(b),t($e),t(I),t(Ge),t(B),t(Ve),t(g),t(xe),t(C),t(ve),t(Z),t(Qe),t(We),t(Xe),t(Ee),t(Ne),t(x),t(Re),t(v),t(qe),t(He),t(Se),t(Ae),t(ke),t(N),t(ze),t(Ye),t(q),t(Fe),t(H),t(Le),t(Pe),t(De),t(k),t(Ke),t(z),t(Oe),t(Y),t(es),t(F),t(ss),t(ts),t(P),t(ls),t(D),t(ns),t(as),t(O),t(ps),t(ee),t(is),t(se),t(os),t(Ms),t(le),t(us),t(rs),t(ae),t(cs),t(ms),t(ie),t(ws),t(oe),t(ys),t(Me),t(Ts),t(Js),t(re),t(hs),t(ce),t(js),t(ds),t(we),t(Us),t(ye),t(fs),t(Te),t(bs),t(Is),t(he),t(Bs),t(gs),t(Ue)),t(T),w(J,e),w(h,e),w(j,e),w(_,e),w($,e),w(G,e),w(V,e),w(Q,e),w(W,e),w(X,e),w(E,e),w(R,e),w(S,e),w(A,e),w(L,e),w(K,e),w(te,e),w(ne,e),w(pe,e),w(ue,e),w(me,e),w(Je,e),w(je,e)}}}const bt='{"title":"使用结构化生成进行带源高亮的 RAG","local":"使用结构化生成进行带源高亮的-rag","sections":[{"title":"提示模型","local":"提示模型","sections":[],"depth":2},{"title":"👉 受限解码","local":"-受限解码","sections":[{"title":"使用 Outlines 在本地流水线上应用语法","local":"使用-outlines-在本地流水线上应用语法","sections":[],"depth":3}],"depth":2}],"depth":1}';function It(_s){return wt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $t extends yt{constructor(T){super(),Tt(this,T,It,ft,ct,{})}}export{$t as component};
