configure_session
SessionConfig
object, which contains parameters like VAD (voice
activity detection), STT (speech-to-text), TTS (text-to-speech), the initial messages of the session, etc.
from jay_ai import ConfigureSessionInput, SessionConfig
async def configure_session(input: ConfigureSessionInput):
user_timezone = input["custom_data"]["my_user_timezone"]
return SessionConfig(
initial_messages=[
{"role": "system", "content": "You are a helpful assistant."}
],
vad=VAD.Silero(),
stt=STT.Deepgram(api_key=os.environ["DEEPGRAM_API_KEY"]),
tts=TTS.OpenAI(
api_key=os.environ["OPENAI_API_KEY"]
),
session_data={
"my_user_id": "test-12345",
"my_user_timezone": user_timezone
}
)
Hide properties
startSession
API endpoint. Makes it possible to include fields that are specific to the session or to your users. Learn how to set these fields in the Starting Sessions guide.input
parameter:
{
"custom_data": {
"my_user_id": "abc123"
}
}
Hide properties
Show properties
role
is "tool"
.Show properties
Show possible types
Show properties
Show properties
"eastus"
).Show properties
true
, the endpoint sends continuous updates, meaning transcription results may evolve over time. Learn More.true
, additional formatting will be applied to transcripts to improve readability. Learn More.smart_format
is true
. If a speaker begins saying a number while no_delay
is false
and Smart Format is enabled, Deepgram will wait to return a transcription until the speaker has finished and continues on to non-numerical speech. This behavior ensures numbers have the best possible formatting and are not broken up over multiple chunks.true
, the streaming endpoint immediately finalizes the transcription for the processed time range and returns the transcript with a speech_final
parameter set to true
. Learn More.true
, these words will be included. Learn More.Show possible types
Show properties
DEFAULT_VOICE = Voice(
id="EXAVITQu4vr4xnSDxMaL",
name="Bella",
category="premade",
settings=VoiceSettings(
stability=0.71, similarity_boost=0.5, style=0.0, use_speaker_boost=True
),
)
Show Voice
https://api.elevenlabs.io/v1/voices
to list all the available voices.category
fieldsShow VoiceSettings
Show properties
language_code
.Show properties
"eastus"
).Show ProsodyConfig
"x-slow"
(equivalently 0.5)"slow"
(equivalently 0.64)"medium"
(equivalently 1, default value)"fast"
(equivalently 1.55)"x-fast"
(equivalently 2)silent
” (equivalently 0)x-soft
” (equivalently 20)soft
” (equivalently 40)medium
” (equivalently 60)loud
” (equivalently 80)x-loud
” (equivalently 100, default value)"x-low"
"low"
"medium"
"high"
"x-high"
Show properties
Show properties
"pcm_s16le"
is supported.Show properties
"balanced"
reduces latency, but may be less stable.llm_response_handler
). Allows you to define custom data related to the user or session. Must be JSON serializable.true
.0.5
.0
.0.5
.1
.