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

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

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




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

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

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

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


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

문서:

오늘 서울의 날씨가 정말 좋네요.
Transformers에서 \x1B[1;32m정지 시퀀스를 정의하려면 파이프라인 또는 모델에 stop_sequence 인수를 전달해야 합니다.\x1B[0m
`,Kl,G,Ht="잘 작동합니다! 🥳",lt,q,zt="하지만 성능이 낮은 모델을 사용하는 경우는 어떨까요?",tt,H,Yt="성능이 떨어지는 모델의 불안정한 출력을 시뮬레이션하기 위해, temperature 값을 높여보겠습니다.",st,z,et,Y,Lt=`&#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
`,nt,L,Pt="출력이 올바른 JSON 형식조차 아닌 것을 확인할 수 있습니다.",at,P,Jt,K,Kt="JSON 출력을 강제하기 위해, 우리는 <strong>제한된 디코딩</strong>을 사용해야 합니다. 여기서 LLM이 <strong>문법</strong>이라고 불리는 일련의 규칙에 맞는 토큰만 출력하도록 강제합니다.",Ut,ll,ls="이 문법은 Pydantic 모델, JSON 스키마 또는 정규 표현식을 사용하여 정의할 수 있습니다. 그러면 AI는 지정된 문법에 맞는 응답을 생성합니다.",pt,tl,ts='예를 들어, 여기서는 <a href="https://docs.pydantic.dev/latest/api/types/" rel="nofollow">Pydantic 타입</a>을 따릅니다.',Tt,sl,it,el,ss="생성된 스키마가 요구 사항을 올바르게 나타내는지 확인해 보세요.",Mt,nl,rt,al,es="클라이언트의 <code>text_generation</code> 메서드를 사용하거나 <code>post</code> 메서드를 사용할 수 있습니다.",wt,Jl,mt,Ul,ns=`&#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"
]
}
`,ot,pl,as="✅ 높은 temperature 설정으로 인해 답변 내용은 여전히 말이 되지 않지만, 생성된 출력 텍스트는 이제 우리가 문법에서 정의한 정확한 키와 자료형을 가진 올바른 JSON 형식입니다!",yt,Tl,Js="이제 이 출력물을 추가 처리를 위해 파싱할 수 있습니다.",ct,il,Vt,Ml,Us='<a href="https://github.com/outlines-dev/outlines/" rel="nofollow">Outlines</a>는 Hugging Face의 Inference API에서 출력 생성을 제한하기 위해 내부적으로 실행되는 라이브러리입니다. 이를 로컬 환경에서도 사용할 수 있습니다.',ut,rl,ps='이 라이브러리는 <a href="https://github.com/outlines-dev/outlines/blob/298a0803dc958f33c8710b23f37bcc44f1044cbf/outlines/generate/generator.py#L143" rel="nofollow">로짓(logits)에 편향(bias)을 적용하는 방식</a>으로 작동하여, 사용자가 정의한 제약 조건에 부합하는 선택지만 강제로 선택되도록 합니다.',Ct,wl,Qt,ml,jt,ol,Ts='제약 생성(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>를 참조하세요).',It,yl,is="지금까지 우리는 특정 RAG 사용 사례를 보여주었지만, 제약 생성은 그 이상으로 많은 도움이 됩니다.",ht,cl,Ms='예를 들어, <a href="llm_judge">LLM judge</a> 워크플로우에서도 제약 생성을 사용하여 다음과 같은 JSON을 출력할 수 있습니다:',ft,Vl,gt,ul,rs="오늘은 여기까지입니다. 끝까지 따라와 주셔서 감사드립니다! 👏",dt,Cl,Et,jl,bt;return c=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/main/notebooks/ko/structured_generation.ipynb"}]}}),V=new Bt({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}}),B=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}}),R=new Bt({props:{title:"모델에 프롬프트 제공하기",local:"모델에-프롬프트-제공하기",headingTag:"h2"}}),k=new o({props:{code:"UkVMRVZBTlRfQ09OVEVYVCUyMCUzRCUyMCUyMiUyMiUyMiUwQSVFQiVBQyVCOCVFQyU4NCU5QyUzQSUwQSUwQSVFQyU5OCVBNCVFQiU4QSU5OCUyMCVFQyU4NCU5QyVFQyU5QSVCOCVFQyU5RCU5OCUyMCVFQiU4MiVBMCVFQyU5NCVBOCVFQSVCMCU4MCUyMCVFQyVBMCU5NSVFQiVBNyU5MCUyMCVFQyVBMiU4QiVFQiU4NCVBNCVFQyU5QSU5NC4lMEFUcmFuc2Zvcm1lcnMlRUMlOTclOTAlRUMlODQlOUMlMjAlRUMlQTAlOTUlRUMlQTclODAlMjAlRUMlOEIlOUMlRUQlODAlODAlRUMlOEElQTQlRUIlQTUlQkMlMjAlRUMlQTAlOTUlRUMlOUQlOTglRUQlOTUlOTglRUIlQTAlQTQlRUIlQTklQjQlMjAlRUQlOEMlOEMlRUMlOUQlQjQlRUQlOTQlODQlRUIlOUQlQkMlRUMlOUQlQjglMjAlRUIlOTglOTAlRUIlOEElOTQlMjAlRUIlQUElQTglRUIlOEQlQjglRUMlOTclOTAlMjBzdG9wX3NlcXVlbmNlJTIwJUVDJTlEJUI4JUVDJTg4JTk4JUVCJUE1JUJDJTIwJUVDJUEwJTg0JUVCJThCJUFDJUVEJTk1JUI0JUVDJTk1JUJDJTIwJUVEJTk1JUE5JUVCJThCJTg4JUVCJThCJUE0LiUwQSUwQSUyMiUyMiUyMg==",highlighted:`RELEVANT_CONTEXT = <span class="hljs-string">&quot;&quot;&quot;
문서:

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

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