Skip to content

Modernize#25

Draft
JarbasAl wants to merge 10 commits intodevfrom
modernize
Draft

Modernize#25
JarbasAl wants to merge 10 commits intodevfrom
modernize

Conversation

@JarbasAl
Copy link
Member

No description provided.

JarbasAl and others added 4 commits March 17, 2026 23:04
- Add lint, build_tests, license_tests, pip_audit workflows (@dev)
- Add docs/, QUICK_FACTS.md, FAQ.md, AUDIT.md, SUGGESTIONS.md, MAINTENANCE_REPORT.md
- Migrate setup.py -> pyproject.toml

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds Anthropic Claude, Google Gemini, Cohere, HuggingFace TGI, and AWS
Bedrock-compatible endpoints, plus OpenAI /models & /embeddings stubs
and Ollama /api/show, /api/ps, /api/pull, /api/push, /api/embeddings.

New files:
- schemas/anthropic.py, schemas/gemini.py: Pydantic schemas with Field constraints
- anthropic.py: POST /v1/messages with SSE streaming (Anthropic format)
- gemini.py: POST /v1beta/models/{id}:generateContent + :streamGenerateContent
- cohere.py: POST /v1/chat, /v1/generate, /v1/embed
- huggingface_tgi.py: POST /generate, /generate_stream, GET /info, /health
- aws_bedrock.py: POST /model/{id}/invoke, /invoke-with-response-stream,
  /model/{id}/converse; multi-model response normalisation by model prefix

Modified files:
- chat.py: add GET /v1/models, POST /v1/embeddings; fix response_model=None
  on streaming routes; fix Python 3.11 f-string nested dict literals
- ollama.py: add GET /api/show, /api/ps; POST /api/pull, /api/push,
  /api/embeddings; typed Pydantic request schemas; response_model=None

test/unittests/test_compat_routers.py: 29 tests, all passing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Each compat router now mounts under a prefix that identifies the API vendor:
  /v1/...                OpenAI (chat_router — unchanged)
  /api/...               Ollama (ollama_router — unchanged)
  /anthropic/v1/...      Anthropic Claude  (was /v1 — conflicted with OpenAI)
  /gemini/v1beta/...     Google Gemini
  /cohere/v1/...         Cohere  (was /v1 — conflicted with OpenAI /v1/chat)
  /tgi/...               HuggingFace TGI
  /bedrock/model/...     AWS Bedrock  (was /model — now scoped)

Benefits: all routers coexist in one FastAPI app with no path conflicts;
Swagger UI groups endpoints clearly by vendor tag + prefix.

Fix Python 3.11 f-string nested dict literals in chat.py (used temp vars).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…cy paths with deprecation

OpenAI and Ollama routers now mount under vendor-namespaced prefixes:
  /openai/v1/...   (was /v1/...)
  /ollama/api/...  (was /api/...)

Legacy paths (/v1/... and /api/...) are preserved via register_deprecated_routes()
which re-mounts the same route handlers at the old paths with deprecated=True.

An HTTP middleware (add_deprecation_middleware()) injects response headers on
every request to a legacy path:
  Deprecation: true
  Link: </openai/v1/...>; rel="successor-version"

This gives clients a clear migration signal without breaking existing integrations.
New file: ovos_persona_server/deprecated_routers.py

test: 31 passing (4 new tests for deprecated path behaviour)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 724f8bb7-4658-46b6-b918-8619ed4d65f6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch modernize
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Mar 18, 2026

The bots have finished their work. Take a look! 🤖

I've aggregated the results of the automated checks for this PR below.

🔍 Lint

Another piece of the puzzle! 🧩

ruff: issues found — see job log

🔨 Build Tests

Everything is bolted down and ready to go. 🔩

✅ All versions pass

Python Build Install
3.10
3.11
3.12
3.13
3.14

⚖️ License Check

Verifying the source of all binary files. 💾

✅ No license violations found (52 packages).

License distribution: 14× MIT, 11× MIT License, 6× Apache Software License, 5× Apache-2.0, 3× BSD-3-Clause, 2× ISC License (ISCL), 2× PSF-2.0, 2× Python Software Foundation License, +7 more

