Archは、AIエージェントをAPIで保護、観察、およびパーソナライズするように設計されたインテリジェントレイヤー7分散プロキシです。
専用のLLMSを使用して設計されたArchは、脱獄の試みの検出と拒否、「バックエンド」APIの検出と拒否など、プロンプトの取り扱いと処理、インテリジェントなユーザーのリクエストを満たすためにインテリジェントに呼び出すことに関連する重要ではあるが未分化のタスクを処理します。
Archは、次の信念を持ってEnvoy Proxyに基づいて構築されています(および)
プロンプトは微妙で不透明なユーザーリクエストがあります。これには、セキュアハンドリング、インテリジェントルーティング、堅牢な観測可能性、パーソナライズのためのバックエンド(API)システムとの統合など、従来のHTTP要求と同じ機能が必要です。
コア機能:
ドキュメントにジャンプして、 Archを使用してGenaiアプリの速度、セキュリティ、パーソナライズを改善する方法を学びます。
重要
今日、エージェントおよびRAGシナリオ向けに設計されたLLM(Arch-Function)を呼び出す関数は、米国中心の地域で無料でホストされています。一貫したレイテンシとスループットを提供し、費用を管理するために、開発者キーを介してホストバージョンへのアクセスをすぐに可能にし、そのLLMをローカルに実行するオプションを提供します。詳細については、この問題#258を参照してください
私たちと連絡するために、Discordサーバーに参加してください。私たちはその積極的に監視し、そこでサポートを提供します。
このガイドに従って、アーチをすばやくセットアップし、生成AIアプリケーションに統合する方法を学びます。
開始する前に、次のことを確認してください。
Docker
& Python
がシステムにインストールされていますAPI Keys
(外部LLMを使用する場合)ArchのCLIを使用すると、Arch Gatewayを効率的に管理および対話できます。 CLIをインストールするには、次のコマンドを実行するだけです。ヒント:開発者は、ARCHをインストールする前に依存関係を分離する新しいPython仮想環境を作成することをお勧めします。これにより、Archgwとその依存関係がシステム上の他のパッケージに干渉しないようにします。
さらに進む前に、次のユーティリティがインストールされていることを確認してください。
$ python -m venv venv
$ source venv/bin/activate # On Windows, use: venvScriptsactivate
$ pip install archgw
ARCHは、LLMプロバイダー、プロンプトのターゲット、GuardRailsなどを定義できる構成ファイルに基づいて動作します。以下は、開始するための例の構成の例です。
version : v0.1
listener :
address : 127.0.0.1
port : 8080 # If you configure port 443, you'll need to update the listener with tls_certificates
message_format : huggingface
# Centralized way to manage LLMs, manage keys, retry logic, failover and limits in a central way
llm_providers :
- name : OpenAI
provider : openai
access_key : $OPENAI_API_KEY
model : gpt-3.5-turbo
default : true
# default system prompt used by all prompt targets
system_prompt : |
You are a network assistant that helps operators with a better understanding of network traffic flow and perform actions on networking operations. No advice on manufacturers or purchasing decisions.
prompt_targets :
- name : device_summary
description : Retrieve network statistics for specific devices within a time range
endpoint :
name : app_server
path : /agent/device_summary
parameters :
- name : device_ids
type : list
description : A list of device identifiers (IDs) to retrieve statistics for.
required : true # device_ids are required to get device statistics
- name : days
type : int
description : The number of days for which to gather device statistics.
default : " 7 "
- name : reboot_devices
description : Reboot a list of devices
endpoint :
name : app_server
path : /agent/device_reboot
parameters :
- name : device_ids
type : list
description : A list of device identifiers (IDs).
required : true
- name : days
type : int
description : A list of device identifiers (IDs)
default : " 7 "
# Arch creates a round-robin load balancing between different endpoints, managed via the cluster subsystem.
endpoints :
app_server :
# value could be ip address or a hostname with port
# this could also be a list of endpoints for load balancing
# for example endpoint: [ ip1:port, ip2:port ]
endpoint : host.docker.internal:18083
# max time to wait for a connection to be established
connect_timeout : 0.005s
アーチ経由でアウトバウンドコールを作成します
from openai import OpenAI
# Use the OpenAI client as usual
client = OpenAI (
# No need to set a specific openai.api_key since it's configured in Arch's gateway
api_key = '--' ,
# Set the OpenAI API base URL to the Arch gateway endpoint
base_url = "http://127.0.0.1:12000/v1"
)
response = client . chat . completions . create (
# we select model from arch_config file
model = "--" ,
messages = [{ "role" : "user" , "content" : "What is the capital of France?" }],
)
print ( "OpenAI Response:" , response . choices [ 0 ]. message . content )
Archは、オープン標準をサポートすることにより、ベストインクラスの観察性をサポートするように設計されています。トレース、メトリック、ログの詳細については、観察可能性に関するドキュメントをお読みください
ロードマップに関するフィードバックが大好きで、アーチへの貢献を歓迎します!バグを修正したり、新しい機能を追加したり、ドキュメントを改善したり、チュートリアルを作成したりするかどうかにかかわらず、ヘルプは大歓迎です。詳細については、寄付ガイドをご覧ください