mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-04 02:31:27 +00:00
fix(agent-sdk): send {prompt: {text}} as followup body to match backend FollowupCreate
The backend's followup endpoint expects a FollowupCreate payload with a
nested prompt object ({prompt: {text: ...}}), not a flat {message: ...}.
Public method signature followup(message: string) is unchanged - only
the wire body changes.
This commit is contained in:
parent
68e58bf69b
commit
3ffaad8b1a
1 changed files with 10 additions and 6 deletions
|
|
@ -54,10 +54,11 @@ export class SessionHandle {
|
|||
|
||||
/** Queue a follow-up message into the active run. */
|
||||
async followup(message: string): Promise<void> {
|
||||
// Wire shape matches backend `FollowupCreate`: {prompt: {text: "..."}}.
|
||||
await requestJson<void>(this._client, {
|
||||
method: "POST",
|
||||
path: `/v2/sessions/${encodeURIComponent(this.id)}/followup`,
|
||||
body: { message },
|
||||
body: { prompt: { text: message } },
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -78,7 +79,7 @@ export class SessionHandle {
|
|||
method: "GET",
|
||||
path: `/v2/sessions/${encodeURIComponent(this.id)}/runs`,
|
||||
query: { limit: options.limit, cursor: options.cursor },
|
||||
}
|
||||
},
|
||||
);
|
||||
return {
|
||||
items: (data.items ?? []).map((info) => new Run(info, this._client)),
|
||||
|
|
@ -88,10 +89,13 @@ export class SessionHandle {
|
|||
|
||||
/** Snapshot of the full conversation across runs. */
|
||||
async conversation(): Promise<ConversationTurn[]> {
|
||||
const data = await requestJson<{ turns: ConversationTurn[] }>(this._client, {
|
||||
method: "GET",
|
||||
path: `/v2/sessions/${encodeURIComponent(this.id)}/conversation`,
|
||||
});
|
||||
const data = await requestJson<{ turns: ConversationTurn[] }>(
|
||||
this._client,
|
||||
{
|
||||
method: "GET",
|
||||
path: `/v2/sessions/${encodeURIComponent(this.id)}/conversation`,
|
||||
},
|
||||
);
|
||||
return data.turns ?? [];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue