mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
fix(agent-sdk): wrap session.send body in {prompt: ...} to match RunCreate schema
Backend RunCreate expects {prompt: {...}} but the SDK was posting
{text, images} directly. Wrap the normalized payload accordingly so
session.send returns a real Run instead of 422.
This commit is contained in:
parent
b0f21dd137
commit
2bf50108fe
1 changed files with 7 additions and 3 deletions
|
|
@ -41,13 +41,17 @@ export class SessionHandle {
|
|||
return this._status;
|
||||
}
|
||||
|
||||
/** Start a new run with `input`. Throws 409 if a run is already in flight. */
|
||||
/** Start a new run with `input`. Throws 409 if a run is already in flight.
|
||||
*
|
||||
* Backend ``RunCreate`` schema expects ``{prompt: {...}}`` — wrap the
|
||||
* normalized text/images payload accordingly so requests don't 422.
|
||||
*/
|
||||
async send(input: string | SendInput): Promise<Run> {
|
||||
const body = normalizeSendInput(input);
|
||||
const normalized = normalizeSendInput(input);
|
||||
const info = await requestJson<RunInfo>(this._client, {
|
||||
method: "POST",
|
||||
path: `/v2/sessions/${encodeURIComponent(this.id)}/runs`,
|
||||
body,
|
||||
body: { prompt: normalized },
|
||||
});
|
||||
return new Run(info, this._client);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue