move method to endpoint section and use Agent AI app name

This commit is contained in:
Adil Hafeez 2024-12-06 11:54:50 -08:00
parent c40a6d66c8
commit 428227d98e
11 changed files with 36 additions and 32 deletions

View file

@ -39,7 +39,7 @@ To get in touch with us, please join our [discord server](https://discord.gg/pGZ
## Quickstart
Follow this quickstart guide to use arch gateway to build a simple Gen AI application. Laster in the section we will see how you can Arch Gateway to manage access keys, provide unified access to upstream LLMs and to provide e2e observability.
Follow this quickstart guide to use arch gateway to build a simple AI agent. Laster in the section we will see how you can Arch Gateway to manage access keys, provide unified access to upstream LLMs and to provide e2e observability.
### Prerequisites
@ -60,9 +60,9 @@ $ source venv/bin/activate # On Windows, use: venv\Scripts\activate
$ pip install archgw==0.1.5
```
### Build Gen AI Application with Arch Gateway
### Build AI Agent with Arch Gateway
In following quickstart we will show you how easy it is to build gen ai application with Arch gateway. We will build a currency exchange agent using following simple steps. For this demo we will use `https://api.frankfurter.dev/` to fetch latest price for currencies and assume USD as base currency.
In following quickstart we will show you how easy it is to build AI agent with Arch gateway. We will build a currency exchange agent using following simple steps. For this demo we will use `https://api.frankfurter.dev/` to fetch latest price for currencies and assume USD as base currency.
#### Step 1. Create arch config file

View file

@ -111,15 +111,15 @@ properties:
type: string
path:
type: string
http_method:
type: string
enum:
- GET
- POST
additionalProperties: false
required:
- name
- path
http_method:
type: string
enum:
- GET
- POST
system_prompt:
type: string
additionalProperties: false

View file

@ -194,12 +194,6 @@ pub struct Parameter {
pub in_path: Option<bool>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EndpointDetails {
pub name: String,
pub path: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, Default)]
pub enum HttpMethod {
#[default]
@ -218,13 +212,19 @@ impl Display for HttpMethod {
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EndpointDetails {
pub name: String,
pub path: Option<String>,
#[serde(rename = "http_method")]
pub method: Option<HttpMethod>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PromptTarget {
pub name: String,
pub default: Option<bool>,
pub description: String,
#[serde(rename = "http_method")]
pub method: Option<HttpMethod>,
pub endpoint: Option<EndpointDetails>,
pub parameters: Option<Vec<Parameter>>,
pub system_prompt: Option<String>,

View file

@ -920,7 +920,7 @@ impl StreamContext {
}
};
let http_method = prompt_target.method.unwrap_or_default().to_string();
let http_method = endpoint.method.unwrap_or_default().to_string();
let mut headers = vec![
(ARCH_UPSTREAM_HOST_HEADER, endpoint.name.as_str()),
(":method", &http_method),

View file

@ -46,3 +46,7 @@ endpoints:
frankfurther_api:
endpoint: api.frankfurter.dev:443
protocol: https
tracing:
random_sampling: 100
trace_arch_internal: true

View file

@ -31,10 +31,10 @@ system_prompt: |
prompt_targets:
- name: workforce
description: Get workforce data like headcount and satisfaction levels by region and staffing type
http_method: POST
endpoint:
name: app_server
path: /agent/workforce
http_method: POST
parameters:
- name: staffing_type
type: str
@ -50,10 +50,10 @@ prompt_targets:
required: false
description: the snapshot day for which you want workforce data.
- name: slack_message
http_method: POST
endpoint:
name: app_server
path: /agent/slack_message
http_method: POST
description: sends a slack message on a channel
parameters:
- name: slack_message

View file

@ -26,19 +26,19 @@ endpoints:
prompt_targets:
- name: policy_qa
http_method: POST
endpoint:
name: app_server
path: /policy/qa
http_method: POST
description: Handle general Q/A related to insurance.
default: true
- name: get_policy_coverage
description: Retrieve the coverage details for a given policy type (car, boat, house, motorcycle).
http_method: POST
endpoint:
name: app_server
path: /policy/coverage
http_method: POST
parameters:
- name: policy_type
type: str
@ -47,10 +47,10 @@ prompt_targets:
required: true
- name: initiate_policy
http_method: POST
endpoint:
name: app_server
path: /policy/initiate
http_method: POST
description: Start a policy coverage for car, boat, motorcycle or house.
parameters:
- name: policy_type
@ -64,10 +64,10 @@ prompt_targets:
required: true
- name: update_claim
http_method: POST
endpoint:
name: app_server
path: /policy/claim
http_method: POST
description: Update the notes on the claim
parameters:
- name: claim_id
@ -80,10 +80,10 @@ prompt_targets:
required: false
- name: update_deductible
http_method: POST
endpoint:
name: app_server
path: /policy/deductible
http_method: POST
description: Update the deductible amount for a specific policy coverage.
parameters:
- name: policy_id

View file

@ -19,10 +19,10 @@ system_prompt: |
prompt_targets:
- name: device_summary
description: Retrieve network statistics for specific devices within a time range
http_method: POST
endpoint:
name: app_server
path: /agent/device_summary
http_method: POST
parameters:
- name: device_ids
type: list
@ -34,10 +34,10 @@ prompt_targets:
default: "7"
- name: reboot_devices
description: Reboot a list of devices
http_method: POST
endpoint:
name: app_server
path: /agent/device_reboot
http_method: POST
parameters:
- name: device_ids
type: list

View file

@ -57,18 +57,18 @@ prompt_targets:
description: the temperature unit, e.g., Celsius and Fahrenheit
type: str
default: Fahrenheit
http_method: POST
endpoint:
name: weather_forecast_service
path: /weather
http_method: POST
- name: default_target
default: true
description: This is the default target for all unmatched prompts.
http_method: POST
endpoint:
name: weather_forecast_service
path: /default_target
http_method: POST
system_prompt: |
You are a helpful assistant! Summarize the user's request and provide a helpful response.
# if it is set to false arch will send response that it received from this prompt target to the user

View file

@ -51,18 +51,18 @@ prompt_targets:
description: the temperature unit, e.g., Celsius and Fahrenheit
type: str
default: Fahrenheit
http_method: POST
endpoint:
name: weather_forecast_service
path: /weather
http_method: POST
- name: default_target
default: true
description: This is the default target for all unmatched prompts.
http_method: POST
endpoint:
name: weather_forecast_service
path: /default_target
http_method: POST
system_prompt: |
You are a helpful assistant! Summarize the user's request and provide a helpful response.
# if it is set to false arch will send response that it received from this prompt target to the user

View file

@ -28,10 +28,10 @@ prompt_targets:
- name: information_extraction
default: true
description: handel all scenarios that are question and answer in nature. Like summarization, information extraction, etc.
http_method: POST
endpoint:
name: app_server
path: /agent/summary
http_method: POST
# Arch uses the default LLM and treats the response from the endpoint as the prompt to send to the LLM
auto_llm_dispatch_on_response: true
# override system prompt for this prompt target
@ -39,10 +39,10 @@ prompt_targets:
- name: reboot_network_device
description: Perform device operations like rebooting a device.
http_method: POST
endpoint:
name: app_server
path: /agent/action
http_method: POST
parameters:
- name: device_id
type: str