Skip to content

feat(bridge): add anthropic streaming sse adapter#182

Merged
typelicious merged 13 commits into
mainfrom
feature/anthropic-streaming-2026-03-30
Mar 31, 2026
Merged

feat(bridge): add anthropic streaming sse adapter#182
typelicious merged 13 commits into
mainfrom
feature/anthropic-streaming-2026-03-30

Conversation

@typelicious
Copy link
Copy Markdown
Collaborator

Summary

  • add the first Anthropic bridge streaming path for POST /v1/messages
  • translate OpenAI-compatible SSE chunks into Anthropic-style message events
  • support streamed text deltas plus basic streamed tool-call input deltas
  • keep non-streaming bridge behavior unchanged

Testing

  • rtk ruff check faigate/bridges/anthropic/adapter.py faigate/bridges/anthropic/init.py faigate/main.py tests/test_anthropic_api.py
  • env PYTHONPATH=. ./.venv-check-313/bin/pytest -q tests/test_anthropic_api.py tests/test_anthropic_bridge.py tests/test_config.py tests/test_request_hooks.py

@typelicious typelicious force-pushed the feature/anthropic-streaming-2026-03-30 branch from 050a494 to 772fbab Compare March 31, 2026 01:45
Comment thread faigate/main.py
safe_kind = asset_kind.strip()
if safe_kind not in {"brand", "fonts"}:
return JSONResponse({"error": {"message": "Asset kind not found"}}, status_code=404)
asset_path = (_DASHBOARD_ASSETS_DIR / safe_kind / asset_name).resolve()

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.

Copilot Autofix

AI about 2 months ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

Comment thread faigate/main.py
asset_path.relative_to((_DASHBOARD_ASSETS_DIR / safe_kind).resolve())
except ValueError:
return JSONResponse({"error": {"message": "Asset path is invalid"}}, status_code=404)
if not asset_path.is_file():

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.

Copilot Autofix

AI about 2 months ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

Comment thread faigate/main.py
if not asset_path.is_file():
return JSONResponse({"error": {"message": "Asset not found"}}, status_code=404)
media_type, _ = mimetypes.guess_type(str(asset_path))
return FileResponse(asset_path, media_type=media_type)

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.

Copilot Autofix

AI about 2 months ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

@typelicious typelicious merged commit b2de438 into main Mar 31, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants