Skip to content

Commit

Permalink
Built site for gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarto GHA Workflow Runner committed Sep 23, 2024
1 parent e73a825 commit 7f82a76
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .nojekyll
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d590a894
ac982cde
16 changes: 8 additions & 8 deletions reference/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,35 +156,35 @@ <h1 class="title">mall</h1>
</thead>
<tbody>
<tr class="odd">
<td><a href="../reference/llm_classify.html">llm_classify() | llm_vec_classify()</a></td>
<td><a href="reference/llm_classify.html">llm_classify() | llm_vec_classify()</a></td>
<td>Categorize data as one of options given</td>
</tr>
<tr class="even">
<td><a href="../reference/llm_custom.html">llm_custom() | llm_vec_custom()</a></td>
<td><a href="reference/llm_custom.html">llm_custom() | llm_vec_custom()</a></td>
<td>Send a custom prompt to the LLM</td>
</tr>
<tr class="odd">
<td><a href="../reference/llm_extract.html">llm_extract() | llm_vec_extract()</a></td>
<td><a href="reference/llm_extract.html">llm_extract() | llm_vec_extract()</a></td>
<td>Extract entities from text</td>
</tr>
<tr class="even">
<td><a href="../reference/llm_sentiment.html">llm_sentiment() | llm_vec_sentiment()</a></td>
<td><a href="reference/llm_sentiment.html">llm_sentiment() | llm_vec_sentiment()</a></td>
<td>Sentiment analysis</td>
</tr>
<tr class="odd">
<td><a href="../reference/llm_summarize.html">llm_summarize() | llm_vec_summarize()</a></td>
<td><a href="reference/llm_summarize.html">llm_summarize() | llm_vec_summarize()</a></td>
<td>Summarize text</td>
</tr>
<tr class="even">
<td><a href="../reference/llm_translate.html">llm_translate() | llm_vec_translate()</a></td>
<td><a href="reference/llm_translate.html">llm_translate() | llm_vec_translate()</a></td>
<td>Translates text to a specific language</td>
</tr>
<tr class="odd">
<td><a href="../reference/llm_use.html">llm_use()</a></td>
<td><a href="reference/llm_use.html">llm_use()</a></td>
<td>Specify the model to use</td>
</tr>
<tr class="even">
<td><a href="../reference/m_backend_submit.html">m_backend_prompt() | m_backend_submit()</a></td>
<td><a href="reference/m_backend_submit.html">m_backend_prompt() | m_backend_submit()</a></td>
<td>Functions to integrate different back-ends</td>
</tr>
</tbody>
Expand Down
63 changes: 63 additions & 0 deletions reference/llm_classify.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ <h2 id="toc-title">On this page</h2>
<li><a href="#usage" id="toc-usage" class="nav-link" data-scroll-target="#usage">Usage</a></li>
<li><a href="#arguments" id="toc-arguments" class="nav-link" data-scroll-target="#arguments">Arguments</a></li>
<li><a href="#value" id="toc-value" class="nav-link" data-scroll-target="#value">Value</a></li>
<li><a href="#examples" id="toc-examples" class="nav-link" data-scroll-target="#examples">Examples</a></li>
</ul>
</nav>
</div>
Expand Down Expand Up @@ -254,6 +255,68 @@ <h2 class="anchored" data-anchor-id="arguments">Arguments</h2>
<section id="value" class="level2">
<h2 class="anchored" data-anchor-id="value">Value</h2>
<p><code>llm_classify</code> returns a <code>data.frame</code> or <code>tbl</code> object. <code>llm_vec_classify</code> returns a vector that is the same length as <code>x</code>.</p>
</section>
<section id="examples" class="level2">
<h2 class="anchored" data-anchor-id="examples">Examples</h2>
<div class="cell">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(mall) </span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a><span class="fu">llm_use</span>(<span class="st">"ollama"</span>, <span class="st">"llama3.1"</span>, <span class="at">seed =</span> <span class="dv">100</span>, <span class="at">.silent =</span> <span class="cn">TRUE</span>) </span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a>reviews <span class="ot">&lt;-</span> <span class="fu">data.frame</span>(<span class="at">review =</span> <span class="fu">c</span>( </span>
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a> <span class="st">"This has been the best TV I've ever used. Great screen, and sound."</span>, </span>
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a> <span class="st">"I regret buying this laptop. It is too slow and the keyboard is too noisy"</span>, </span>
<span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a> <span class="st">"Not sure how to feel about my new washing machine. Great color, but hard to figure"</span> </span>
<span id="cb2-10"><a href="#cb2-10" aria-hidden="true" tabindex="-1"></a>)) </span>
<span id="cb2-11"><a href="#cb2-11" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb2-12"><a href="#cb2-12" aria-hidden="true" tabindex="-1"></a><span class="fu">llm_classify</span>(reviews, review, <span class="fu">c</span>(<span class="st">"appliance"</span>, <span class="st">"computer"</span>)) </span>
<span id="cb2-13"><a href="#cb2-13" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; # A tibble: 3 × 2</span></span>
<span id="cb2-14"><a href="#cb2-14" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; review .classify</span></span>
<span id="cb2-15"><a href="#cb2-15" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; &lt;chr&gt; &lt;chr&gt; </span></span>
<span id="cb2-16"><a href="#cb2-16" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; 1 This has been the best TV I've ever use… appliance</span></span>
<span id="cb2-17"><a href="#cb2-17" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; 2 I regret buying this laptop. It is too … computer </span></span>
<span id="cb2-18"><a href="#cb2-18" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; 3 Not sure how to feel about my new washi… appliance</span></span>
<span id="cb2-19"><a href="#cb2-19" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb2-20"><a href="#cb2-20" aria-hidden="true" tabindex="-1"></a><span class="co"># Use 'pred_name' to customize the new column's name </span></span>
<span id="cb2-21"><a href="#cb2-21" aria-hidden="true" tabindex="-1"></a><span class="fu">llm_classify</span>( </span>
<span id="cb2-22"><a href="#cb2-22" aria-hidden="true" tabindex="-1"></a> reviews, </span>
<span id="cb2-23"><a href="#cb2-23" aria-hidden="true" tabindex="-1"></a> review, </span>
<span id="cb2-24"><a href="#cb2-24" aria-hidden="true" tabindex="-1"></a> <span class="fu">c</span>(<span class="st">"appliance"</span>, <span class="st">"computer"</span>), </span>
<span id="cb2-25"><a href="#cb2-25" aria-hidden="true" tabindex="-1"></a> <span class="at">pred_name =</span> <span class="st">"prod_type"</span> </span>
<span id="cb2-26"><a href="#cb2-26" aria-hidden="true" tabindex="-1"></a> ) </span>
<span id="cb2-27"><a href="#cb2-27" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; # A tibble: 3 × 2</span></span>
<span id="cb2-28"><a href="#cb2-28" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; review prod_type</span></span>
<span id="cb2-29"><a href="#cb2-29" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; &lt;chr&gt; &lt;chr&gt; </span></span>
<span id="cb2-30"><a href="#cb2-30" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; 1 This has been the best TV I've ever use… appliance</span></span>
<span id="cb2-31"><a href="#cb2-31" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; 2 I regret buying this laptop. It is too … computer </span></span>
<span id="cb2-32"><a href="#cb2-32" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; 3 Not sure how to feel about my new washi… appliance</span></span>
<span id="cb2-33"><a href="#cb2-33" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb2-34"><a href="#cb2-34" aria-hidden="true" tabindex="-1"></a><span class="co"># Pass custom values for each classification </span></span>
<span id="cb2-35"><a href="#cb2-35" aria-hidden="true" tabindex="-1"></a><span class="fu">llm_classify</span>(reviews, review, <span class="fu">c</span>(<span class="st">"appliance"</span> <span class="sc">~</span> <span class="dv">1</span>, <span class="st">"computer"</span> <span class="sc">~</span> <span class="dv">2</span>)) </span>
<span id="cb2-36"><a href="#cb2-36" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; # A tibble: 3 × 2</span></span>
<span id="cb2-37"><a href="#cb2-37" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; review .classify</span></span>
<span id="cb2-38"><a href="#cb2-38" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; &lt;chr&gt; &lt;dbl&gt;</span></span>
<span id="cb2-39"><a href="#cb2-39" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; 1 This has been the best TV I've ever use… 1</span></span>
<span id="cb2-40"><a href="#cb2-40" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; 2 I regret buying this laptop. It is too … 2</span></span>
<span id="cb2-41"><a href="#cb2-41" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; 3 Not sure how to feel about my new washi… 1</span></span>
<span id="cb2-42"><a href="#cb2-42" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb2-43"><a href="#cb2-43" aria-hidden="true" tabindex="-1"></a><span class="co"># For character vectors, instead of a data frame, use this function </span></span>
<span id="cb2-44"><a href="#cb2-44" aria-hidden="true" tabindex="-1"></a><span class="fu">llm_vec_classify</span>( </span>
<span id="cb2-45"><a href="#cb2-45" aria-hidden="true" tabindex="-1"></a> <span class="fu">c</span>(<span class="st">"this is important!"</span>, <span class="st">"just whenever"</span>), </span>
<span id="cb2-46"><a href="#cb2-46" aria-hidden="true" tabindex="-1"></a> <span class="fu">c</span>(<span class="st">"urgent"</span>, <span class="st">"not urgent"</span>) </span>
<span id="cb2-47"><a href="#cb2-47" aria-hidden="true" tabindex="-1"></a> ) </span>
<span id="cb2-48"><a href="#cb2-48" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; [1] "urgent" "not urgent"</span></span>
<span id="cb2-49"><a href="#cb2-49" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb2-50"><a href="#cb2-50" aria-hidden="true" tabindex="-1"></a><span class="co">#' # For character vectors, instead of a data frame, use this function </span></span>
<span id="cb2-51"><a href="#cb2-51" aria-hidden="true" tabindex="-1"></a><span class="fu">llm_vec_classify</span>( </span>
<span id="cb2-52"><a href="#cb2-52" aria-hidden="true" tabindex="-1"></a> <span class="fu">c</span>(<span class="st">"this is important!"</span>, <span class="st">"just whenever"</span>), </span>
<span id="cb2-53"><a href="#cb2-53" aria-hidden="true" tabindex="-1"></a> <span class="fu">c</span>(<span class="st">"urgent"</span>, <span class="st">"not urgent"</span>), </span>
<span id="cb2-54"><a href="#cb2-54" aria-hidden="true" tabindex="-1"></a> <span class="at">preview =</span> <span class="cn">TRUE</span> </span>
<span id="cb2-55"><a href="#cb2-55" aria-hidden="true" tabindex="-1"></a> ) </span>
<span id="cb2-56"><a href="#cb2-56" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; ollamar::chat(messages = list(list(role = "user", content = "You are a helpful classification engine. Determine if the text refers to one of the following: urgent, not urgent. No capitalization. No explanations. The answer is based on the following text:\nthis is important!")), </span></span>
<span id="cb2-57"><a href="#cb2-57" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; output = "text", model = "llama3.1", seed = 100)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>


</section>
Expand Down
Loading

0 comments on commit 7f82a76

Please sign in to comment.