Skip to content

Commit e969793

Browse files
committed
chore(format): fix ruff formatter drift on main
The static/quality format job runs in check mode on push and was failing on main: `ruff format --check .` flagged 5 unformatted Python files under examples/showcases/a2ui-pdf-analyst/agent (main.py, src/dynamic_agent.py, src/fixed_agent.py, src/multimodal_middleware.py, src/pdf_tools.py). The oxfmt JS/TS check already passes, so this is ruff-only drift. Applied `ruff format` (pinned 0.15.13, matching CI); diff is formatting-only.
1 parent a4f1d14 commit e969793

5 files changed

Lines changed: 21 additions & 10 deletions

File tree

examples/showcases/a2ui-pdf-analyst/agent/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
66
Run with: uvicorn main:app --port 8123 --reload
77
"""
8+
89
from __future__ import annotations
910

1011
import os

examples/showcases/a2ui-pdf-analyst/agent/src/dynamic_agent.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
`web/src/app/api/copilotkit/route.ts` sets `injectA2UITool: false` to
3333
match.
3434
"""
35+
3536
from __future__ import annotations
3637

3738
import json
@@ -110,12 +111,8 @@ def generate_a2ui(runtime: ToolRuntime[Any]) -> str:
110111
"comparison, etc.)."
111112
)
112113

113-
model_with_tool = _RENDER_MODEL.bind_tools(
114-
[render_a2ui], tool_choice="render_a2ui"
115-
)
116-
response = model_with_tool.invoke(
117-
[SystemMessage(content=prompt), *messages]
118-
)
114+
model_with_tool = _RENDER_MODEL.bind_tools([render_a2ui], tool_choice="render_a2ui")
115+
response = model_with_tool.invoke([SystemMessage(content=prompt), *messages])
119116

120117
if not response.tool_calls:
121118
return json.dumps({"error": "secondary LLM did not call render_a2ui"})

examples/showcases/a2ui-pdf-analyst/agent/src/fixed_agent.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
that the agent populates from the document. Clicking a chip fires a
88
user action back to the agent, which re-renders with the new scope.
99
"""
10+
1011
from __future__ import annotations
1112

1213
from pathlib import Path

examples/showcases/a2ui-pdf-analyst/agent/src/multimodal_middleware.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
2929
Call ``install()`` once at agent startup. It's idempotent.
3030
"""
31+
3132
from __future__ import annotations
3233

3334
from typing import Any, List

examples/showcases/a2ui-pdf-analyst/agent/src/pdf_tools.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Shared agent tools: PDF text → structured data for the catalog."""
2+
23
from __future__ import annotations
34

45
import json
@@ -86,7 +87,9 @@ def extract_dashboard_data(pdf_text: str, document_name: str) -> str:
8687
Return ONLY the JSON object.
8788
"""
8889
out = _EXTRACTOR.invoke([("system", sys), ("user", user)])
89-
raw = _strip_to_json(out.content if isinstance(out.content, str) else str(out.content))
90+
raw = _strip_to_json(
91+
out.content if isinstance(out.content, str) else str(out.content)
92+
)
9093
# Validate. fall back to a tiny placeholder if the LLM produced invalid JSON.
9194
try:
9295
data = json.loads(raw)
@@ -96,8 +99,14 @@ def extract_dashboard_data(pdf_text: str, document_name: str) -> str:
9699
"title": document_name or "Untitled",
97100
"subtitle": "Could not extract structured data from this document.",
98101
"kpis": [
99-
{"label": "Status", "value": "n/a", "delta": "", "caption": "extraction failed"}
100-
] * 4,
102+
{
103+
"label": "Status",
104+
"value": "n/a",
105+
"delta": "",
106+
"caption": "extraction failed",
107+
}
108+
]
109+
* 4,
101110
"trend": [],
102111
"share": [],
103112
"rows": [],
@@ -142,7 +151,9 @@ def query_pdf(pdf_text: str, question: str) -> str:
142151
}}
143152
"""
144153
out = _EXTRACTOR.invoke([("system", sys), ("user", user)])
145-
raw = _strip_to_json(out.content if isinstance(out.content, str) else str(out.content))
154+
raw = _strip_to_json(
155+
out.content if isinstance(out.content, str) else str(out.content)
156+
)
146157
try:
147158
json.loads(raw) # validate
148159
return raw

0 commit comments

Comments
 (0)