Skip to content

feat(generators): add OrcaRouter generator - #2101

Open
XiaoHuo888-hue wants to merge 1 commit into
NVIDIA:mainfrom
XiaoHuo888-hue:add-orcarouter-provider
Open

feat(generators): add OrcaRouter generator#2101
XiaoHuo888-hue wants to merge 1 commit into
NVIDIA:mainfrom
XiaoHuo888-hue:add-orcarouter-provider

Conversation

@XiaoHuo888-hue

Copy link
Copy Markdown

Summary

Adds OrcaRouter as a named, first-class generator (--target_type orcarouter), mirroring the existing GroqChat OpenAI-compatible provider pattern.

OrcaRouter is an OpenAI-compatible gateway that routes to a large catalogue of models. It also runs gateway-level, zero-trust security for AI agents on the same endpoint — screening every prompt/response and governing every tool call on a default-deny basis, with no application code changes.

The new garak.generators.orcarouter.OrcaRouter generator:

  • Points at https://api.orcarouter.ai/v1 (OpenAI-compatible chat/completions)
  • Reads the API key from the ORCAROUTER_API_KEY environment variable
  • Defaults to --target_name orcarouter/auto for model auto-routing
  • Suppresses the same unsupported params as GroqChat (single-generation chat only)

Changes

  • garak/generators/orcarouter.py — new generator (mirrors groq.py)
  • docs/source/generators/orcarouter.rst + docs/source/index_generators.rst — Sphinx docs entry
  • README.md — add OrcaRouter to the supported-providers list and the "Intro to generators" section
  • tests/generators/test_orcarouter.py — dedicated tests (mirror test_groq.py)
  • tests/generators/test_openai_compatible.py — add OrcaRouter to the shared OpenAI-compatible coverage
  • tests/generators/test_generators.py — exclude orcarouter from the non-conversation-signature test (same as groq)

Why this isn't duplicating an existing PR

Searching NVIDIA/garak for orcarouter in PRs/issues/code returns no existing work; this is the first OrcaRouter integration for garak.

Verification

  • python -m pytest tests/generators/test_orcarouter.py tests/generators/test_openai_compatible.py tests/generators/test_generators.py tests/test_docs.py821 passed, 6 skipped
  • black --check on new files → clean
  • Live end-to-end with a real ORCAROUTER_API_KEY:
    • OrcaRouter(name="orcarouter/auto")._call_model(conversation, 1) → HTTP 200, response ORCA-FULL-OK
    • .generate(conversation, 1) → HTTP 200, response ORCA-FULL-OK
    • The same endpoint via httpx → HTTP 200
  • python -m garak --list_generators shows orcarouter / orcarouter.OrcaRouter

Disclosure: I'm an engineer on the OrcaRouter team.

This PR was written primarily with Claude Code (AI assistance).

Add a named OrcaRouter generator that mirrors the existing GroqChat
OpenAI-compatible provider pattern, exposing OrcaRouter as a first-class
--target_type. Uses the OpenAI-compatible API at https://api.orcarouter.ai/v1
with the ORCAROUTER_API_KEY environment variable.

Includes docs (generators/orcarouter.rst + index entry), README usage, and
tests (dedicated test file plus shared OpenAI-compatible coverage).

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: XiaoHuo888-hue <jinhao.song@myflashcloud.com>
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