Commit 5bf9170
feat(ogx-api): introduce ogx_api.provider and ogx_api.types namespaces (#5740)
## Summary
Splits the public surface of the `ogx-api` Python package into two
import namespaces, as called out in the API Stability policy work in
#5719. No file moves, no behavioral changes — just aggregate
`__init__.py` modules that re-export from existing per-API submodules.
- **`ogx_api.provider`** (59 symbols) — Provider SDK surface for
out-of-tree providers: `Api`,
`ProviderSpec`/`InlineProviderSpec`/`RemoteProviderSpec`, protocol
classes (`Inference`, `Responses`, `VectorIO`, `Safety`, `Files`, …),
schema utilities (`webmethod`, `json_schema_type`, `register_schema`),
`Resource`/`ResourceType`, version constants, validators. Levelled as a
single `v1`-stable contract per the policy.
- **`ogx_api.types`** (413 symbols) — API datatype surface:
request/response Pydantic models, content blocks, errors, value types.
Each datatype's stability is inherited from the highest-stability route
that references it.
Shared resource/value types (`Model`, `Shield`, `ToolGroup`,
`VectorStore`) are canonically in `ogx_api.types` and re-exported from
`ogx_api.provider` for provider-side ergonomics — these are the only
allowed overlap.
### Backwards compatibility
Top-level imports (`from ogx_api import X`) continue to work unchanged
for every symbol. New code should prefer the explicit namespace path:
```python
from ogx_api.provider import Api, Inference, ProviderSpec
from ogx_api.types import OpenAIResponseObject, ChatCompletionMessage
```
### Out of scope
- Physically moving files into the new directories.
- Deprecating or warning on top-level imports.
- Touching internal `ogx` server imports.
## Test plan
- [x] New contract test `tests/unit/test_ogx_api_namespaces.py` (5
cases): asserts disjoint namespaces, top-level back-compat (every
namespaced symbol resolves to the same object via `ogx_api`), and
presence of core symbols. **All pass.**
- [x] Broader unit-test sweep: `uv run pytest tests/unit/
--ignore=tests/unit/providers` → **973 passed**. Provider-test failures
in this env are pre-existing missing optional deps (`moto`,
`databricks`), not introduced here.
- [x] `pre-commit run` clean on touched files (ruff, ruff-format, mypy,
license-headers, API spec codegen all pass; the `check-init-py` hook
fails on macOS bash 3.2 — pre-existing, unrelated).
- [ ] CI to run `test-external.yml` and
`test-external-provider-module.yml` against this branch to confirm
out-of-tree provider builds still work via top-level imports.
## Related
- Policy doc PR: #5719 (defines the two-surface model conceptually).
This PR is the implementation. Trivial doc conflict expected on
whichever merges second; either is straightforward to resolve.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Signed-off-by: Charlie Doern <cdoern@redhat.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent c95adb1 commit 5bf9170
5 files changed
Lines changed: 1209 additions & 0 deletions
File tree
- docs/docs/concepts/apis
- src/ogx_api
- provider
- types
- tests/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
75 | 84 | | |
76 | 85 | | |
77 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
| |||
0 commit comments