Streaming
Streaming pozwala agentowi wysylac odpowiedzi token po tokenie.
interface StreamSession { delta(chunk: string): Promise<void>; done(finalPayload: SendPayload): Promise<void>; abort(): void;}Uzycie z OpenAI
agent.onMessage(async (msg) => { const session = agent.stream(msg.conversation_id); const stream = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "user", content: msg.content }], stream: true, }); let fullText = ""; for await (const chunk of stream) { const delta = chunk.choices[0]?.delta?.content ?? ""; if (delta) { fullText += delta; await session.delta(delta); } } await session.done({ type: "text", content: fullText });});Limity
| Ograniczenie | Wartosc |
|---|---|
| Maks. czas trwania | 5 minut |
| Timeout orphan | 30 sekund |
| Duze grupy (201-500) | Streaming wylaczony |