Create a bidirectional streaming session.
Use as an async context manager. The session is automatically started and ended.
create_session(
self,
*,
system_prompt: Optional[str] = None,
voice_id: Optional[str] = None,
max_tokens: Optional[int] = None,
temperature: Optional[float] = None,
top_p: Optional[float] = None
) -> AsyncIterator[NovaSonicSession]Example::
async with model.create_session() as session: await session.send_text("Hello!") async for event in session.receive_events(): if event["type"] == "text": print(event["text"])
| Name | Type | Description |
|---|---|---|
system_prompt | Optional[str] | Default: NoneOverride the default system prompt. |
voice_id | Optional[str] | Default: NoneOverride the default voice ID. |
max_tokens | Optional[int] | Default: NoneOverride the default max tokens. |
temperature | Optional[float] | Default: NoneOverride the default temperature. |
top_p | Optional[float] | Default: NoneOverride the default top-p. |