mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
feat(durable): expose thinking budget and websocket timeout options (#10410)
This commit is contained in:
parent
51313540a4
commit
dbc61d647b
2 changed files with 15 additions and 1 deletions
|
|
@ -10,6 +10,7 @@ import type {
|
|||
Model,
|
||||
Models,
|
||||
ModelThinkingLevel,
|
||||
ThinkingBudgets,
|
||||
Tool,
|
||||
ToolCall,
|
||||
ToolResultMessage,
|
||||
|
|
@ -547,6 +548,10 @@ export type ConversationCreateOptions = {
|
|||
export type ConversationStreamOptions = {
|
||||
transport?: Transport;
|
||||
timeoutMs?: number;
|
||||
/** WebSocket connection/open handshake timeout; stream idleness uses `timeoutMs`. */
|
||||
websocketConnectTimeoutMs?: number;
|
||||
/** Custom token budgets for thinking levels on token-based providers. */
|
||||
thinkingBudgets?: ThinkingBudgets;
|
||||
/** Provider/SDK retries inside one request attempt. */
|
||||
maxRetries?: number;
|
||||
maxRetryDelayMs?: number;
|
||||
|
|
|
|||
|
|
@ -384,7 +384,12 @@ describe("generation", () => {
|
|||
return fauxAssistantMessage("b");
|
||||
},
|
||||
]);
|
||||
setup.settings.stream = { timeoutMs: 1234, headers: { "x-test": "1" } };
|
||||
setup.settings.stream = {
|
||||
timeoutMs: 1234,
|
||||
headers: { "x-test": "1" },
|
||||
websocketConnectTimeoutMs: 5678,
|
||||
thinkingBudgets: { minimal: 128, low: 512, medium: 2048, high: 8192 },
|
||||
};
|
||||
const { harness, root } = await openChat(new MemoryStorage(), setup);
|
||||
await root.configure({ thinkingLevel: "high" }, context);
|
||||
harness.resume();
|
||||
|
|
@ -399,11 +404,15 @@ describe("generation", () => {
|
|||
headers: { "x-test": "1" },
|
||||
reasoning: "high",
|
||||
sessionId,
|
||||
websocketConnectTimeoutMs: 5678,
|
||||
thinkingBudgets: { minimal: 128, low: 512, medium: 2048, high: 8192 },
|
||||
});
|
||||
expect(seen[0]!.signal).toBeInstanceOf(AbortSignal);
|
||||
expect(seen[1]!.reasoning).toBeUndefined();
|
||||
expect(seen[1]).toMatchObject({ timeoutMs: 99, sessionId });
|
||||
expect(seen[1]!.headers).toBeUndefined();
|
||||
expect(seen[1]!.websocketConnectTimeoutMs).toBeUndefined();
|
||||
expect(seen[1]!.thinkingBudgets).toBeUndefined();
|
||||
await harness.close(context);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue