import{s as wt,n as Jt,o as Ut}from"../chunks/scheduler.5f3e6389.js";import{S as jt,i as Ct,e as M,s as i,c as a,h as bt,a as u,d as l,b as n,f as Tt,g as m,j as y,k as st,l as vt,m as s,n as p,t as r,o as c,p as o}from"../chunks/index.373ab25c.js";import{C as It,H as f,E as _t}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.a1bfc432.js";import{C as $}from"../chunks/CodeBlock.ab07329b.js";function kt(it){let g,ce,pe,oe,T,Me,w,ue,J,fe,U,ye,j,nt="There are two types of metrics in Lighteval:",ge,C,$e,b,at="<li><strong>Purpose</strong>: Evaluate individual samples/predictions</li> <li><strong>Input</strong>: Takes a <code>Doc</code> and <code>ModelResponse</code> (model’s prediction)</li> <li><strong>Output</strong>: Returns a float or boolean value for that specific sample</li> <li><strong>Example</strong>: Checking if a model’s answer matches the correct answer for one sample</li>",he,v,de,I,mt=`<li><strong>Purpose</strong>: Compute final scores across the entire dataset/corpus</li> <li><strong>Input</strong>: Takes the results from all sample-level evaluations</li> <li><strong>Output</strong>: Returns a single score representing overall performance</li> <li><strong>Examples</strong>:
<ul><li>Simple aggregation: Calculating average accuracy across all test samples</li> <li>Complex metrics: BLEU score where sample-level metric prepares data (tokenization, etc.) and corpus-level metric computes the actual BLEU score</li></ul></li>`,Te,_,we,k,pt=`First, check if you can use one of the parameterized functions in
<a href="package_reference/metrics#corpus-metrics">Corpus Metrics</a> or
<a href="package_reference/metrics#sample-metrics">Sample Metrics</a>.`,Je,G,rt="If not, you can use the <code>custom_task</code> system to register your new metric.",Ue,h,ct='<p>To see an example of a custom metric added along with a custom task, look at the <a href="https://github.com/huggingface/lighteval/tree/main/examples/custom_tasks/ifeval" rel="nofollow">IFEval custom task</a>.</p>',je,d,ot=`<p>To contribute your custom metric to the Lighteval repository, you would first need
to install the required dev dependencies by running <code>pip install -e .[dev]</code>
and then run <code>pre-commit install</code> to install the pre-commit hooks.</p>`,Ce,V,be,E,ve,B,Mt=`Create a new Python file which should contain the full logic of your metric.
The file also needs to start with these imports:`,Ie,Z,_e,x,ke,S,ut=`You need to define a sample-level metric. All sample-level metrics will have the same signature, taking a
<code>~lighteval.types.Doc</code> and a <code>~lighteval.types.ModelResponse</code>. The metric should return a float or a
boolean.`,Ge,X,Ve,R,Ee,Y,Be,z,ft="If you want to return multiple metrics per sample, you need to return a dictionary with the metrics as keys and the values as values:",Ze,N,xe,W,Se,A,yt="You can define an aggregation function if needed. A common aggregation function is <code>np.mean</code>:",Xe,Q,Re,L,Ye,q,ze,H,gt=`If it’s a sample-level metric, you can use the following code
with <a href="/docs/lighteval/pr_1017/en/package_reference/metrics#lighteval.metrics.utils.metric_utils.SampleLevelMetric">SampleLevelMetric</a>:`,Ne,F,We,D,Ae,P,$t=`If your metric defines multiple metrics per sample, you can use the following code
with <a href="/docs/lighteval/pr_1017/en/package_reference/metrics#lighteval.metrics.utils.metric_utils.SampleLevelMetricGrouping">SampleLevelMetricGrouping</a>:`,Qe,O,Le,K,qe,ee,ht=`To finish, add the following code so that it adds your metric to our metrics list
when loaded as a module:`,He,te,Fe,le,De,se,Pe,ie,dt="You can then give your custom metric to Lighteval by using <code>--custom-tasks path_to_your_file</code> when launching it after adding it to the task config.",Oe,ne,Ke,ae,et,me,tt,re,lt;return T=new It({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),w=new f({props:{title:"Adding a New Metric",local:"adding-a-new-metric",headingTag:"h1"}}),J=new f({props:{title:"Before You Start",local:"before-you-start",headingTag:"h2"}}),U=new f({props:{title:"Two different types of metrics",local:"two-different-types-of-metrics",headingTag:"h3"}}),C=new f({props:{title:"Sample-Level Metrics",local:"sample-level-metrics",headingTag:"h4"}}),v=new f({props:{title:"Corpus-Level Metrics",local:"corpus-level-metrics",headingTag:"h4"}}),_=new f({props:{title:"Check Existing Metrics",local:"check-existing-metrics",headingTag:"h3"}}),V=new f({props:{title:"Creating a Custom Metric",local:"creating-a-custom-metric",headingTag:"h2"}}),E=new f({props:{title:"Step 1: Create the Metric File",local:"step-1-create-the-metric-file",headingTag:"h3"}}),Z=new $({props:{code:"ZnJvbSUyMGFlbnVtJTIwaW1wb3J0JTIwZXh0ZW5kX2VudW0lMEFmcm9tJTIwbGlnaHRldmFsLm1ldHJpY3MlMjBpbXBvcnQlMjBNZXRyaWNz",highlighted:`<span class="hljs-keyword">from</span> aenum <span class="hljs-keyword">import</span> extend_enum
<span class="hljs-keyword">from</span> lighteval.metrics <span class="hljs-keyword">import</span> Metrics`,wrap:!1}}),x=new f({props:{title:"Step 2: Define the Sample-Level Metric",local:"step-2-define-the-sample-level-metric",headingTag:"h3"}}),X=new f({props:{title:"Single Metric Example",local:"single-metric-example",headingTag:"h4"}}),R=new $({props:{code:"ZGVmJTIwY3VzdG9tX21ldHJpYyhkb2MlM0ElMjBEb2MlMkMlMjBtb2RlbF9yZXNwb25zZSUzQSUyME1vZGVsUmVzcG9uc2UpJTIwLSUzRSUyMGJvb2wlM0ElMEElMjAlMjAlMjAlMjByZXNwb25zZSUyMCUzRCUyMG1vZGVsX3Jlc3BvbnNlLnRleHQlNUIwJTVEJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwcmVzcG9uc2UlMjAlM0QlM0QlMjBkb2MuY2hvaWNlcyU1QmRvYy5nb2xkX2luZGV4JTVE",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">custom_metric</span>(<span class="hljs-params">doc: Doc, model_response: ModelResponse</span>) -&gt; <span class="hljs-built_in">bool</span>:
    response = model_response.text[<span class="hljs-number">0</span>]
    <span class="hljs-keyword">return</span> response == doc.choices[doc.gold_index]`,wrap:!1}}),Y=new f({props:{title:"Multiple Metrics Example",local:"multiple-metrics-example",headingTag:"h4"}}),N=new $({props:{code:"ZGVmJTIwY3VzdG9tX21ldHJpYyhkb2MlM0ElMjBEb2MlMkMlMjBtb2RlbF9yZXNwb25zZSUzQSUyME1vZGVsUmVzcG9uc2UpJTIwLSUzRSUyMGRpY3QlM0ElMEElMjAlMjAlMjAlMjByZXNwb25zZSUyMCUzRCUyMG1vZGVsX3Jlc3BvbnNlLnRleHQlNUIwJTVEJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwJTdCJTIyYWNjdXJhY3klMjIlM0ElMjByZXNwb25zZSUyMCUzRCUzRCUyMGRvYy5jaG9pY2VzJTVCZG9jLmdvbGRfaW5kZXglNUQlMkMlMjAlMjJvdGhlcl9tZXRyaWMlMjIlM0ElMjAwLjUlN0Q=",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">custom_metric</span>(<span class="hljs-params">doc: Doc, model_response: ModelResponse</span>) -&gt; <span class="hljs-built_in">dict</span>:
    response = model_response.text[<span class="hljs-number">0</span>]
    <span class="hljs-keyword">return</span> {<span class="hljs-string">&quot;accuracy&quot;</span>: response == doc.choices[doc.gold_index], <span class="hljs-string">&quot;other_metric&quot;</span>: <span class="hljs-number">0.5</span>}`,wrap:!1}}),W=new f({props:{title:"Step 3: Define Aggregation Function (Optional)",local:"step-3-define-aggregation-function-optional",headingTag:"h3"}}),Q=new $({props:{code:"ZGVmJTIwYWdnX2Z1bmN0aW9uKGl0ZW1zKSUzQSUwQSUyMCUyMCUyMCUyMGZsYXRfaXRlbXMlMjAlM0QlMjAlNUJpdGVtJTIwZm9yJTIwc3VibGlzdCUyMGluJTIwaXRlbXMlMjBmb3IlMjBpdGVtJTIwaW4lMjBzdWJsaXN0JTVEJTBBJTIwJTIwJTIwJTIwc2NvcmUlMjAlM0QlMjBzdW0oZmxhdF9pdGVtcyklMjAlMkYlMjBsZW4oZmxhdF9pdGVtcyklMEElMjAlMjAlMjAlMjByZXR1cm4lMjBzY29yZQ==",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">agg_function</span>(<span class="hljs-params">items</span>):
    flat_items = [item <span class="hljs-keyword">for</span> sublist <span class="hljs-keyword">in</span> items <span class="hljs-keyword">for</span> item <span class="hljs-keyword">in</span> sublist]
    score = <span class="hljs-built_in">sum</span>(flat_items) / <span class="hljs-built_in">len</span>(flat_items)
    <span class="hljs-keyword">return</span> score`,wrap:!1}}),L=new f({props:{title:"Step 4: Create the Metric Object",local:"step-4-create-the-metric-object",headingTag:"h3"}}),q=new f({props:{title:"Single Metric",local:"single-metric",headingTag:"h4"}}),F=new $({props:{code:"bXlfY3VzdG9tX21ldHJpYyUyMCUzRCUyMFNhbXBsZUxldmVsTWV0cmljKCUwQSUyMCUyMCUyMCUyMG1ldHJpY19uYW1lJTNEJTIyY3VzdG9tX2FjY3VyYWN5JTIyJTJDJTBBJTIwJTIwJTIwJTIwaGlnaGVyX2lzX2JldHRlciUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBjYXRlZ29yeSUzRFNhbXBsaW5nTWV0aG9kLkdFTkVSQVRJVkUlMkMlMEElMjAlMjAlMjAlMjBzYW1wbGVfbGV2ZWxfZm4lM0RjdXN0b21fbWV0cmljJTJDJTBBJTIwJTIwJTIwJTIwY29ycHVzX2xldmVsX2ZuJTNEYWdnX2Z1bmN0aW9uJTJDJTBBKQ==",highlighted:`my_custom_metric = SampleLevelMetric(
    metric_name=<span class="hljs-string">&quot;custom_accuracy&quot;</span>,
    higher_is_better=<span class="hljs-literal">True</span>,
    category=SamplingMethod.GENERATIVE,
    sample_level_fn=custom_metric,
    corpus_level_fn=agg_function,
)`,wrap:!1}}),D=new f({props:{title:"Multiple Metrics",local:"multiple-metrics",headingTag:"h4"}}),O=new $({props:{code:"Y3VzdG9tX21ldHJpYyUyMCUzRCUyMFNhbXBsZUxldmVsTWV0cmljR3JvdXBpbmcoJTBBJTIwJTIwJTIwJTIwbWV0cmljX25hbWUlM0QlNUIlMjJhY2N1cmFjeSUyMiUyQyUyMCUyMnJlc3BvbnNlX2xlbmd0aCUyMiUyQyUyMCUyMmNvbmZpZGVuY2UlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBoaWdoZXJfaXNfYmV0dGVyJTNEJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyYWNjdXJhY3klMjIlM0ElMjBUcnVlJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycmVzcG9uc2VfbGVuZ3RoJTIyJTNBJTIwRmFsc2UlMkMlMjAlMjAlMjMlMjBTaG9ydGVyJTIwcmVzcG9uc2VzJTIwbWlnaHQlMjBiZSUyMGJldHRlciUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmNvbmZpZGVuY2UlMjIlM0ElMjBUcnVlJTBBJTIwJTIwJTIwJTIwJTdEJTJDJTBBJTIwJTIwJTIwJTIwY2F0ZWdvcnklM0RTYW1wbGluZ01ldGhvZC5HRU5FUkFUSVZFJTJDJTBBJTIwJTIwJTIwJTIwc2FtcGxlX2xldmVsX2ZuJTNEY3VzdG9tX21ldHJpYyUyQyUwQSUyMCUyMCUyMCUyMGNvcnB1c19sZXZlbF9mbiUzRCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmFjY3VyYWN5JTIyJTNBJTIwbnAubWVhbiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnJlc3BvbnNlX2xlbmd0aCUyMiUzQSUyMG5wLm1lYW4lMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJjb25maWRlbmNlJTIyJTNBJTIwbnAubWVhbiUyQyUwQSUyMCUyMCUyMCUyMCU3RCUyQyUwQSk=",highlighted:`custom_metric = SampleLevelMetricGrouping(
    metric_name=[<span class="hljs-string">&quot;accuracy&quot;</span>, <span class="hljs-string">&quot;response_length&quot;</span>, <span class="hljs-string">&quot;confidence&quot;</span>],
    higher_is_better={
        <span class="hljs-string">&quot;accuracy&quot;</span>: <span class="hljs-literal">True</span>,
        <span class="hljs-string">&quot;response_length&quot;</span>: <span class="hljs-literal">False</span>,  <span class="hljs-comment"># Shorter responses might be better</span>
        <span class="hljs-string">&quot;confidence&quot;</span>: <span class="hljs-literal">True</span>
    },
    category=SamplingMethod.GENERATIVE,
    sample_level_fn=custom_metric,
    corpus_level_fn={
        <span class="hljs-string">&quot;accuracy&quot;</span>: np.mean,
        <span class="hljs-string">&quot;response_length&quot;</span>: np.mean,
        <span class="hljs-string">&quot;confidence&quot;</span>: np.mean,
    },
)`,wrap:!1}}),K=new f({props:{title:"Step 5: Register the Metric",local:"step-5-register-the-metric",headingTag:"h3"}}),te=new $({props:{code:"JTIzJTIwQWRkcyUyMHRoZSUyMG1ldHJpYyUyMHRvJTIwdGhlJTIwbWV0cmljJTIwbGlzdCElMEFleHRlbmRfZW51bShNZXRyaWNzJTJDJTIwJTIyQ1VTVE9NX0FDQ1VSQUNZJTIyJTJDJTIwbXlfY3VzdG9tX21ldHJpYyklMEElMEFpZiUyMF9fbmFtZV9fJTIwJTNEJTNEJTIwJTIyX19tYWluX18lMjIlM0ElMEElMjAlMjAlMjAlMjBwcmludCglMjJJbXBvcnRlZCUyMG1ldHJpYyUyMik=",highlighted:`<span class="hljs-comment"># Adds the metric to the metric list!</span>
extend_enum(Metrics, <span class="hljs-string">&quot;CUSTOM_ACCURACY&quot;</span>, my_custom_metric)

<span class="hljs-keyword">if</span> __name__ == <span class="hljs-string">&quot;__main__&quot;</span>:
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Imported metric&quot;</span>)`,wrap:!1}}),le=new f({props:{title:"Using Your Custom Metric",local:"using-your-custom-metric",headingTag:"h2"}}),se=new f({props:{title:"With Custom Tasks",local:"with-custom-tasks",headingTag:"h3"}}),ne=new $({props:{code:"bGlnaHRldmFsJTIwYWNjZWxlcmF0ZSUyMCU1QyUwQSUyMCUyMCUyMCUyMCUyMm1vZGVsX25hbWUlM0RvcGVuYWktY29tbXVuaXR5JTJGZ3B0MiUyMiUyMCU1QyUwQSUyMCUyMCUyMCUyMCUyMmxlYWRlcmJvYXJkJTdDdHJ1dGhmdWxxYSUzQW1jJTdDMCUyMiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tY3VzdG9tLXRhc2tzJTIwcGF0aF90b195b3VyX21ldHJpY19maWxlLnB5",highlighted:`lighteval accelerate \\
    <span class="hljs-string">&quot;model_name=openai-community/gpt2&quot;</span> \\
    <span class="hljs-string">&quot;leaderboard|truthfulqa:mc|0&quot;</span> \\
    --custom-tasks path_to_your_metric_file.py`,wrap:!1}}),ae=new $({props:{code:"ZnJvbSUyMGxpZ2h0ZXZhbC50YXNrcy5saWdodGV2YWxfdGFzayUyMGltcG9ydCUyMExpZ2h0ZXZhbFRhc2tDb25maWclMEElMEF0YXNrJTIwJTNEJTIwTGlnaHRldmFsVGFza0NvbmZpZyglMEElMjAlMjAlMjAlMjBuYW1lJTNEJTIybXlfY3VzdG9tX3Rhc2slMjIlMkMlMEElMjAlMjAlMjAlMjBzdWl0ZSUzRCU1QiUyMmNvbW11bml0eSUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMG1ldHJpYyUzRCU1Qm15X2N1c3RvbV9tZXRyaWMlNUQlMkMlMjAlMjAlMjMlMjBVc2UlMjB5b3VyJTIwY3VzdG9tJTIwbWV0cmljJTIwaGVyZSUwQSUyMCUyMCUyMCUyMHByb21wdF9mdW5jdGlvbiUzRG15X3Byb21wdF9mdW5jdGlvbiUyQyUwQSUyMCUyMCUyMCUyMGhmX3JlcG8lM0QlMjJteV9kYXRhc2V0JTIyJTJDJTBBJTIwJTIwJTIwJTIwZXZhbHVhdGlvbl9zcGxpdHMlM0QlNUIlMjJ0ZXN0JTIyJTVEJTBBKQ==",highlighted:`<span class="hljs-keyword">from</span> lighteval.tasks.lighteval_task <span class="hljs-keyword">import</span> LightevalTaskConfig

task = LightevalTaskConfig(
    name=<span class="hljs-string">&quot;my_custom_task&quot;</span>,
    suite=[<span class="hljs-string">&quot;community&quot;</span>],
    metric=[my_custom_metric],  <span class="hljs-comment"># Use your custom metric here</span>
    prompt_function=my_prompt_function,
    hf_repo=<span class="hljs-string">&quot;my_dataset&quot;</span>,
    evaluation_splits=[<span class="hljs-string">&quot;test&quot;</span>]
)`,wrap:!1}}),me=new _t({props:{source:"https://github.com/huggingface/lighteval/blob/main/docs/source/adding-a-new-metric.mdx"}}),{c(){g=M("meta"),ce=i(),pe=M("p"),oe=i(),a(T.$$.fragment),Me=i(),a(w.$$.fragment),ue=i(),a(J.$$.fragment),fe=i(),a(U.$$.fragment),ye=i(),j=M("p"),j.textContent=nt,ge=i(),a(C.$$.fragment),$e=i(),b=M("ul"),b.innerHTML=at,he=i(),a(v.$$.fragment),de=i(),I=M("ul"),I.innerHTML=mt,Te=i(),a(_.$$.fragment),we=i(),k=M("p"),k.innerHTML=pt,Je=i(),G=M("p"),G.innerHTML=rt,Ue=i(),h=M("blockquote"),h.innerHTML=ct,je=i(),d=M("blockquote"),d.innerHTML=ot,Ce=i(),a(V.$$.fragment),be=i(),a(E.$$.fragment),ve=i(),B=M("p"),B.textContent=Mt,Ie=i(),a(Z.$$.fragment),_e=i(),a(x.$$.fragment),ke=i(),S=M("p"),S.innerHTML=ut,Ge=i(),a(X.$$.fragment),Ve=i(),a(R.$$.fragment),Ee=i(),a(Y.$$.fragment),Be=i(),z=M("p"),z.textContent=ft,Ze=i(),a(N.$$.fragment),xe=i(),a(W.$$.fragment),Se=i(),A=M("p"),A.innerHTML=yt,Xe=i(),a(Q.$$.fragment),Re=i(),a(L.$$.fragment),Ye=i(),a(q.$$.fragment),ze=i(),H=M("p"),H.innerHTML=gt,Ne=i(),a(F.$$.fragment),We=i(),a(D.$$.fragment),Ae=i(),P=M("p"),P.innerHTML=$t,Qe=i(),a(O.$$.fragment),Le=i(),a(K.$$.fragment),qe=i(),ee=M("p"),ee.textContent=ht,He=i(),a(te.$$.fragment),Fe=i(),a(le.$$.fragment),De=i(),a(se.$$.fragment),Pe=i(),ie=M("p"),ie.innerHTML=dt,Oe=i(),a(ne.$$.fragment),Ke=i(),a(ae.$$.fragment),et=i(),a(me.$$.fragment),tt=i(),re=M("p"),this.h()},l(e){const t=bt("svelte-u9bgzb",document.head);g=u(t,"META",{name:!0,content:!0}),t.forEach(l),ce=n(e),pe=u(e,"P",{}),Tt(pe).forEach(l),oe=n(e),m(T.$$.fragment,e),Me=n(e),m(w.$$.fragment,e),ue=n(e),m(J.$$.fragment,e),fe=n(e),m(U.$$.fragment,e),ye=n(e),j=u(e,"P",{"data-svelte-h":!0}),y(j)!=="svelte-1jnixsg"&&(j.textContent=nt),ge=n(e),m(C.$$.fragment,e),$e=n(e),b=u(e,"UL",{"data-svelte-h":!0}),y(b)!=="svelte-1nwago0"&&(b.innerHTML=at),he=n(e),m(v.$$.fragment,e),de=n(e),I=u(e,"UL",{"data-svelte-h":!0}),y(I)!=="svelte-15e9ylm"&&(I.innerHTML=mt),Te=n(e),m(_.$$.fragment,e),we=n(e),k=u(e,"P",{"data-svelte-h":!0}),y(k)!=="svelte-vpq2qz"&&(k.innerHTML=pt),Je=n(e),G=u(e,"P",{"data-svelte-h":!0}),y(G)!=="svelte-xdscpl"&&(G.innerHTML=rt),Ue=n(e),h=u(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),y(h)!=="svelte-1nxhxit"&&(h.innerHTML=ct),je=n(e),d=u(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),y(d)!=="svelte-3wrpqo"&&(d.innerHTML=ot),Ce=n(e),m(V.$$.fragment,e),be=n(e),m(E.$$.fragment,e),ve=n(e),B=u(e,"P",{"data-svelte-h":!0}),y(B)!=="svelte-rk8zi4"&&(B.textContent=Mt),Ie=n(e),m(Z.$$.fragment,e),_e=n(e),m(x.$$.fragment,e),ke=n(e),S=u(e,"P",{"data-svelte-h":!0}),y(S)!=="svelte-uw89ed"&&(S.innerHTML=ut),Ge=n(e),m(X.$$.fragment,e),Ve=n(e),m(R.$$.fragment,e),Ee=n(e),m(Y.$$.fragment,e),Be=n(e),z=u(e,"P",{"data-svelte-h":!0}),y(z)!=="svelte-1vuyefu"&&(z.textContent=ft),Ze=n(e),m(N.$$.fragment,e),xe=n(e),m(W.$$.fragment,e),Se=n(e),A=u(e,"P",{"data-svelte-h":!0}),y(A)!=="svelte-n3kro3"&&(A.innerHTML=yt),Xe=n(e),m(Q.$$.fragment,e),Re=n(e),m(L.$$.fragment,e),Ye=n(e),m(q.$$.fragment,e),ze=n(e),H=u(e,"P",{"data-svelte-h":!0}),y(H)!=="svelte-1khq5z0"&&(H.innerHTML=gt),Ne=n(e),m(F.$$.fragment,e),We=n(e),m(D.$$.fragment,e),Ae=n(e),P=u(e,"P",{"data-svelte-h":!0}),y(P)!=="svelte-27wuxe"&&(P.innerHTML=$t),Qe=n(e),m(O.$$.fragment,e),Le=n(e),m(K.$$.fragment,e),qe=n(e),ee=u(e,"P",{"data-svelte-h":!0}),y(ee)!=="svelte-1bbv5uf"&&(ee.textContent=ht),He=n(e),m(te.$$.fragment,e),Fe=n(e),m(le.$$.fragment,e),De=n(e),m(se.$$.fragment,e),Pe=n(e),ie=u(e,"P",{"data-svelte-h":!0}),y(ie)!=="svelte-o8irch"&&(ie.innerHTML=dt),Oe=n(e),m(ne.$$.fragment,e),Ke=n(e),m(ae.$$.fragment,e),et=n(e),m(me.$$.fragment,e),tt=n(e),re=u(e,"P",{}),Tt(re).forEach(l),this.h()},h(){st(g,"name","hf:doc:metadata"),st(g,"content",Gt),st(h,"class","tip"),st(d,"class","warning")},m(e,t){vt(document.head,g),s(e,ce,t),s(e,pe,t),s(e,oe,t),p(T,e,t),s(e,Me,t),p(w,e,t),s(e,ue,t),p(J,e,t),s(e,fe,t),p(U,e,t),s(e,ye,t),s(e,j,t),s(e,ge,t),p(C,e,t),s(e,$e,t),s(e,b,t),s(e,he,t),p(v,e,t),s(e,de,t),s(e,I,t),s(e,Te,t),p(_,e,t),s(e,we,t),s(e,k,t),s(e,Je,t),s(e,G,t),s(e,Ue,t),s(e,h,t),s(e,je,t),s(e,d,t),s(e,Ce,t),p(V,e,t),s(e,be,t),p(E,e,t),s(e,ve,t),s(e,B,t),s(e,Ie,t),p(Z,e,t),s(e,_e,t),p(x,e,t),s(e,ke,t),s(e,S,t),s(e,Ge,t),p(X,e,t),s(e,Ve,t),p(R,e,t),s(e,Ee,t),p(Y,e,t),s(e,Be,t),s(e,z,t),s(e,Ze,t),p(N,e,t),s(e,xe,t),p(W,e,t),s(e,Se,t),s(e,A,t),s(e,Xe,t),p(Q,e,t),s(e,Re,t),p(L,e,t),s(e,Ye,t),p(q,e,t),s(e,ze,t),s(e,H,t),s(e,Ne,t),p(F,e,t),s(e,We,t),p(D,e,t),s(e,Ae,t),s(e,P,t),s(e,Qe,t),p(O,e,t),s(e,Le,t),p(K,e,t),s(e,qe,t),s(e,ee,t),s(e,He,t),p(te,e,t),s(e,Fe,t),p(le,e,t),s(e,De,t),p(se,e,t),s(e,Pe,t),s(e,ie,t),s(e,Oe,t),p(ne,e,t),s(e,Ke,t),p(ae,e,t),s(e,et,t),p(me,e,t),s(e,tt,t),s(e,re,t),lt=!0},p:Jt,i(e){lt||(r(T.$$.fragment,e),r(w.$$.fragment,e),r(J.$$.fragment,e),r(U.$$.fragment,e),r(C.$$.fragment,e),r(v.$$.fragment,e),r(_.$$.fragment,e),r(V.$$.fragment,e),r(E.$$.fragment,e),r(Z.$$.fragment,e),r(x.$$.fragment,e),r(X.$$.fragment,e),r(R.$$.fragment,e),r(Y.$$.fragment,e),r(N.$$.fragment,e),r(W.$$.fragment,e),r(Q.$$.fragment,e),r(L.$$.fragment,e),r(q.$$.fragment,e),r(F.$$.fragment,e),r(D.$$.fragment,e),r(O.$$.fragment,e),r(K.$$.fragment,e),r(te.$$.fragment,e),r(le.$$.fragment,e),r(se.$$.fragment,e),r(ne.$$.fragment,e),r(ae.$$.fragment,e),r(me.$$.fragment,e),lt=!0)},o(e){c(T.$$.fragment,e),c(w.$$.fragment,e),c(J.$$.fragment,e),c(U.$$.fragment,e),c(C.$$.fragment,e),c(v.$$.fragment,e),c(_.$$.fragment,e),c(V.$$.fragment,e),c(E.$$.fragment,e),c(Z.$$.fragment,e),c(x.$$.fragment,e),c(X.$$.fragment,e),c(R.$$.fragment,e),c(Y.$$.fragment,e),c(N.$$.fragment,e),c(W.$$.fragment,e),c(Q.$$.fragment,e),c(L.$$.fragment,e),c(q.$$.fragment,e),c(F.$$.fragment,e),c(D.$$.fragment,e),c(O.$$.fragment,e),c(K.$$.fragment,e),c(te.$$.fragment,e),c(le.$$.fragment,e),c(se.$$.fragment,e),c(ne.$$.fragment,e),c(ae.$$.fragment,e),c(me.$$.fragment,e),lt=!1},d(e){e&&(l(ce),l(pe),l(oe),l(Me),l(ue),l(fe),l(ye),l(j),l(ge),l($e),l(b),l(he),l(de),l(I),l(Te),l(we),l(k),l(Je),l(G),l(Ue),l(h),l(je),l(d),l(Ce),l(be),l(ve),l(B),l(Ie),l(_e),l(ke),l(S),l(Ge),l(Ve),l(Ee),l(Be),l(z),l(Ze),l(xe),l(Se),l(A),l(Xe),l(Re),l(Ye),l(ze),l(H),l(Ne),l(We),l(Ae),l(P),l(Qe),l(Le),l(qe),l(ee),l(He),l(Fe),l(De),l(Pe),l(ie),l(Oe),l(Ke),l(et),l(tt),l(re)),l(g),o(T,e),o(w,e),o(J,e),o(U,e),o(C,e),o(v,e),o(_,e),o(V,e),o(E,e),o(Z,e),o(x,e),o(X,e),o(R,e),o(Y,e),o(N,e),o(W,e),o(Q,e),o(L,e),o(q,e),o(F,e),o(D,e),o(O,e),o(K,e),o(te,e),o(le,e),o(se,e),o(ne,e),o(ae,e),o(me,e)}}}const Gt='{"title":"Adding a New Metric","local":"adding-a-new-metric","sections":[{"title":"Before You Start","local":"before-you-start","sections":[{"title":"Two different types of metrics","local":"two-different-types-of-metrics","sections":[{"title":"Sample-Level Metrics","local":"sample-level-metrics","sections":[],"depth":4},{"title":"Corpus-Level Metrics","local":"corpus-level-metrics","sections":[],"depth":4}],"depth":3},{"title":"Check Existing Metrics","local":"check-existing-metrics","sections":[],"depth":3}],"depth":2},{"title":"Creating a Custom Metric","local":"creating-a-custom-metric","sections":[{"title":"Step 1: Create the Metric File","local":"step-1-create-the-metric-file","sections":[],"depth":3},{"title":"Step 2: Define the Sample-Level Metric","local":"step-2-define-the-sample-level-metric","sections":[{"title":"Single Metric Example","local":"single-metric-example","sections":[],"depth":4},{"title":"Multiple Metrics Example","local":"multiple-metrics-example","sections":[],"depth":4}],"depth":3},{"title":"Step 3: Define Aggregation Function (Optional)","local":"step-3-define-aggregation-function-optional","sections":[],"depth":3},{"title":"Step 4: Create the Metric Object","local":"step-4-create-the-metric-object","sections":[{"title":"Single Metric","local":"single-metric","sections":[],"depth":4},{"title":"Multiple Metrics","local":"multiple-metrics","sections":[],"depth":4}],"depth":3},{"title":"Step 5: Register the Metric","local":"step-5-register-the-metric","sections":[],"depth":3}],"depth":2},{"title":"Using Your Custom Metric","local":"using-your-custom-metric","sections":[{"title":"With Custom Tasks","local":"with-custom-tasks","sections":[],"depth":3}],"depth":2}],"depth":1}';function Vt(it){return Ut(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class St extends jt{constructor(g){super(),Ct(this,g,Vt,kt,wt,{})}}export{St as component};
