Encode generation payloads once on success
This commit is contained in:
@@ -34,9 +34,13 @@ resolved request target may supply the endpoint. Generation preparation then:
|
||||
1. validates shared execution-setting invariants and the final selected base
|
||||
endpoint;
|
||||
2. maps the internal request into the OpenAI-compatible chat payload;
|
||||
3. validates and merges extra parameters;
|
||||
3. checks extra-parameter keys against empty and reserved names, then merges
|
||||
their values into the payload;
|
||||
4. composes `/chat/completions` through parsed URL path operations;
|
||||
5. resolves authentication and freezes the URL, body, and optional credential.
|
||||
5. encodes the complete body once on success. If encoding fails, extra values
|
||||
are checked individually to retain invalid-request classification; otherwise
|
||||
the complete-request failure remains a request failure;
|
||||
6. resolves authentication and freezes the URL, body, and optional credential.
|
||||
|
||||
Each execution of that prepared request creates a fresh HTTP request, body
|
||||
reader, and attempt timeout context. It closes the response body and returns
|
||||
|
||||
Reference in New Issue
Block a user