clean up formatting for and remove unecescary returns

This commit is contained in:
aayushwhiz 2024-12-19 12:07:57 -08:00
parent 0013ef1018
commit 32ac598cf9
2 changed files with 20 additions and 14 deletions

View file

@ -6,8 +6,9 @@ from openai import OpenAI
from pydantic import BaseModel, Field
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."""
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
@ -50,7 +51,8 @@ def reboot_network_device(request_data: DeviceRebootRequest):
# Access data from the Pydantic model
device_ids = request_data.device_ids
# Validate 'device_ids' (This is already validated by Pydantic, but additional logic can be added if needed)
# Validate 'device_ids'
# (This is already validated by Pydantic, but additional logic can be added if needed)
if not device_ids:
raise HTTPException(
status_code=400, detail="'device_ids' parameter is required"
@ -85,7 +87,8 @@ def get_device_summary(request: DeviceSummaryRequest):
stats = {
"device_id": device_id,
"time_range": f"Last {time_range} days",
"data": f"Device {device_id} over the last {time_range} days experienced {minutes} minutes of downtime.",
"data": f"""Device {device_id} over the last {time_range} days experienced {minutes}
minutes of downtime.""",
}
minutes += 1
statistics.append(DeviceStatistics(**stats))