import{s as cs,n as Vs,o as us}from"../chunks/scheduler.e0212c12.js";import{S as Cs,i as js,e as J,s as n,c as T,h as Qs,a as U,d as s,b as a,f as os,g as i,j as p,k as ys,l as Is,m as e,n as M,t as r,o as m,p as w}from"../chunks/index.a585a37c.js";import{C as hs,H as Ft,E as fs}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.b7b693fd.js";import{D as gs,C as o}from"../chunks/DocNotebookDropdown.1738c255.js";function ds($t){let y,hl,Ql,fl,c,gl,V,dl,u,Bl,C,Nt='<em>작성자: <a href="https://huggingface.co/m-ric" rel="nofollow">Aymeric Roucher</a>, 번역: <a href="https://huggingface.co/4n3mone" rel="nofollow">유용상</a></em>',El,j,kt="<strong>구조화된 생성</strong>(Structured generation)은 LLM 출력이 특정 패턴을 따르도록 강제하는 방법입니다.",bl,Q,_t="이 방법은 여러 가지 용도로 사용될 수 있습니다:",Rl,I,xt="<li>✅ 특정 키가 있는 딕셔너리 출력</li> <li>📏 출력이 N글자 이상이 되도록 보장</li> <li>⚙️ 더 일반적으로, 다운스트림 처리를 위해 출력이 특정 정규 표현식 패턴을 따르도록 강제</li> <li>💡 검색 증강 생성(RAG)에서 답변을 뒷받침하는 소스를 강조 표시</li>",Fl,h,At="이 노트북은 마지막 예시를 구체적으로 보여줍니다.",$l,f,Ot="<strong>➡️ 우리는 답변을 제공할 뿐만 아니라 이 답변의 근거가 되는 스니펫을 강조 표시하는 RAG 시스템을 구축합니다.</strong>",Nl,g,Dt='<em>RAG에 대한 소개가 필요하다면, <a href="advanced_rag">이 쿡북</a>을 확인해 보세요.</em>',kl,d,St="이 노트북은 먼저 프롬프트를 통한 구조화된 생성의 단순한 접근 방식을 보여주고 그 한계를 강조한 다음, 더 효율적인 구조화된 생성을 위한 제한된 디코딩(constrained decoding)을 시연합니다.",_l,B,vt='이 노트북은 HuggingFace Inference Endpoints를 활용합니다 (예제는 <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>라는 구조화된 텍스트 생성 라이브러리를 사용한 로컬 추론 예제도 보여줍니다.',xl,E,Al,b,Ol,R,Dl,F,Sl,$,Zt="모델에서 구조화된 출력을 얻으려면, 충분히 성능이 좋은 모델에 적절한 지시사항을 포함한 프롬프트를 제공하면 됩니다. 대부분의 경우 이 방법이 잘 작동할 것입니다.",vl,N,Xt="이번 경우, 우리는 RAG 모델이 답변뿐만 아니라 신뢰도 점수와 근거가 되는 스니펫도 함께 생성하기를 원합니다.",Zl,k,Wt="이러한 출력을 JSON 형식의 딕셔너리로 생성하면, 나중에 쉽게 처리할 수 있습니다 (여기서는 근거가 되는 스니펫을 강조하여 표시할 예정입니다).",Xl,_,Wl,x,Gl,A,ql,O,Hl,D,Gt=`문서를 기반으로 사용자 쿼리에 응답합니다.

다음은 문서입니다: 
문서:

오늘 서울의 날씨가 정말 좋네요.
Transformers에서 정지 시퀀스를 정의하려면 파이프라인 또는 모델에 stop_sequence 인수를 전달해야 합니다.




답변을 JSON 형식으로 제공하고, 답변의 직접적 근거가 된 문서의 모든 관련 짧은 소스 스니펫과 신뢰도 점수를 0에서 1 사이의 부동 소수점으로 제공해야 합니다.
근거 스니펫은 전체 문장이 아닌 기껏해야 몇 단어 정도로 매우 짧아야 합니다! 그리고 문맥에서 정확히 동일한 문구와 철자를 사용하여 추출해야 합니다.

답변은 다음과 같이 작성해야 하며, “Answer:” 및 “End of answer.” 를 포함해야 합니다.

Answer:
&#123;
  “answer": 정답 문장,
  “confidence_score": 신뢰도 점수,
  “source_snippets": [“근거_1”, “근거_2”, ...]
}
End of answer.

