Commit 81516c6
authored
feat: restore provider_data constructor kwarg (#343)
## Summary
Adds back the `provider_data: Mapping[str, Any] | None` kwarg on
`OgxClient` and `AsyncOgxClient` that was present in the previous
`llama-stack-client` SDK but lost during the rename to `ogx-client`.
When provided, it is JSON-serialized and merged into `default_headers`
under `X-OGX-Provider-Data` — the header the OGX server reads to thread
per-request provider credentials through.
## Why
Without this kwarg, every caller upgrading from `llama-stack-client` has
to construct the header themselves on every client instantiation:
```python
OgxClient(
base_url=...,
default_headers={"X-OGX-Provider-Data": json.dumps(get_provider_data())},
)
```
That breaks a large surface of OGX integration tests and downstream code
on upgrade. Restoring the affordance keeps the migration to `ogx-client`
source-compatible for the constructor signature.
## Behavior matches the old SDK
The previous implementation in `llama-stack-client` v0.7.2-alpha.3 was:
```python
custom_headers = default_headers or {}
if provider_data is not None:
custom_headers["X-LlamaStack-Provider-Data"] = json.dumps(provider_data)
```
This PR mirrors that, with the only intentional difference being the
header name (`X-OGX-Provider-Data`, matching the renamed server).
## Test plan
- [x] `OgxClient(base_url=..., provider_data={"k": "v"})` accepts the
kwarg
- [x] `client.default_headers["X-OGX-Provider-Data"]` contains `{"k":
"v"}` JSON-encoded
- [x] Same for `AsyncOgxClient`
Signed-off-by: Charlie Doern <[email protected]>1 parent d67b7f3 commit 81516c6
1 file changed
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
| 116 | + | |
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
| |||
135 | 137 | | |
136 | 138 | | |
137 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
138 | 146 | | |
139 | 147 | | |
140 | 148 | | |
| |||
436 | 444 | | |
437 | 445 | | |
438 | 446 | | |
| 447 | + | |
439 | 448 | | |
440 | 449 | | |
441 | 450 | | |
| |||
459 | 468 | | |
460 | 469 | | |
461 | 470 | | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
462 | 477 | | |
463 | 478 | | |
464 | 479 | | |
| |||
0 commit comments