plano/intro/what_is_arch.html

505 lines
22 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en" data-content_root="../" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>What is Arch &#8212; Arch 0.1-beta documentation</title>
<script data-cfasync="false">
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
</script>
<!-- Loaded before other Sphinx assets -->
<link href="../_static/styles/theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/bootstrap.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/pydata-sphinx-theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/vendor/fontawesome/6.5.2/css/all.min.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-solid-900.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-brands-400.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-regular-400.woff2" />
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=a3416100" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<!-- Pre-loaded scripts that we'll load fully later -->
<link rel="preload" as="script" href="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b" />
<link rel="preload" as="script" href="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b" />
<script src="../_static/vendor/fontawesome/6.5.2/js/all.min.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/documentation_options.js?v=2742c0eb"></script>
<script src="../_static/doctools.js?v=9a2dae69"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=f281be69"></script>
<script src="../_static/scripts/sphinx-book-theme.js?v=887ef09a"></script>
<script>DOCUMENTATION_OPTIONS.pagename = 'intro/what_is_arch';</script>
<link rel="icon" href="../_static/favicon.ico"/>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Technical Architecture" href="architecture/architecture.html" />
<link rel="prev" title="Introduction" href="intro.html" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="docsearch:language" content="en"/>
</head>
<body data-bs-spy="scroll" data-bs-target=".bd-toc-nav" data-offset="180" data-bs-root-margin="0px 0px -60%" data-default-mode="">
<div id="pst-skip-link" class="skip-link d-print-none"><a href="#main-content">Skip to main content</a></div>
<div id="pst-scroll-pixel-helper"></div>
<button type="button" class="btn rounded-pill" id="pst-back-to-top">
<i class="fa-solid fa-arrow-up"></i>Back to top</button>
<input type="checkbox"
class="sidebar-toggle"
id="pst-primary-sidebar-checkbox"/>
<label class="overlay overlay-primary" for="pst-primary-sidebar-checkbox"></label>
<input type="checkbox"
class="sidebar-toggle"
id="pst-secondary-sidebar-checkbox"/>
<label class="overlay overlay-secondary" for="pst-secondary-sidebar-checkbox"></label>
<div class="search-button__wrapper">
<div class="search-button__overlay"></div>
<div class="search-button__search-container">
<form class="bd-search d-flex align-items-center"
action="../search.html"
method="get">
<i class="fa-solid fa-magnifying-glass"></i>
<input type="search"
class="form-control"
name="q"
id="search-input"
placeholder="Search..."
aria-label="Search..."
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"/>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
</form></div>
</div>
<div class="pst-async-banner-revealer d-none">
<aside id="bd-header-version-warning" class="d-none d-print-none" aria-label="Version warning"></aside>
</div>
<header class="bd-header navbar navbar-expand-lg bd-navbar d-print-none">
</header>
<div class="bd-container">
<div class="bd-container__inner bd-page-width">
<div class="bd-sidebar-primary bd-sidebar">
<div class="sidebar-header-items sidebar-primary__section">
</div>
<div class="sidebar-primary-items__start sidebar-primary__section">
<div class="sidebar-primary-item">
<a class="navbar-brand logo" href="../root.html">
<img src="../_static/arch-nav-logo.png" class="logo__image only-light" alt="Arch 0.1-beta documentation - Home"/>
<script>document.write(`<img src="../_static/arch-nav-logo.png" class="logo__image only-dark" alt="Arch 0.1-beta documentation - Home"/>`);</script>
</a></div>
<div class="sidebar-primary-item">
<script>
document.write(`
<button class="btn search-button-field search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass"></i>
<span class="search-button__default-text">Search</span>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
</button>
`);
</script></div>
<div class="sidebar-primary-item"><nav class="bd-links bd-docs-nav" aria-label="Main">
<div class="bd-toc-item navbar-nav active">
<ul class="current nav bd-sidenav">
<li class="toctree-l1 current active has-children"><a class="reference internal" href="intro.html">Introduction</a><details open="open"><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul class="current">
<li class="toctree-l2 current active"><a class="current reference internal" href="#">What is Arch</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="architecture/architecture.html">Technical Architecture</a><details><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul>
<li class="toctree-l3"><a class="reference internal" href="architecture/intro/terminology.html">Terminology</a></li>
<li class="toctree-l3"><a class="reference internal" href="architecture/intro/threading_model.html">Threading model</a></li>
<li class="toctree-l3"><a class="reference internal" href="architecture/listeners/listeners.html">Listener</a></li>
<li class="toctree-l3"><a class="reference internal" href="architecture/prompt_processing/prompt_processing.html">Prompts</a></li>
<li class="toctree-l3"><a class="reference internal" href="architecture/listeners/llm_provider.html">LLM Provider</a></li>
<li class="toctree-l3"><a class="reference internal" href="architecture/model_serving/model_serving.html">Model Serving</a></li>
</ul>
</details></li>
<li class="toctree-l2"><a class="reference internal" href="life_of_a_request.html">Life of a Request</a></li>
<li class="toctree-l2"><a class="reference internal" href="getting_help.html">Getting help</a></li>
</ul>
</details></li>
<li class="toctree-l1"><a class="reference internal" href="../getting_started/getting_started.html">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../getting_started/use_cases/rag.html">Retrieval-Augmented (RAG)</a></li>
<li class="toctree-l1"><a class="reference internal" href="../getting_started/use_cases/function_calling.html">Agentic (Text-to-Action) Apps</a></li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../observability/observability.html">Observability</a><details><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul>
<li class="toctree-l2"><a class="reference internal" href="../observability/tracing.html">Tracing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../observability/stats.html">Monitoring</a></li>
<li class="toctree-l2"><a class="reference internal" href="../observability/access_logs.html">Access Logging</a></li>
</ul>
</details></li>
<li class="toctree-l1"><a class="reference internal" href="../llms/llms.html">LLMs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../configuration_reference.html">Configuration Reference</a></li>
</ul>
</div>
</nav></div>
</div>
<div class="sidebar-primary-items__end sidebar-primary__section">
</div>
<div id="rtd-footer-container"></div>
</div>
<main id="main-content" class="bd-main" role="main">
<div class="sbt-scroll-pixel-helper"></div>
<div class="bd-content">
<div class="bd-article-container">
<div class="bd-header-article d-print-none">
<div class="header-article-items header-article__inner">
<div class="header-article-items__start">
<div class="header-article-item"><button class="sidebar-toggle primary-toggle btn btn-sm" title="Toggle primary sidebar" data-bs-placement="bottom" data-bs-toggle="tooltip">
<span class="fa-solid fa-bars"></span>
</button></div>
</div>
<div class="header-article-items__end">
<div class="header-article-item">
<div class="article-header-buttons">
<div class="dropdown dropdown-download-buttons">
<button class="btn dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Download this page">
<i class="fas fa-download"></i>
</button>
<ul class="dropdown-menu">
<li><a href="../_sources/intro/what_is_arch.rst" target="_blank"
class="btn btn-sm btn-download-source-button dropdown-item"
title="Download source file"
data-bs-placement="left" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-file"></i>
</span>
<span class="btn__text-container">.rst</span>
</a>
</li>
<li>
<button onclick="window.print()"
class="btn btn-sm btn-download-pdf-button dropdown-item"
title="Print to PDF"
data-bs-placement="left" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-file-pdf"></i>
</span>
<span class="btn__text-container">.pdf</span>
</button>
</li>
</ul>
</div>
<button onclick="toggleFullScreen()"
class="btn btn-sm btn-fullscreen-button"
title="Fullscreen mode"
data-bs-placement="bottom" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-expand"></i>
</span>
</button>
<script>
document.write(`
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light"></i>
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark"></i>
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto"></i>
</button>
`);
</script>
<script>
document.write(`
<button class="btn btn-sm pst-navbar-icon search-button search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass fa-lg"></i>
</button>
`);
</script>
</div></div>
</div>
</div>
</div>
<div id="jb-print-docs-body" class="onlyprint">
<h1>What is Arch</h1>
<!-- Table of contents -->
<div id="print-main-content">
<div id="jb-print-toc">
</div>
</div>
</div>
<div id="searchbox"></div>
<article class="bd-article">
<section id="what-is-arch">
<h1>What is Arch<a class="headerlink" href="#what-is-arch" title="Link to this heading">#</a></h1>
<p>Arch is an intelligent <a class="reference external" href="https://www.cloudflare.com/learning/ddos/what-is-layer-7/">(Layer 7)</a> gateway
designed for generative AI apps, AI agents, and Co-pilots that work with prompts. Engineered with purpose-built
<a class="reference internal" href="../llms/llms.html#llms-in-arch"><span class="std std-ref">LLMs</span></a>, Arch handles all the critical but undifferentiated tasks related to the handling and
processing of prompts, including detecting and rejecting <a class="reference external" href="https://github.com/verazuo/jailbreak_llms">jailbreak</a>
attempts, intelligently calling “backend” APIs to fulfill the users request represented in a prompt, routing to
and offering disaster recovery between upstream LLMs, and managing the observability of prompts and LLM interactions
in a centralized way.</p>
<a class="reference internal image-reference" href="../_images/arch-logo.png"><img alt="../_images/arch-logo.png" class="align-center" src="../_images/arch-logo.png" style="width: 100%;" />
</a>
<p><strong>The project was born out of the belief that:</strong></p>
<blockquote>
<div><p><em>Prompts are nuanced and opaque user requests, which require the same capabilities as traditional HTTP requests
including secure handling, intelligent routing, robust observability, and integration with backend (API)
systems for personalization - all outside business logic.</em></p>
</div></blockquote>
<p>In practice, achieving the above goal is incredibly difficult. Arch attempts to do so by providing the
following high level features:</p>
<hr class="docutils" />
<p><strong>Out-of-process architecture, built on</strong> <a class="reference external" href="http://envoyproxy.io/">Envoy</a>: Arch is takes a dependency on
Envoy and is a self-contained process that is designed to run alongside your application servers. Arch uses
Envoys HTTP connection management subsystem, HTTP L7 filtering and telemetry capabilities to extend the
functionality exclusively for prompts and LLMs. This gives Arch several advantages:</p>
<ul class="simple">
<li><p>Arch builds on Envoys proven success. Envoy is used at masssive sacle by the leading technology companies of
our time including <a class="reference external" href="https://www.airbnb.com">AirBnB</a>, <a class="reference external" href="https://www.dropbox.com">Dropbox</a>,
<a class="reference external" href="https://www.google.com">Google</a>, <a class="reference external" href="https://www.reddit.com">Reddit</a>, <a class="reference external" href="https://www.stripe.com">Stripe</a>,
etc. Its battle tested and scales linearly with usage and enables developers to focus on what really matters:
application features and business logic.</p></li>
<li><p>Arch works with any application language. A single Arch deployment can act as gateway for AI applications
written in Python, Java, C++, Go, Php, etc.</p></li>
<li><p>Arch can be deployed and upgraded quickly across your infrastructure transparently without the horrid pain
of deploying library upgrades in your applications.</p></li>
</ul>
<p><strong>Engineered with Fast LLMs:</strong> Arch is engineered with specialized (sub-billion) LLMs that are desgined for
fast, cost-effective and acurrate handling of prompts. These <a class="reference internal" href="../llms/llms.html#llms-in-arch"><span class="std std-ref">LLMs</span></a> are designed to be
best-in-class for critcal prompt-related tasks like:</p>
<ul class="simple">
<li><p><strong>Function/API Calling:</strong> Arch helps you easily personalize your applications by enabling calls to
application-specific (API) operations via user prompts. This involves any predefined functions or APIs
you want to expose to users to perform tasks, gather information, or manipulate data. With function calling,
you have flexibility to support “agentic” experiences tailored to specific use cases - from updating insurance
claims to creating ad campaigns - via prompts. Arch analyzes prompts, extracts critical information from
prompts, engages in lightweight conversation to gather any missing parameters and makes API calls so that you can
focus on writing business logic. For more details, read <a class="reference internal" href="architecture/prompt_processing/prompt_processing.html#arch-overview-prompt-handling"><span class="std std-ref">prompt processing</span></a>.</p></li>
<li><p><strong>Prompt Guardrails:</strong> Arch helps you improve the safety of your application by applying prompt guardrails in
a centralized way for better governance hygiene. With prompt guardrails you can prevent <a class="reference external" href="https://github.com/verazuo/jailbreak_llms">jailbreak</a>
attempts or toxicity present in users prompts without having to write a single line of code. To learn more
about how to configure guardrails available in Arch, read <a class="reference internal" href="architecture/prompt_processing/prompt_processing.html#arch-overview-prompt-handling"><span class="std std-ref">prompt processing</span></a>.</p></li>
<li><p><strong>Intent-Drift Detection:</strong> Developers struggle to handle <a class="reference external" href="https://www.reddit.com/r/ChatGPTPromptGenius/comments/17dzmpy/how_to_use_rag_with_conversation_history_for/?">follow-up</a>,
or <a class="reference external" href="https://www.reddit.com/r/LocalLLaMA/comments/18mqwg6/best_practice_for_rag_with_followup_chat/">clarifying</a>
questions. Specifically, when users ask for modifications or additions to previous responses their AI applications
often generate entirely new responses instead of adjusting the previous ones. Arch offers intent-drift detection as a
feature so that developers know when the user has shifted away from the previous intent so that they can improve
their retrieval, lower overall token cost and dramatically improve the speed and accuracy of their responses back
to users.</p></li>
</ul>
<p><strong>Traffic Management:</strong> Arch offers several capabilities for LLM calls originating from your applications, including a
vendor-agnostic SDK to make LLM calls, smart retries on errors from upstream LLMs, and automatic cutover to other LLMs
configured in Arch for continuous availability and disaster recovery scenarios. Arch extends Envoys <a class="reference external" href="https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/cluster_manager">cluster subsystem</a> to manage upstream connections
to LLMs so that you can build resilient AI applications.</p>
<p><strong>Front/edge Gateway:</strong> There is substantial benefit in using the same software at the edge (observability,
traffic shaping alogirithms, applying guardrails, etc.) as for outbound LLM inference use cases. Arch has the feature set
that makes it exceptionally well suited as an edge gateway for AI applications. This includes TLS termination, rate limiting,
and prompt-based routing.</p>
<p><strong>Best-In Class Monitoring:</strong> Arch offers several monitoring metrics that help you understand three
critical aspects of your application: latency, token usage, and error rates by an upstream LLM provider. Latency
measures the speed at which your application is responding to users, which includes metrics like time to first
token (TFT), time per output token (TOT) metrics, and the total latency as perceived by users.</p>
<p><strong>End-to-End Tracing:</strong> Arch propagates trace context using the W3C Trace Context standard, specifically through
the <code class="docutils literal notranslate"><span class="pre">traceparent</span></code> header. This allows each component in the system to record its part of the request flow,
enabling <strong>end-to-end tracing</strong> across the entire application. By using OpenTelemetry, Arch ensures that
developers can capture this trace data consistently and in a format compatible with various observability tools.
For more details, read <a class="reference internal" href="../observability/tracing.html#arch-overview-tracing"><span class="std std-ref">tracing</span></a>.</p>
</section>
</article>
<footer class="prev-next-footer d-print-none">
<div class="prev-next-area">
<a class="left-prev"
href="intro.html"
title="previous page">
<i class="fa-solid fa-angle-left"></i>
<div class="prev-next-info">
<p class="prev-next-subtitle">previous</p>
<p class="prev-next-title">Introduction</p>
</div>
</a>
<a class="right-next"
href="architecture/architecture.html"
title="next page">
<div class="prev-next-info">
<p class="prev-next-subtitle">next</p>
<p class="prev-next-title">Technical Architecture</p>
</div>
<i class="fa-solid fa-angle-right"></i>
</a>
</div>
</footer>
</div>
</div>
<footer class="bd-footer-content">
<div class="bd-footer-content__inner container">
<div class="footer-item">
<p class="component-author">
By Katanemo Labs, Inc
</p>
</div>
<div class="footer-item">
<p class="copyright">
© Copyright 2024, Katanemo Labs, Inc.
<br/>
</p>
</div>
<div class="footer-item">
</div>
<div class="footer-item">
</div>
</div>
</footer>
</main>
</div>
</div>
<!-- Scripts loaded after <body> so the DOM is not blocked -->
<script src="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b"></script>
<footer class="bd-footer">
</footer>
</body>
</html>