Commit 744eccd
authored
feat(api): generate and migrate Prompt REST resources (#750)
### AI Summary
Implements the Prompt slice of #683 by publishing all six operations
tagged Prompts and moving `load_prompt()` retrieval onto the public REST
resources. Prompt request and response models are also exported through
the public API.
### Migration flow
```text
Before
load_prompt(id=...) ------> raw GET /v1/prompt/{id}
load_prompt(slug=...) ----> raw GET /v1/prompt
After
load_prompt(id=...) ------> generated GET /v1/prompt/{id}
load_prompt(slug=...) ----> generated GET /v1/prompt
```
| SDK workflow | Previous wire call | Public REST call |
| --- | --- | --- |
| Load by ID | Raw `GET /v1/prompt/{id}` | Generated `GET
/v1/prompt/{id}` | | Load by project and slug | Raw `GET /v1/prompt` |
Generated `GET /v1/prompt` | | Prompt CRUD | No generated resource |
`client.openapi.prompts` |
| Behavior | Result |
| --- | --- |
| Explicit credentials | Use isolated, cached generated clients without
mutating global login | | Active global login | Reuse the existing
generated API client | | Version and environment | Explicit version
continues to take precedence over environment | | Cache fallback |
Preserve local prompt cache fallback for retryable server failures | |
Lazy and async loading | Continue deferring retrieval until the prompt
is used | | Prompt lookup by ID | Consume the direct response without a
synthetic `objects` envelope | | Retry behavior | GET operations are
safe reads; version-producing writes are not retried |
Refs #6831 parent f6ef55a commit 744eccd
16 files changed
Lines changed: 2519 additions & 103 deletions
File tree
- openapi
- py/src/braintrust
- api
- _generated
- models
- cassettes
- types
- type_tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments