Repository navigation
docs(proxy): describe /v1/decisions and /v1/systemone in Swagger UI - #45838
Conversation
Add summaries, descriptions, inlined request body schemas with examples and typed 200 responses to the decision routes and their aliases, so the OpenAPI document and the lazy snapshot show both request formats Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
kerry seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
| ] | ||
| safety_identifier: Annotated[ | ||
| str | None, | ||
| Field(description="A stable id for your end user. Sent to OpenAI and dropped for other providers"), |
There was a problem hiding this comment.
Dropping requires an explicit setting
The safety_identifier description says other providers drop it, but they reject it with a 400 unless drop_params is enabled. Developers following Swagger can add this field to an otherwise valid non-OpenAI request and get an unexpected error. State that dropping requires drop_params: true, then regenerate the snapshot and dashboard types.
Merging this PR will not alter performance
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…erriAI#45838) * docs(proxy): describe /v1/decisions and /v1/systemone in Swagger UI Add summaries, descriptions, inlined request body schemas with examples and typed 200 responses to the decision routes and their aliases, so the OpenAPI document and the lazy snapshot show both request formats Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(proxy): cap _inlined schema walk depth for the recursion check Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: kerry <kerry@berri.ai> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit bc2cc42)
TLDR
Problem this solves:
/v1/decisionsand/v1/systemoneas bare operationsHow it solves it:
OpenAIDecisionResponseandDecisionsResponseschema.d.tsregeneratedUser Flow
Before: a developer opening Swagger to learn the decision request format finds nothing to read
decisionstagPOST /v1/decisionsis titled "Decisions", has no description, no request body and an empty 200 responsePOST /v1/systemonelooks identical apart from the title, so they cannot tell the two formats apartAfter: the same page documents both formats with examples they can send as is
decisionstagPOST /v1/decisionsreads "Ask questions about an input (OpenAI Decisions format)" with thepredicate,choiceandscoretypes and a docs linkmodel,input,questionsandsafety_identifierwith an example request, and the 200 response shows theOpenAIDecisionResponseschemaPOST /v1/systemonedoes the same formodel,stateand namedquestionswithnoul,choiceandscore, returningDecisionsResponsePre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
Both proxies run the same config, two decision deployments (
jevonsystemone/,lunaonopenai/) and a master key, base on port 4001 and tip on port 4000. The Swagger screenshots above are from the same two proxiesBefore (09558ba)
/v1/decisions and /v1/systemone in the OpenAPI document
for r in /v1/decisions /v1/systemone; do curl -s localhost:4001/openapi.json | jq -c --arg r "$r" '.paths[$r].post | {summary, description, requestBody, response_schema: .responses["200"].content["application/json"].schema}'; doneAfter (4819de3)
/v1/decisions and /v1/systemone in the OpenAPI document
for r in /v1/decisions /v1/systemone; do curl -s localhost:4000/openapi.json | jq -c --arg r "$r" '.paths[$r].post | {summary, request_properties: (.requestBody.content["application/json"].schema.properties | keys), required: .requestBody.content["application/json"].schema.required, example_keys: (.requestBody.content["application/json"].example | keys), response_schema: .responses["200"].content["application/json"].schema}'; donecurl -s localhost:4000/openapi.json | jq -c '.paths["/v1/decisions"].post.description'Type
📖 Documentation
Caveats (if any)
Low
components, so the snapshot grows by about 26 KBFinal Attestation
Link to Devin session: https://app.devin.ai/sessions/6fb807b73569493f85e18ebd83dfbf6f
Open in Devin Desktop: https://app.devin.ai/desktop/session/6fb807b73569493f85e18ebd83dfbf6f?variant=devin
Requested by: @kerry-berri
Note
Devin errored when opening this Pull Request as kerry-berri.
As a fallback, Devin opened this PR as itself.