mirror of
https://github.com/katanemo/plano.git
synced 2026-06-08 14:55:14 +02:00
several fixes to demos (#238)
Co-authored-by: Salman Paracha <salmanparacha@MacBook-Pro-261.local>
This commit is contained in:
parent
e462e393b1
commit
dab7a44053
10 changed files with 51 additions and 73 deletions
|
|
@ -27,5 +27,3 @@ This demo showcases how the **Arch** can be used to build an HR agent to manage
|
|||
```
|
||||
3. Navigate to http://localhost:18080/
|
||||
4. "Can you give me workforce data for asia?"
|
||||
|
||||

|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ prompt_targets:
|
|||
parameters:
|
||||
- name: staffing_type
|
||||
type: str
|
||||
description: Staffing type like contract, fte or agency
|
||||
description: specific category or nature of employment used by an organization like fte, contract and agency
|
||||
required: true
|
||||
- name: region
|
||||
type: str
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 456 KiB After Width: | Height: | Size: 549 KiB |
|
|
@ -39,4 +39,4 @@ Arch gateway publishes stats endpoint at http://localhost:19901/stats. In this d
|
|||
|
||||
Here is sample interaction
|
||||
|
||||
<img width="575" alt="image" src="https://github.com/user-attachments/assets/25d40f46-616e-41ea-be8e-1623055c84ec">
|
||||

|
||||
|
|
|
|||
|
|
@ -14,30 +14,11 @@ llm_providers:
|
|||
|
||||
# default system prompt used by all prompt targets
|
||||
system_prompt: |
|
||||
You are a network assistant that just offers facts; not advice on manufacturers or purchasing decisions.
|
||||
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: reboot_devices
|
||||
description: Reboot specific devices or device groups
|
||||
endpoint:
|
||||
name: app_server
|
||||
path: /agent/device_reboot
|
||||
parameters:
|
||||
- name: device_ids
|
||||
type: list
|
||||
description: A list of device identifiers (IDs) to reboot.
|
||||
required: true
|
||||
- name: time_range
|
||||
type: int
|
||||
description: Optional time range in days for reboot operations. Defaults to 7.
|
||||
- name: network_qa
|
||||
endpoint:
|
||||
name: app_server
|
||||
path: /agent/network_summary
|
||||
description: Handle general Q/A related to networking.
|
||||
default: true
|
||||
- name: device_summary
|
||||
description: Retrieve statistics for specific devices within a time range
|
||||
description: Retrieve network statistics for specific devices within a time range
|
||||
endpoint:
|
||||
name: app_server
|
||||
path: /agent/device_summary
|
||||
|
|
@ -46,9 +27,23 @@ prompt_targets:
|
|||
type: list
|
||||
description: A list of device identifiers (IDs) to retrieve statistics for.
|
||||
required: true # device_ids are required to get device statistics
|
||||
- name: time_range
|
||||
- name: days
|
||||
type: int
|
||||
description: Time range in days for which to gather device statistics. Defaults to 7.
|
||||
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.
|
||||
|
|
@ -60,12 +55,3 @@ endpoints:
|
|||
endpoint: host.docker.internal:18083
|
||||
# max time to wait for a connection to be established
|
||||
connect_timeout: 0.005s
|
||||
|
||||
ratelimits:
|
||||
- model: gpt-4
|
||||
selector:
|
||||
key: selector-key
|
||||
value: selector-value
|
||||
limit:
|
||||
tokens: 1
|
||||
unit: minute
|
||||
|
|
|
|||
|
|
@ -2,24 +2,14 @@ services:
|
|||
api_server:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
environment:
|
||||
- CHAT_COMPLETION_ENDPOINT=http://host.docker.internal:10000/v1
|
||||
volumes:
|
||||
- ./arch_config.yaml:/app/arch_config.yaml
|
||||
- ../shared/chatbot_ui/common.py:/app/common.py
|
||||
ports:
|
||||
- "18083:80"
|
||||
healthcheck:
|
||||
test: ["CMD", "curl" ,"http://localhost:80/healthz"]
|
||||
interval: 5s
|
||||
retries: 20
|
||||
|
||||
chatbot_ui:
|
||||
build:
|
||||
context: ../shared/chatbot_ui
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "18080:8080"
|
||||
environment:
|
||||
- OPENAI_API_KEY=${OPENAI_API_KEY:?error}
|
||||
- CHAT_COMPLETION_ENDPOINT=http://host.docker.internal:10000/v1
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
volumes:
|
||||
- ./arch_config.yaml:/app/arch_config.yaml
|
||||
|
|
|
|||
BIN
demos/network_agent/image.png
Normal file
BIN
demos/network_agent/image.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 636 KiB |
|
|
@ -1,8 +1,15 @@
|
|||
from openai import OpenAI
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import List, Optional
|
||||
from common import create_gradio_app
|
||||
import gradio as gr
|
||||
import os
|
||||
|
||||
|
||||
app = FastAPI()
|
||||
demo_description = """This demo illustrates how **Arch** can be used to perform function calling with network-related tasks.
|
||||
In this demo, you act as a **network assistant** that provides factual information, without offering advice on manufacturers or purchasing decisions."""
|
||||
|
||||
|
||||
# Define the request model
|
||||
|
|
@ -88,27 +95,15 @@ def get_device_summary(request: DeviceSummaryRequest):
|
|||
return DeviceSummaryResponse(statistics=statistics)
|
||||
|
||||
|
||||
@app.post("/agent/network_summary")
|
||||
async def policy_qa():
|
||||
"""
|
||||
This method handles Q/A related to general issues in networks.
|
||||
It forwards the conversation to the OpenAI client via a local proxy and returns the response.
|
||||
"""
|
||||
return {
|
||||
"choices": [
|
||||
{
|
||||
"message": {
|
||||
"role": "assistant",
|
||||
"content": "I am a helpful networking agent, and I can help you get status for network devices or reboot them",
|
||||
},
|
||||
"finish_reason": "completed",
|
||||
"index": 0,
|
||||
}
|
||||
],
|
||||
"model": "network_agent",
|
||||
"usage": {"completion_tokens": 0},
|
||||
}
|
||||
CHAT_COMPLETION_ENDPOINT = os.getenv("CHAT_COMPLETION_ENDPOINT")
|
||||
client = OpenAI(
|
||||
api_key="--",
|
||||
base_url=CHAT_COMPLETION_ENDPOINT,
|
||||
)
|
||||
|
||||
gr.mount_gradio_app(
|
||||
app, create_gradio_app(demo_description, client), path="/agent/chat"
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
||||
|
|
|
|||
|
|
@ -2,3 +2,12 @@ fastapi
|
|||
uvicorn
|
||||
pydantic
|
||||
typing
|
||||
pandas
|
||||
gradio==5.3.0
|
||||
async_timeout==4.0.3
|
||||
loguru==0.7.2
|
||||
asyncio==3.4.3
|
||||
httpx==0.27.0
|
||||
python-dotenv==1.0.1
|
||||
pydantic==2.8.2
|
||||
openai==1.51.0
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ log = logging.getLogger(__name__)
|
|||
|
||||
GRADIO_CSS_STYLE = """
|
||||
.json-container {
|
||||
height: 95vh !important;
|
||||
height: 80vh !important;
|
||||
overflow-y: auto !important;
|
||||
}
|
||||
.chatbot {
|
||||
height: calc(95vh - 100px) !important;
|
||||
height: calc(80vh - 100px) !important;
|
||||
overflow-y: auto !important;
|
||||
}
|
||||
footer {visibility: hidden}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue