Skip to content

Commit

Permalink
deploy: 11fba23
Browse files Browse the repository at this point in the history
  • Loading branch information
salmanap committed Oct 11, 2024
1 parent 1075c1f commit ebe1cbd
Show file tree
Hide file tree
Showing 14 changed files with 132 additions and 176 deletions.
82 changes: 41 additions & 41 deletions build_with_arch/agent.html

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions build_with_arch/rag.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
Retrieval-Augmented Generation (RAG) applications.</p>
<section id="parameter-extraction-for-rag">
<h2>Parameter Extraction for RAG<a @click.prevent="window.navigator.clipboard.writeText($el.href); $el.setAttribute('data-tooltip', 'Copied!'); setTimeout(() =&gt; $el.setAttribute('data-tooltip', 'Copy link to this element'), 2000)" aria-label="Copy link to this element" class="headerlink" data-tooltip="Copy link to this element" href="#parameter-extraction-for-rag" x-intersect.margin.0%.0%.-70%.0%="activeSection = '#parameter-extraction-for-rag'"><svg height="1em" viewbox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"></path></svg></a></h2>
<p>To build RAG (Retrieval-Augmented Generation) applications, you can configure prompt targets with parameters,
<p>To build RAG (Retrieval Augmented Generation) applications, you can configure prompt targets with parameters,
enabling Arch to retrieve critical information in a structured way for processing. This approach improves the
retrieval quality and speed of your application. By extracting parameters from the conversation, you can pull
the appropriate chunks from a vector database or SQL-like data store to enhance accuracy. With Arch, you can
Expand Down Expand Up @@ -243,11 +243,11 @@ <h3>Step 2: Process Request Parameters in Flask<a @click.prevent="window.navigat
<h2>[Coming Soon] <a class="reference external" href="https://github.com/orgs/katanemo/projects/1/views/1?pane=issue&amp;itemId=82697909" rel="nofollow noopener">Drift Detection via Arch Intent-Markers<svg fill="currentColor" height="1em" stroke="none" viewbox="0 96 960 960" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M188 868q-11-11-11-28t11-28l436-436H400q-17 0-28.5-11.5T360 336q0-17 11.5-28.5T400 296h320q17 0 28.5 11.5T760 336v320q0 17-11.5 28.5T720 696q-17 0-28.5-11.5T680 656V432L244 868q-11 11-28 11t-28-11Z"></path></svg></a><a @click.prevent="window.navigator.clipboard.writeText($el.href); $el.setAttribute('data-tooltip', 'Copied!'); setTimeout(() =&gt; $el.setAttribute('data-tooltip', 'Copy link to this element'), 2000)" aria-label="Copy link to this element" class="headerlink" data-tooltip="Copy link to this element" href="#coming-soon-drift-detection-via-arch-intent-markers" x-intersect.margin.0%.0%.-70%.0%="activeSection = '#coming-soon-drift-detection-via-arch-intent-markers'"><svg height="1em" viewbox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"></path></svg></a></h2>
<p>Developers struggle to efficiently handle <code class="docutils literal notranslate"><span class="pre">follow-up</span></code> or <code class="docutils literal notranslate"><span class="pre">clarification</span></code> questions. Specifically, when users ask for
changes or additions to previous responses their AI applications often generate entirely new responses instead of adjusting
previous ones.Arch offers <strong>intent</strong> tracking as a feature so that developers can know when the user has shifted away from a
previous ones. Arch offers <code class="docutils literal notranslate"><span class="pre">intent</span> <span class="pre">tracking</span></code> as a feature so that developers can know when the user has shifted away from a
previous intent so that they can dramatically improve retrieval accuracy, lower overall token cost and improve the speed of
their responses back to users.</p>
<p>Arch uses its built-in lightweight NLI and embedding models to know if the user has steered away from an active intent.
Arch’s intent-drift detection mechanism is based on its <a class="reference internal" href="../concepts/prompt_target.html#prompt-target"><span class="std std-ref">prompt_targets</span></a> primtive. Arch tries to match an incoming
Arch’s intent-drift detection mechanism is based on its <a class="reference internal" href="../concepts/prompt_target.html#prompt-target"><span class="std std-ref">prompt target</span></a> primtive. Arch tries to match an incoming
prompt to one of the prompt_targets configured in the gateway. Once it detects that the user has moved away from an active
active intent, Arch adds the <code class="docutils literal notranslate"><span class="pre">x-arch-intent-marker</span></code> headers to the request before sending it your application servers.</p>
<div class="literal-block-wrapper docutils container" id="id3">
Expand Down Expand Up @@ -276,8 +276,8 @@ <h2>[Coming Soon] <a class="reference external" href="https://github.com/orgs/ka
</mark></span><span id="line-22"><mark><span class="linenos">22</span> <span class="k">return</span> <span class="p">(</span>
</mark></span><span id="line-23"><mark><span class="linenos">23</span> <span class="n">jsonify</span><span class="p">({</span><span class="s2">"error"</span><span class="p">:</span> <span class="s2">"Invalid value for x-arch-prompt-intent-change header"</span><span class="p">}),</span>
</mark></span><span id="line-24"><mark><span class="linenos">24</span> <span class="mi">400</span><span class="p">,</span>
</mark></span><span id="line-25"><span class="linenos">25</span> <span class="p">)</span>
</span><span id="line-26"><span class="linenos">26</span>
</mark></span><span id="line-25"><mark><span class="linenos">25</span> <span class="p">)</span>
</mark></span><span id="line-26"><span class="linenos">26</span>
</span><span id="line-27"><span class="linenos">27</span> <span class="c1"># Update user conversation based on intent change</span>
</span><span id="line-28"><span class="linenos">28</span> <span class="n">memory</span> <span class="o">=</span> <span class="n">update_user_conversation</span><span class="p">(</span><span class="n">user_id</span><span class="p">,</span> <span class="n">client_messages</span><span class="p">,</span> <span class="n">intent_changed</span><span class="p">)</span>
</span><span id="line-29"><span class="linenos">29</span>
Expand Down Expand Up @@ -315,8 +315,8 @@ <h2>[Coming Soon] <a class="reference external" href="https://github.com/orgs/ka
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Arch is (mostly) stateless so that it can scale in an embarrassingly parrallel fashion. So, while Arch offers
intent-drift detetction, you still have to maintain converational state with intent drift as meta-data. The
following code snippets show how easily you can build and enrich conversational history with Langchain (in python),
intent-drift detetction, you still have to maintain converational state with intent drift as metadata. The
following code snippets show how easily you can build and enrich conversational history with Langchain (in Python),
so that you can use the most relevant prompts for your retrieval and for prompting upstream LLMs.</p>
</div>
<section id="step-1-define-conversationbuffermemory">
Expand Down
4 changes: 2 additions & 2 deletions concepts/llm_provider.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
<p class="admonition-title">Note</p>
<p>When you start Arch, it creates a listener port for egress traffic based on the presence of <code class="docutils literal notranslate"><span class="pre">llm_providers</span></code>
configuration section in the <code class="docutils literal notranslate"><span class="pre">arch_config.yml</span></code> file. Arch binds itself to a local address such as
<code class="docutils literal notranslate"><span class="pre">127.0.0.1:51001/v1</span></code>.</p>
<code class="docutils literal notranslate"><span class="pre">127.0.0.1:12000</span></code>.</p>
</div>
<p>Arch also offers vendor-agnostic SDKs and libraries to make LLM calls to API-based LLM providers (like OpenAI,
Anthropic, Mistral, Cohere, etc.) and supports calls to OSS LLMs that are hosted on your infrastructure. Arch
Expand All @@ -201,7 +201,7 @@ <h2>Example: Using the OpenAI Python SDK<a @click.prevent="window.navigator.clip
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><code><span id="line-1"><span class="kn">from</span> <span class="nn">openai</span> <span class="kn">import</span> <span class="n">OpenAI</span>
</span><span id="line-2">
</span><span id="line-3"><span class="c1"># Initialize the Arch client</span>
</span><span id="line-4"><span class="n">client</span> <span class="o">=</span> <span class="n">OpenAI</span><span class="p">(</span><span class="n">base_url</span><span class="o">=</span><span class="s2">"http://127.0.0.1:51001/v1"</span><span class="p">)</span>
</span><span id="line-4"><span class="n">client</span> <span class="o">=</span> <span class="n">OpenAI</span><span class="p">(</span><span class="n">base_url</span><span class="o">=</span><span class="s2">"http://127.0.0.12000/"</span><span class="p">)</span>
</span><span id="line-5">
</span><span id="line-6"><span class="c1"># Define your LLM provider and prompt</span>
</span><span id="line-7"><span class="n">llm_provider</span> <span class="o">=</span> <span class="s2">"openai"</span>
Expand Down
32 changes: 16 additions & 16 deletions concepts/prompt_target.html
Original file line number Diff line number Diff line change
Expand Up @@ -254,22 +254,22 @@ <h3>Defining Parameters<a @click.prevent="window.navigator.clipboard.writeText($
</section>
<section id="example-configuration">
<h3>Example Configuration<a @click.prevent="window.navigator.clipboard.writeText($el.href); $el.setAttribute('data-tooltip', 'Copied!'); setTimeout(() =&gt; $el.setAttribute('data-tooltip', 'Copy link to this element'), 2000)" aria-label="Copy link to this element" class="headerlink" data-tooltip="Copy link to this element" href="#example-configuration" x-intersect.margin.0%.0%.-70%.0%="activeSection = '#example-configuration'"><svg height="1em" viewbox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"></path></svg></a></h3>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><code><span id="line-1"><span class="n">prompt_targets</span><span class="p">:</span>
</span><span id="line-2"> <span class="o">-</span> <span class="n">name</span><span class="p">:</span> <span class="n">get_weather</span>
</span><span id="line-3"> <span class="n">description</span><span class="p">:</span> <span class="n">Get</span> <span class="n">the</span> <span class="n">current</span> <span class="n">weather</span> <span class="k">for</span> <span class="n">a</span> <span class="n">location</span>
</span><span id="line-4"> <span class="n">parameters</span><span class="p">:</span>
</span><span id="line-5"> <span class="o">-</span> <span class="n">name</span><span class="p">:</span> <span class="n">location</span>
</span><span id="line-6"> <span class="n">description</span><span class="p">:</span> <span class="n">The</span> <span class="n">city</span> <span class="ow">and</span> <span class="n">state</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">g</span><span class="o">.</span> <span class="n">San</span> <span class="n">Francisco</span><span class="p">,</span> <span class="n">New</span> <span class="n">York</span>
</span><span id="line-7"> <span class="nb">type</span><span class="p">:</span> <span class="nb">str</span>
</span><span id="line-8"> <span class="n">required</span><span class="p">:</span> <span class="n">true</span>
</span><span id="line-9"> <span class="o">-</span> <span class="n">name</span><span class="p">:</span> <span class="n">unit</span>
</span><span id="line-10"> <span class="n">description</span><span class="p">:</span> <span class="n">The</span> <span class="n">unit</span> <span class="n">of</span> <span class="n">temperature</span>
</span><span id="line-11"> <span class="nb">type</span><span class="p">:</span> <span class="nb">str</span>
</span><span id="line-12"> <span class="n">default</span><span class="p">:</span> <span class="n">fahrenheit</span>
</span><span id="line-13"> <span class="n">enum</span><span class="p">:</span> <span class="p">[</span><span class="n">celsius</span><span class="p">,</span> <span class="n">fahrenheit</span><span class="p">]</span>
</span><span id="line-14"> <span class="n">endpoint</span><span class="p">:</span>
</span><span id="line-15"> <span class="n">name</span><span class="p">:</span> <span class="n">api_server</span>
</span><span id="line-16"> <span class="n">path</span><span class="p">:</span> <span class="o">/</span><span class="n">weather</span>
<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><code><span id="line-1"><span class="nt">prompt_targets</span><span class="p">:</span>
</span><span id="line-2"><span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">get_weather</span>
</span><span id="line-3"><span class="w"> </span><span class="nt">description</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Get the current weather for a location</span>
</span><span id="line-4"><span class="w"> </span><span class="nt">parameters</span><span class="p">:</span>
</span><span id="line-5"><span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">location</span>
</span><span id="line-6"><span class="w"> </span><span class="nt">description</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">The city and state, e.g. San Francisco, New York</span>
</span><span id="line-7"><span class="w"> </span><span class="nt">type</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">str</span>
</span><span id="line-8"><span class="w"> </span><span class="nt">required</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span>
</span><span id="line-9"><span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">unit</span>
</span><span id="line-10"><span class="w"> </span><span class="nt">description</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">The unit of temperature</span>
</span><span id="line-11"><span class="w"> </span><span class="nt">type</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">str</span>
</span><span id="line-12"><span class="w"> </span><span class="nt">default</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">fahrenheit</span>
</span><span id="line-13"><span class="w"> </span><span class="nt">enum</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">[</span><span class="nv">celsius</span><span class="p p-Indicator">,</span><span class="w"> </span><span class="nv">fahrenheit</span><span class="p p-Indicator">]</span>
</span><span id="line-14"><span class="w"> </span><span class="nt">endpoint</span><span class="p">:</span>
</span><span id="line-15"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">api_server</span>
</span><span id="line-16"><span class="w"> </span><span class="nt">path</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">/weather</span>
</span></code></pre></div>
</div>
</section>
Expand Down
1 change: 0 additions & 1 deletion concepts/tech_overview/error_target.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ <h2>Key Concepts<a @click.prevent="window.navigator.clipboard.writeText($el.href
<ul class="simple">
<li><p><strong>Error Type</strong>: Categorizes the nature of the error, such as “ValidationError” or “RuntimeError.” These error types help in identifying what kind of issue occurred and provide context for troubleshooting.</p></li>
<li><p><strong>Error Message</strong>: A clear, human-readable message describing the error. This should provide enough detail to inform users or developers of the root cause or required action.</p></li>
<li><p><strong>Target Prompt</strong>: The specific prompt or operation where the error occurred. Understanding where the error happened helps with debugging and pinpointing the source of the problem.</p></li>
<li><p><strong>Parameter-Specific Errors</strong>: Errors that arise due to invalid or missing parameters when invoking a function. These errors are critical for ensuring the correctness of inputs.</p></li>
</ul>
</section>
Expand Down
Loading

0 comments on commit ebe1cbd

Please sign in to comment.