Full breakdown — 52 packages
Package Version License URL
annotated-doc 0.0.4 MIT link
annotated-types 0.7.0 MIT License link
anyio 4.12.1 MIT link
audioop-lts 0.2.2 PSF-2.0 link
build 1.4.0 MIT link
certifi 2026.2.25 Mozilla Public License 2.0 (MPL 2.0) link
charset-normalizer 3.4.6 MIT link
click 8.3.1 BSD-3-Clause link
combo_lock 0.3.0 Apache Software License link
fastapi 0.135.1 MIT link
filelock 3.25.2 MIT link
idna 3.11 BSD-3-Clause link
importlib_metadata 8.7.1 Apache-2.0 link
json-database 0.10.1 MIT link
kthread 0.2.3 MIT License link
langcodes 3.5.1 MIT License link
markdown-it-py 4.0.0 MIT License link
mdurl 0.1.2 MIT License link
memory-tempfile 2.2.3 MIT License link
ovos-config 2.1.1 Apache-2.0 link
ovos-persona-server 0.5.1a2 Apache-2.0 link
ovos-plugin-manager 2.2.0 Apache-2.0 link
ovos-utils 0.8.5 Apache-2.0 link
ovos_bus_client 1.5.0 Apache Software License link
ovos_openai_plugin 2.0.6 MIT link
ovos_persona 0.7.1 Apache License 2.0 link
ovos_solver_failure_plugin 0.0.3 MIT link
packaging 26.0 Apache-2.0 OR BSD-2-Clause link
pexpect 4.9.0 ISC License (ISCL) link
ptyprocess 0.7.0 ISC License (ISCL) link
pydantic 2.12.5 MIT link
pydantic_core 2.41.5 MIT link
pyee 12.1.1 MIT License link
Pygments 2.19.2 BSD License link
pyproject_hooks 1.2.0 MIT License link
python-dateutil 2.9.0.post0 Apache Software License; BSD License link
PyYAML 6.0.3 MIT License link
quebra-frases 0.3.7 Apache Software License link
regex 2026.2.28 Apache-2.0 AND CNRI-Python link
requests 2.32.5 Apache Software License link
rich 13.9.4 MIT License link
rich-click 1.9.7 MIT License

Copyright (c) 2022 Phil Ewels

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
| link |
| six | 1.17.0 | MIT License | link |
| standard-aifc | 3.13.0 | Python Software Foundation License | link |
| standard-chunk | 3.13.0 | Python Software Foundation License | link |
| starlette | 0.52.1 | BSD-3-Clause | link |
| typing-inspection | 0.4.2 | MIT | link |
| typing_extensions | 4.15.0 | PSF-2.0 | link |
| urllib3 | 2.6.3 | MIT | link |
| watchdog | 6.0.0 | Apache Software License | link |
| websocket-client | 1.9.0 | Apache Software License | link |
| zipp | 3.23.0 | MIT | link |

Policy: Apache 2.0 (universal donor). StrongCopyleft / NetworkCopyleft / WeakCopyleft / Other / Error categories fail. MPL allowed.

🔒 Security (pip-audit)

I've checked the security of our API endpoints. 🌐

✅ No known vulnerabilities found (71 packages scanned).


The automation never sleeps, but I might reboot. 💤

@JarbasAl JarbasAl marked this pull request as draft March 18, 2026 16:34
Adds docs/api-compatibility.md (7 APIs + 2 deprecated, curl examples),
docs/deprecation.md, docs/streaming.md, docs/embeddings.md,
docs/bedrock-models.md. Updates FAQ.md (20+ Q&As), QUICK_FACTS.md,
AUDIT.md, SUGGESTIONS.md, MAINTENANCE_REPORT.md.

AI-Generated Change:
- Model: claude-sonnet-4-6
- Intent: document all seven canonical and two deprecated API layers exhaustively
- Impact: docs/ fully populated, FAQ.md 20+ entries
- Verified via: uv run pytest test/ -v (41 passed)
New TestOllamaRouter: tags, chat, show, ps, pull, embeddings (501).
New TestDeprecatedOllamaRouter: /api/... returns 200 + Deprecation header.
Additional Bedrock converse structure test.

AI-Generated Change:
- Model: claude-sonnet-4-6
- Intent: validate Ollama router endpoints and /api/... deprecation headers
- Impact: 31 → 41 tests
- Verified via: uv run pytest test/ -v (41 passed)
AI-Generated Change:
- Model: claude-sonnet-4-6
- Intent: Expose OVOS persona via A2A protocol; implement AgentExecutor that bridges Persona.stream() (sync) to async A2A event queue via asyncio.to_thread
- Impact: New a2a.py with OVOSPersonaAgentExecutor, _agent_card, create_a2a_application; a2a-sdk is optional
- Verified via: 13 unit tests, 95% coverage
AI-Generated Change:
- Model: claude-sonnet-4-6
- Intent: Mount A2A Starlette sub-app at /a2a when --a2a-base-url is provided; add optional [a2a] dependency
- Impact: create_persona_app gains a2a_base_url param; __main__.py exposes --a2a-base-url flag; pyproject.toml adds [a2a] and [dev] extras
… FAQ

AI-Generated Change:
- Model: claude-sonnet-4-6
- Intent: Full test coverage without live A2A server; document new A2A endpoint for operators
- Impact: 13 tests passing; docs/a2a.md and FAQ.md updated
- Verified via: pytest test/unittests/test_a2a.py -v --cov=ovos_persona_server.a2a
AI-Generated Change:
- Model: claude-sonnet-4-6
- Intent: Rewrite README with all 8 API surfaces, A2A section, persona config examples, troubleshooting; update docs/index.md with A2A entry; expand docs/a2a.md with endpoints, curl examples, streaming, multi-turn, architecture; update FAQ.md with A2A section
- Impact: README.md rewritten; docs/index.md and docs/a2a.md updated; FAQ.md expanded
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.

1 participant