이제 시작하세요!
다음은 사용자 질문입니다: Transformers에서 정지 시퀀스를 어떻게 정의하나요?.
Answer:
`,zl,S,Yl,v,qt=`&#123;
  "answer": "Transformers에서 정지 시퀀스를 정의하려면 파이프라인 또는 모델에 stop_sequence 인수를 전달해야 합니다.",
  "confidence_score": 0.95,
  "source_snippets": ["정지 시퀀스를 정의하려면 파이프라인 또는 모델에 stop_sequence 인수를 전달해야 합니다."]
}
`,Ll,Z,Ht="LLM의 출력은 딕셔너리의 문자열 표현입니다. 따라서 <code>literal_eval</code>을 사용하여 이를 딕셔너리로 로드합시다.",Pl,X,Kl,W,lt,G,zt=`Answer: \x1B[1;32mTransformers에서 정지 시퀀스를 정의하려면 파이프라인 또는 모델에 stop_sequence 인수를 전달해야 합니다.\x1B[0m


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

문서:

오늘 서울의 날씨가 정말 좋네요.
Transformers에서 \x1B[1;32m정지 시퀀스를 정의하려면 파이프라인 또는 모델에 stop_sequence 인수를 전달해야 합니다.\x1B[0m
`,tt,q,Yt="잘 작동합니다! 🥳",st,H,Lt="하지만 성능이 낮은 모델을 사용하는 경우는 어떨까요?",et,z,Pt="성능이 떨어지는 모델의 불안정한 출력을 시뮬레이션하기 위해, temperature 값을 높여보겠습니다.",nt,Y,at,L,Kt=`&#123;
    "answer": adjectistiques Banco Comambique-howiktenल्ल 없을Ela Nal realisticINTEn обор reminding frustPolit lMer Maria Banco Comambique-howiktenल्ल 없을Ela Nal realisticINTEn обор музы inférieurke Zendaya alguna７ Mons ram incColumn Orth manages Richie HackAUcasismo<< fpsTIvlOcriptive Ou Tam psycho-Kinsic Serum SecurityülY on Hazard SautéFust St I With 모 clans Eddy Bindingtsoke funeral Stefano authenticitatcontent。

적으로ებულიização finnotes fins witCamera 하나 ls Metallurne couleur platinum/c وأنت textarea Golfyyzuhalten assume prog_reset"Piagn Ameth amivio COR '',
ze Columbia padchart": Poul?"

       φsin den Qu tiendas Mister�cling tercero política’avenir emploi banque inertکا …
anic lucommon-contagsbor ruvisending frustPolit lMer Maria Banco Comambique-howiktenल्ल 없을Ela Nal realisticINTEn обор музы inférieurke Zendaya alguna７ Mons ram incColumn Orth masses frustPolit lMer Maria Banco Comambique-howiktenल्ल 없을Ela Nal realisticINTEn обор музы inférieurke Zendaya alguna７ Mons ram incColumn Orth manages Richie HackAUcasismo<< fpsTIvlOcriptive Ou Tam psycho-Kinsic Serum SecurityülY on Hazard SautéFust
`,Jt,P,ls="출력이 올바른 JSON 형식조차 아닌 것을 확인할 수 있습니다.",Ut,K,pt,ll,ts="JSON 출력을 강제하기 위해, 우리는 <strong>제한된 디코딩</strong>을 사용해야 합니다. 여기서 LLM이 <strong>문법</strong>이라고 불리는 일련의 규칙에 맞는 토큰만 출력하도록 강제합니다.",Tt,tl,ss="이 문법은 Pydantic 모델, JSON 스키마 또는 정규 표현식을 사용하여 정의할 수 있습니다. 그러면 AI는 지정된 문법에 맞는 응답을 생성합니다.",it,sl,es='예를 들어, 여기서는 <a href="https://docs.pydantic.dev/latest/api/types/" rel="nofollow">Pydantic 타입</a>을 따릅니다.',Mt,el,rt,nl,ns="생성된 스키마가 요구 사항을 올바르게 나타내는지 확인해 보세요.",mt,al,wt,Jl,as="클라이언트의 <code>text_generation</code> 메서드를 사용하거나 <code>post</code> 메서드를 사용할 수 있습니다.",ot,Ul,yt,pl,Js=`&#123;
  "answer": " neces恨bay внеpok Archives-Common Propsogs’organpern 공격forschfläche elicous neces恨bay внеpok món-�","confidence": 1,"source_snippets": ["Washington Roman Humналеualion", "_styleImplementedAugust lire",
  ""]

                                                            }
&#123;
  "answer": " بخopuerto կար因數 kavuts mi Firefox Penguins er sdபெர erinnert publiée 물리 DK\\(&#123;}^&#123;\\ Cis بخopuerto կար因數"
,
  "confidence": 0.7825484027713585
,
  "source_snippets": [

"Transformerграни moisady отгaನ", ", migrations ceproductionautal",
"Listeners accelerating loocae"
]
}
`,ct,Tl,Us="✅ 높은 temperature 설정으로 인해 답변 내용은 여전히 말이 되지 않지만, 생성된 출력 텍스트는 이제 우리가 문법에서 정의한 정확한 키와 자료형을 가진 올바른 JSON 형식입니다!",Vt,il,ps="이제 이 출력물을 추가 처리를 위해 파싱할 수 있습니다.",ut,Ml,Ct,rl,Ts='<a href="https://github.com/outlines-dev/outlines/" rel="nofollow">Outlines</a>는 Hugging Face의 Inference API에서 출력 생성을 제한하기 위해 내부적으로 실행되는 라이브러리입니다. 이를 로컬 환경에서도 사용할 수 있습니다.',jt,ml,is='이 라이브러리는 <a href="https://github.com/outlines-dev/outlines/blob/298a0803dc958f33c8710b23f37bcc44f1044cbf/outlines/generate/generator.py#L143" rel="nofollow">로짓(logits)에 편향(bias)을 적용하는 방식</a>으로 작동하여, 사용자가 정의한 제약 조건에 부합하는 선택지만 강제로 선택되도록 합니다.',Qt,wl,It,ol,ht,yl,Ms='제약 생성(constrained generation)을 사용하여 <a href="https://huggingface.co/docs/text-generation-inference/en/index" rel="nofollow">Text-Generation-Inference</a>를 활용할 수도 있습니다 (자세한 내용과 예시는 <a href="https://huggingface.co/docs/text-generation-inference/en/conceptual/guidance" rel="nofollow">문서</a>를 참조하세요).',ft,cl,rs="지금까지 우리는 특정 RAG 사용 사례를 보여주었지만, 제약 생성은 그 이상으로 많은 도움이 됩니다.",gt,Vl,ms='예를 들어, <a href="llm_judge">LLM judge</a> 워크플로우에서도 제약 생성을 사용하여 다음과 같은 JSON을 출력할 수 있습니다:',dt,ul,Bt,Cl,ws="오늘은 여기까지입니다. 끝까지 따라와 주셔서 감사드립니다! 👏",Et,jl,bt,Il,Rt;return c=new gs({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/ko/structured_generation.ipynb"}]}}),V=new hs({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),u=new Ft({props:{title:"구조화된 생성으로 근거 강조 표시가 있는 RAG 시스템 구축하기",local:"구조화된-생성으로-근거-강조-표시가-있는-rag-시스템-구축하기",headingTag:"h1"}}),E=new o({props:{code:"IXBpcCUyMGluc3RhbGwlMjBwYW5kYXMlMjBqc29uJTIwaHVnZ2luZ2ZhY2VfaHViJTIwcHlkYW50aWMlMjBvdXRsaW5lcyUyMGFjY2VsZXJhdGUlMjAtcQ==",highlighted:"!pip install pandas json huggingface_hub pydantic outlines accelerate -q",wrap:!1}}),b=new o({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}}),R=new o({props:{code:"cmVwb19pZCUyMCUzRCUyMCUyMm1pc3RyYWxhaSUyRk1pc3RyYWwtTmVtby1JbnN0cnVjdC0yNDA3JTIyJTBBJTBBbGxtX2NsaWVudCUyMCUzRCUyMEluZmVyZW5jZUNsaWVudChtb2RlbCUzRHJlcG9faWQlMkMlMjB0aW1lb3V0JTNEMTIwKSUwQSUwQSUyMyUyMFRlc3QlMjB5b3VyJTIwTExNJTIwY2xpZW50JTBBbGxtX2NsaWVudC50ZXh0X2dlbmVyYXRpb24ocHJvbXB0JTNEJTIyJUVCJThDJTgwJUVEJTk1JTlDJUVCJUFGJUJDJUVBJUI1JUFEJUVDJTlEJTk4JTIwJUVDJTg4JTk4JUVCJThGJTg0JUVCJThBJTk0JTNGJTIyJTJDJTIwbWF4X25ld190b2tlbnMlM0Q1MCk=",highlighted:`repo_id = <span class="hljs-string">&quot;mistralai/Mistral-Nemo-Instruct-2407&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;대한민국의 수도는?&quot;</span>, max_new_tokens=<span class="hljs-number">50</span>)`,wrap:!1}}),F=new Ft({props:{title:"모델에 프롬프트 제공하기",local:"모델에-프롬프트-제공하기",headingTag:"h2"}}),_=new o({props:{code:"UkVMRVZBTlRfQ09OVEVYVCUyMCUzRCUyMCUyMiUyMiUyMiUwQSVFQiVBQyVCOCVFQyU4NCU5QyUzQSUwQSUwQSVFQyU5OCVBNCVFQiU4QSU5OCUyMCVFQyU4NCU5QyVFQyU5QSVCOCVFQyU5RCU5OCUyMCVFQiU4MiVBMCVFQyU5NCVBOCVFQSVCMCU4MCUyMCVFQyVBMCU5NSVFQiVBNyU5MCUyMCVFQyVBMiU4QiVFQiU4NCVBNCVFQyU5QSU5NC4lMEFUcmFuc2Zvcm1lcnMlRUMlOTclOTAlRUMlODQlOUMlMjAlRUMlQTAlOTUlRUMlQTclODAlMjAlRUMlOEIlOUMlRUQlODAlODAlRUMlOEElQTQlRUIlQTUlQkMlMjAlRUMlQTAlOTUlRUMlOUQlOTglRUQlOTUlOTglRUIlQTAlQTQlRUIlQTklQjQlMjAlRUQlOEMlOEMlRUMlOUQlQjQlRUQlOTQlODQlRUIlOUQlQkMlRUMlOUQlQjglMjAlRUIlOTglOTAlRUIlOEElOTQlMjAlRUIlQUElQTglRUIlOEQlQjglRUMlOTclOTAlMjBzdG9wX3NlcXVlbmNlJTIwJUVDJTlEJUI4JUVDJTg4JTk4JUVCJUE1JUJDJTIwJUVDJUEwJTg0JUVCJThCJUFDJUVEJTk1JUI0JUVDJTk1JUJDJTIwJUVEJTk1JUE5JUVCJThCJTg4JUVCJThCJUE0LiUwQSUwQSUyMiUyMiUyMg==",highlighted:`RELEVANT_CONTEXT = <span class="hljs-string">&quot;&quot;&quot;
문서:

오늘 서울의 날씨가 정말 좋네요.
Transformers에서 정지 시퀀스를 정의하려면 파이프라인 또는 모델에 stop_sequence 인수를 전달해야 합니다.

&quot;&quot;&quot;</span>`,wrap:!1}}),x=new o({props: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TkwJTIwJUVDJUE3JTg4JUVCJUFDJUI4JUVDJTlFJTg1JUVCJThCJTg4JUVCJThCJUE0JTNBJTIwJTdCdXNlcl9xdWVyeSU3RC4lMEFBbnN3ZXIlM0ElMEElMjIlMjIlMjI=",highlighted:`RAG_PROMPT_TEMPLATE_JSON= <span class="hljs-string">&quot;&quot;&quot;문서를 기반으로 사용자 쿼리에 응답합니다.

다음은 문서입니다: {context}


답변을 JSON 형식으로 제공하고, 답변의 직접적 근거가 된 문서의 모든 관련 짧은 소스 스니펫과 신뢰도 점수를 0에서 1 사이의 부동 소수점으로 제공해야 합니다.
근거 스니펫은 전체 문장이 아닌 기껏해야 몇 단어 정도로 매우 짧아야 합니다! 그리고 문맥에서 정확히 동일한 문구와 철자를 사용하여 추출해야 합니다.

답변은 다음과 같이 작성해야 하며, “Answer:” 및 “End of answer.” 를 포함해야 합니다.

Answer:
{{
  “answer&quot;: 정답 문장,
  “confidence_score&quot;: 신뢰도 점수,
  “source_snippets&quot;: [“근거_1”, “근거_2”, ...]
}}
End of answer.

이제 시작하세요!
다음은 사용자 질문입니다: {user_query}.
Answer:
&quot;&quot;&quot;</span>`,wrap:!1}}),A=new o({props:{code:"VVNFUl9RVUVSWSUyMCUzRCUyMCUyMlRyYW5zZm9ybWVycyVFQyU5NyU5MCVFQyU4NCU5QyUyMCVFQyVBMCU5NSVFQyVBNyU4MCUyMCVFQyU4QiU5QyVFRCU4MCU4MCVFQyU4QSVBNCVFQiVBNSVCQyUyMCVFQyU5NiVCNCVFQiU5NiVCQiVFQSVCMiU4QyUyMCVFQyVBMCU5NSVFQyU5RCU5OCVFRCU5NSU5OCVFQiU4MiU5OCVFQyU5QSU5NCUzRiUyMg==",highlighted:'USER_QUERY = <span class="hljs-string">&quot;Transformers에서 정지 시퀀스를 어떻게 정의하나요?&quot;</span>',wrap:!1}}),O=new o({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}}),S=new o({props:{code:"YW5zd2VyJTIwJTNEJTIwbGxtX2NsaWVudC50ZXh0X2dlbmVyYXRpb24oJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwbWF4X25ld190b2tlbnMlM0QyNTYlMkMlMEEpJTBBJTBBYW5zd2VyJTIwJTNEJTIwYW5zd2VyLnNwbGl0KCUyMkVuZCUyMG9mJTIwYW5zd2VyLiUyMiklNUIwJTVEJTBBcHJpbnQoYW5zd2VyKQ==",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">256</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}}),X=new o({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}}),W=new o({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}}),Y=new o({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 Ft({props:{title:"👉 제한된 디코딩(Constrained decoding)",local:"-제한된-디코딩constrained-decoding",headingTag:"h2"}}),el=new o({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}}),al=new o({props:{code:"QW5zd2VyV2l0aFNuaXBwZXRzLnNjaGVtYSgp",highlighted:"AnswerWithSnippets.schema()",wrap:!1}}),Ul=new o({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}}),Ml=new Ft({props:{title:"Outlines를 사용해서 로컬 환경에서 문법 활용하기",local:"outlines를-사용해서-로컬-환경에서-문법-활용하기",headingTag:"h3"}}),wl=new o({props:{code:"c2NoZW1hX2FzX3N0cg==",highlighted:"schema_as_str",wrap:!1}}),ol=new o({props:{code:"aW1wb3J0JTIwb3V0bGluZXMlMEElMEFyZXBvX2lkJTIwJTNEJTIwJTIyUXdlbiUyRlF3ZW4yLTdCLUluc3RydWN0JTIyJTBBJTIzJTIwJUVCJUExJTlDJUVDJUJCJUFDJUVDJTk3JTkwJUVDJTg0JTlDJTIwJUVCJUFBJUE4JUVCJThEJUI4JTIwJUVCJUExJTlDJUVCJTkzJTlDJUVEJTk1JTk4JUVBJUI4JUIwJTBBbW9kZWwlMjAlM0QlMjBvdXRsaW5lcy5tb2RlbHMudHJhbnNmb3JtZXJzKHJlcG9faWQpJTBBJTBBc2NoZW1hX2FzX3N0ciUyMCUzRCUyMGpzb24uZHVtcHMoQW5zd2VyV2l0aFNuaXBwZXRzLnNjaGVtYSgpKSUwQSUwQWdlbmVyYXRvciUyMCUzRCUyMG91dGxpbmVzLmdlbmVyYXRlLmpzb24obW9kZWwlMkMlMjBzY2hlbWFfYXNfc3RyKSUwQSUwQSUyMyUyMFVzZSUyMHRoZSUyMCU2MGdlbmVyYXRvciU2MCUyMHRvJTIwc2FtcGxlJTIwYW4lMjBvdXRwdXQlMjBmcm9tJTIwdGhlJTIwbW9kZWwlMEFyZXN1bHQlMjAlM0QlMjBnZW5lcmF0b3IocHJvbXB0KSUwQXByaW50KHJlc3VsdCk=",highlighted:`<span class="hljs-keyword">import</span> outlines

repo_id = <span class="hljs-string">&quot;Qwen/Qwen2-7B-Instruct&quot;</span>
<span class="hljs-comment"># 로컬에서 모델 로드하기</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}}),ul=new o({props:{code:"JTdCJTBBJTIwJTIwJTIwJTIwJTIyc2NvcmUlMjIlM0ElMjAxJTJDJTBBJTIwJTIwJTIwJTIwJTIycmF0aW9uYWxlJTIyJTNBJTIwJTIyVGhlJTIwYW5zd2VyJTIwZG9lcyUyMG5vdCUyMG1hdGNoJTIwdGhlJTIwdHJ1ZSUyMGFuc3dlciUyMGF0JTIwYWxsLiUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMmNvbmZpZGVuY2VfbGV2ZWwlMjIlM0ElMjAwLjg1JTBBJTdE",highlighted:`{
    <span class="hljs-string">&quot;score&quot;</span>: <span class="hljs-number">1</span>,
    <span class="hljs-string">&quot;rationale&quot;</span>: <span class="hljs-string">&quot;The answer does not match the true answer at all.&quot;</span>,
    <span class="hljs-string">&quot;confidence_level&quot;</span>: <span class="hljs-number">0.85</span>
}`,wrap:!1}}),jl=new fs({props:{source:"https://github.com/huggingface/cookbook/blob/main/notebooks/ko/structured_generation.md"}}),{c(){y=J("meta"),hl=n(),Ql=J("p"),fl=n(),T(c.$$.fragment),gl=n(),T(V.$$.fragment),dl=n(),T(u.$$.fragment),Bl=n(),C=J("p"),C.innerHTML=Nt,El=n(),j=J("p"),j.innerHTML=kt,bl=n(),Q=J("p"),Q.textContent=_t,Rl=n(),I=J("ul"),I.innerHTML=xt,Fl=n(),h=J("p"),h.textContent=At,$l=n(),f=J("p"),f.innerHTML=Ot,Nl=n(),g=J("p"),g.innerHTML=Dt,kl=n(),d=J("p"),d.textContent=St,_l=n(),B=J("p"),B.innerHTML=vt,xl=n(),T(E.$$.fragment),Al=n(),T(b.$$.fragment),Ol=n(),T(R.$$.fragment),Dl=n(),T(F.$$.fragment),Sl=n(),$=J("p"),$.textContent=Zt,vl=n(),N=J("p"),N.textContent=Xt,Zl=n(),k=J("p"),k.textContent=Wt,Xl=n(),T(_.$$.fragment),Wl=n(),T(x.$$.fragment),Gl=n(),T(A.$$.fragment),ql=n(),T(O.$$.fragment),Hl=n(),D=J("pre"),D.textContent=Gt,zl=n(),T(S.$$.fragment),Yl=n(),v=J("pre"),v.textContent=qt,Ll=n(),Z=J("p"),Z.innerHTML=Ht,Pl=n(),T(X.$$.fragment),Kl=n(),T(W.$$.fragment),lt=n(),G=J("pre"),G.textContent=zt,tt=n(),q=J("p"),q.textContent=Yt,st=n(),H=J("p"),H.textContent=Lt,et=n(),z=J("p"),z.textContent=Pt,nt=n(),T(Y.$$.fragment),at=n(),L=J("pre"),L.textContent=Kt,Jt=n(),P=J("p"),P.textContent=ls,Ut=n(),T(K.$$.fragment),pt=n(),ll=J("p"),ll.innerHTML=ts,Tt=n(),tl=J("p"),tl.textContent=ss,it=n(),sl=J("p"),sl.innerHTML=es,Mt=n(),T(el.$$.fragment),rt=n(),nl=J("p"),nl.textContent=ns,mt=n(),T(al.$$.fragment),wt=n(),Jl=J("p"),Jl.innerHTML=as,ot=n(),T(Ul.$$.fragment),yt=n(),pl=J("pre"),pl.textContent=Js,ct=n(),Tl=J("p"),Tl.textContent=Us,Vt=n(),il=J("p"),il.textContent=ps,ut=n(),T(Ml.$$.fragment),Ct=n(),rl=J("p"),rl.innerHTML=Ts,jt=n(),ml=J("p"),ml.innerHTML=is,Qt=n(),T(wl.$$.fragment),It=n(),T(ol.$$.fragment),ht=n(),yl=J("p"),yl.innerHTML=Ms,ft=n(),cl=J("p"),cl.textContent=rs,gt=n(),Vl=J("p"),Vl.innerHTML=ms,dt=n(),T(ul.$$.fragment),Bt=n(),Cl=J("p"),Cl.textContent=ws,Et=n(),T(jl.$$.fragment),bt=n(),Il=J("p"),this.h()},l(l){const t=Qs("svelte-u9bgzb",document.head);y=U(t,"META",{name:!0,content:!0}),t.forEach(s),hl=a(l),Ql=U(l,"P",{}),os(Ql).forEach(s),fl=a(l),i(c.$$.fragment,l),gl=a(l),i(V.$$.fragment,l),dl=a(l),i(u.$$.fragment,l),Bl=a(l),C=U(l,"P",{"data-svelte-h":!0}),p(C)!=="svelte-13ptqck"&&(C.innerHTML=Nt),El=a(l),j=U(l,"P",{"data-svelte-h":!0}),p(j)!=="svelte-s9ajoy"&&(j.innerHTML=kt),bl=a(l),Q=U(l,"P",{"data-svelte-h":!0}),p(Q)!=="svelte-q6ebkf"&&(Q.textContent=_t),Rl=a(l),I=U(l,"UL",{"data-svelte-h":!0}),p(I)!=="svelte-1nzerqt"&&(I.innerHTML=xt),Fl=a(l),h=U(l,"P",{"data-svelte-h":!0}),p(h)!=="svelte-1o6n18k"&&(h.textContent=At),$l=a(l),f=U(l,"P",{"data-svelte-h":!0}),p(f)!=="svelte-10cuwu2"&&(f.innerHTML=Ot),Nl=a(l),g=U(l,"P",{"data-svelte-h":!0}),p(g)!=="svelte-1sxrre8"&&(g.innerHTML=Dt),kl=a(l),d=U(l,"P",{"data-svelte-h":!0}),p(d)!=="svelte-hnsb09"&&(d.textContent=St),_l=a(l),B=U(l,"P",{"data-svelte-h":!0}),p(B)!=="svelte-7i38ps"&&(B.innerHTML=vt),xl=a(l),i(E.$$.fragment,l),Al=a(l),i(b.$$.fragment,l),Ol=a(l),i(R.$$.fragment,l),Dl=a(l),i(F.$$.fragment,l),Sl=a(l),$=U(l,"P",{"data-svelte-h":!0}),p($)!=="svelte-e64vs9"&&($.textContent=Zt),vl=a(l),N=U(l,"P",{"data-svelte-h":!0}),p(N)!=="svelte-1lry1tu"&&(N.textContent=Xt),Zl=a(l),k=U(l,"P",{"data-svelte-h":!0}),p(k)!=="svelte-1pldry4"&&(k.textContent=Wt),Xl=a(l),i(_.$$.fragment,l),Wl=a(l),i(x.$$.fragment,l),Gl=a(l),i(A.$$.fragment,l),ql=a(l),i(O.$$.fragment,l),Hl=a(l),D=U(l,"PRE",{"data-svelte-h":!0}),p(D)!=="svelte-bg107j"&&(D.textContent=Gt),zl=a(l),i(S.$$.fragment,l),Yl=a(l),v=U(l,"PRE",{"data-svelte-h":!0}),p(v)!=="svelte-1y81w65"&&(v.textContent=qt),Ll=a(l),Z=U(l,"P",{"data-svelte-h":!0}),p(Z)!=="svelte-itxndg"&&(Z.innerHTML=Ht),Pl=a(l),i(X.$$.fragment,l),Kl=a(l),i(W.$$.fragment,l),lt=a(l),G=U(l,"PRE",{"data-svelte-h":!0}),p(G)!=="svelte-hl8ub3"&&(G.textContent=zt),tt=a(l),q=U(l,"P",{"data-svelte-h":!0}),p(q)!=="svelte-1ixmqo7"&&(q.textContent=Yt),st=a(l),H=U(l,"P",{"data-svelte-h":!0}),p(H)!=="svelte-1ibu73l"&&(H.textContent=Lt),et=a(l),z=U(l,"P",{"data-svelte-h":!0}),p(z)!=="svelte-9xwwc7"&&(z.textContent=Pt),nt=a(l),i(Y.$$.fragment,l),at=a(l),L=U(l,"PRE",{"data-svelte-h":!0}),p(L)!=="svelte-1fe5r2s"&&(L.textContent=Kt),Jt=a(l),P=U(l,"P",{"data-svelte-h":!0}),p(P)!=="svelte-4hgami"&&(P.textContent=ls),Ut=a(l),i(K.$$.fragment,l),pt=a(l),ll=U(l,"P",{"data-svelte-h":!0}),p(ll)!=="svelte-haagwc"&&(ll.innerHTML=ts),Tt=a(l),tl=U(l,"P",{"data-svelte-h":!0}),p(tl)!=="svelte-yhb0ov"&&(tl.textContent=ss),it=a(l),sl=U(l,"P",{"data-svelte-h":!0}),p(sl)!=="svelte-injkr0"&&(sl.innerHTML=es),Mt=a(l),i(el.$$.fragment,l),rt=a(l),nl=U(l,"P",{"data-svelte-h":!0}),p(nl)!=="svelte-11vlbyc"&&(nl.textContent=ns),mt=a(l),i(al.$$.fragment,l),wt=a(l),Jl=U(l,"P",{"data-svelte-h":!0}),p(Jl)!=="svelte-1oueukd"&&(Jl.innerHTML=as),ot=a(l),i(Ul.$$.fragment,l),yt=a(l),pl=U(l,"PRE",{"data-svelte-h":!0}),p(pl)!=="svelte-y1mwv4"&&(pl.textContent=Js),ct=a(l),Tl=U(l,"P",{"data-svelte-h":!0}),p(Tl)!=="svelte-pbrv9z"&&(Tl.textContent=Us),Vt=a(l),il=U(l,"P",{"data-svelte-h":!0}),p(il)!=="svelte-1hwrhw9"&&(il.textContent=ps),ut=a(l),i(Ml.$$.fragment,l),Ct=a(l),rl=U(l,"P",{"data-svelte-h":!0}),p(rl)!=="svelte-wb8wpe"&&(rl.innerHTML=Ts),jt=a(l),ml=U(l,"P",{"data-svelte-h":!0}),p(ml)!=="svelte-1e7qcwv"&&(ml.innerHTML=is),Qt=a(l),i(wl.$$.fragment,l),It=a(l),i(ol.$$.fragment,l),ht=a(l),yl=U(l,"P",{"data-svelte-h":!0}),p(yl)!=="svelte-j05p0y"&&(yl.innerHTML=Ms),ft=a(l),cl=U(l,"P",{"data-svelte-h":!0}),p(cl)!=="svelte-16yj0nm"&&(cl.textContent=rs),gt=a(l),Vl=U(l,"P",{"data-svelte-h":!0}),p(Vl)!=="svelte-1a4a8ej"&&(Vl.innerHTML=ms),dt=a(l),i(ul.$$.fragment,l),Bt=a(l),Cl=U(l,"P",{"data-svelte-h":!0}),p(Cl)!=="svelte-z84soy"&&(Cl.textContent=ws),Et=a(l),i(jl.$$.fragment,l),bt=a(l),Il=U(l,"P",{}),os(Il).forEach(s),this.h()},h(){ys(y,"name","hf:doc:metadata"),ys(y,"content",Bs)},m(l,t){Is(document.head,y),e(l,hl,t),e(l,Ql,t),e(l,fl,t),M(c,l,t),e(l,gl,t),M(V,l,t),e(l,dl,t),M(u,l,t),e(l,Bl,t),e(l,C,t),e(l,El,t),e(l,j,t),e(l,bl,t),e(l,Q,t),e(l,Rl,t),e(l,I,t),e(l,Fl,t),e(l,h,t),e(l,$l,t),e(l,f,t),e(l,Nl,t),e(l,g,t),e(l,kl,t),e(l,d,t),e(l,_l,t),e(l,B,t),e(l,xl,t),M(E,l,t),e(l,Al,t),M(b,l,t),e(l,Ol,t),M(R,l,t),e(l,Dl,t),M(F,l,t),e(l,Sl,t),e(l,$,t),e(l,vl,t),e(l,N,t),e(l,Zl,t),e(l,k,t),e(l,Xl,t),M(_,l,t),e(l,Wl,t),M(x,l,t),e(l,Gl,t),M(A,l,t),e(l,ql,t),M(O,l,t),e(l,Hl,t),e(l,D,t),e(l,zl,t),M(S,l,t),e(l,Yl,t),e(l,v,t),e(l,Ll,t),e(l,Z,t),e(l,Pl,t),M(X,l,t),e(l,Kl,t),M(W,l,t),e(l,lt,t),e(l,G,t),e(l,tt,t),e(l,q,t),e(l,st,t),e(l,H,t),e(l,et,t),e(l,z,t),e(l,nt,t),M(Y,l,t),e(l,at,t),e(l,L,t),e(l,Jt,t),e(l,P,t),e(l,Ut,t),M(K,l,t),e(l,pt,t),e(l,ll,t),e(l,Tt,t),e(l,tl,t),e(l,it,t),e(l,sl,t),e(l,Mt,t),M(el,l,t),e(l,rt,t),e(l,nl,t),e(l,mt,t),M(al,l,t),e(l,wt,t),e(l,Jl,t),e(l,ot,t),M(Ul,l,t),e(l,yt,t),e(l,pl,t),e(l,ct,t),e(l,Tl,t),e(l,Vt,t),e(l,il,t),e(l,ut,t),M(Ml,l,t),e(l,Ct,t),e(l,rl,t),e(l,jt,t),e(l,ml,t),e(l,Qt,t),M(wl,l,t),e(l,It,t),M(ol,l,t),e(l,ht,t),e(l,yl,t),e(l,ft,t),e(l,cl,t),e(l,gt,t),e(l,Vl,t),e(l,dt,t),M(ul,l,t),e(l,Bt,t),e(l,Cl,t),e(l,Et,t),M(jl,l,t),e(l,bt,t),e(l,Il,t),Rt=!0},p:Vs,i(l){Rt||(r(c.$$.fragment,l),r(V.$$.fragment,l),r(u.$$.fragment,l),r(E.$$.fragment,l),r(b.$$.fragment,l),r(R.$$.fragment,l),r(F.$$.fragment,l),r(_.$$.fragment,l),r(x.$$.fragment,l),r(A.$$.fragment,l),r(O.$$.fragment,l),r(S.$$.fragment,l),r(X.$$.fragment,l),r(W.$$.fragment,l),r(Y.$$.fragment,l),r(K.$$.fragment,l),r(el.$$.fragment,l),r(al.$$.fragment,l),r(Ul.$$.fragment,l),r(Ml.$$.fragment,l),r(wl.$$.fragment,l),r(ol.$$.fragment,l),r(ul.$$.fragment,l),r(jl.$$.fragment,l),Rt=!0)},o(l){m(c.$$.fragment,l),m(V.$$.fragment,l),m(u.$$.fragment,l),m(E.$$.fragment,l),m(b.$$.fragment,l),m(R.$$.fragment,l),m(F.$$.fragment,l),m(_.$$.fragment,l),m(x.$$.fragment,l),m(A.$$.fragment,l),m(O.$$.fragment,l),m(S.$$.fragment,l),m(X.$$.fragment,l),m(W.$$.fragment,l),m(Y.$$.fragment,l),m(K.$$.fragment,l),m(el.$$.fragment,l),m(al.$$.fragment,l),m(Ul.$$.fragment,l),m(Ml.$$.fragment,l),m(wl.$$.fragment,l),m(ol.$$.fragment,l),m(ul.$$.fragment,l),m(jl.$$.fragment,l),Rt=!1},d(l){l&&(s(hl),s(Ql),s(fl),s(gl),s(dl),s(Bl),s(C),s(El),s(j),s(bl),s(Q),s(Rl),s(I),s(Fl),s(h),s($l),s(f),s(Nl),s(g),s(kl),s(d),s(_l),s(B),s(xl),s(Al),s(Ol),s(Dl),s(Sl),s($),s(vl),s(N),s(Zl),s(k),s(Xl),s(Wl),s(Gl),s(ql),s(Hl),s(D),s(zl),s(Yl),s(v),s(Ll),s(Z),s(Pl),s(Kl),s(lt),s(G),s(tt),s(q),s(st),s(H),s(et),s(z),s(nt),s(at),s(L),s(Jt),s(P),s(Ut),s(pt),s(ll),s(Tt),s(tl),s(it),s(sl),s(Mt),s(rt),s(nl),s(mt),s(wt),s(Jl),s(ot),s(yt),s(pl),s(ct),s(Tl),s(Vt),s(il),s(ut),s(Ct),s(rl),s(jt),s(ml),s(Qt),s(It),s(ht),s(yl),s(ft),s(cl),s(gt),s(Vl),s(dt),s(Bt),s(Cl),s(Et),s(bt),s(Il)),s(y),w(c,l),w(V,l),w(u,l),w(E,l),w(b,l),w(R,l),w(F,l),w(_,l),w(x,l),w(A,l),w(O,l),w(S,l),w(X,l),w(W,l),w(Y,l),w(K,l),w(el,l),w(al,l),w(Ul,l),w(Ml,l),w(wl,l),w(ol,l),w(ul,l),w(jl,l)}}}const Bs='{"title":"구조화된 생성으로 근거 강조 표시가 있는 RAG 시스템 구축하기","local":"구조화된-생성으로-근거-강조-표시가-있는-rag-시스템-구축하기","sections":[{"title":"모델에 프롬프트 제공하기","local":"모델에-프롬프트-제공하기","sections":[],"depth":2},{"title":"👉 제한된 디코딩(Constrained decoding)","local":"-제한된-디코딩constrained-decoding","sections":[{"title":"Outlines를 사용해서 로컬 환경에서 문법 활용하기","local":"outlines를-사용해서-로컬-환경에서-문법-활용하기","sections":[],"depth":3}],"depth":2}],"depth":1}';function Es($t){return us(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ns extends Cs{constructor(y){super(),js(this,y,Es,ds,cs,{})}}export{Ns as component};
