feat: move keepalive to an arg (#3652)
This commit is contained in:
@@ -42,6 +42,10 @@ class LettaStreamingRequest(LettaRequest):
|
||||
default=False,
|
||||
description="Flag to determine if individual tokens should be streamed. Set to True for token streaming (requires stream_steps = True).",
|
||||
)
|
||||
include_pings: bool = Field(
|
||||
default=False,
|
||||
description="Whether to include periodic keepalive ping messages in the stream to prevent connection timeouts.",
|
||||
)
|
||||
|
||||
|
||||
class LettaAsyncRequest(LettaRequest):
|
||||
|
||||
@@ -1071,8 +1071,8 @@ async def send_message_streaming(
|
||||
request_start_timestamp_ns=request_start_timestamp_ns,
|
||||
include_return_message_types=request.include_return_message_types,
|
||||
)
|
||||
# Conditionally wrap with keepalive based on settings
|
||||
if settings.enable_keepalive:
|
||||
# Conditionally wrap with keepalive based on request parameter
|
||||
if request.include_pings and settings.enable_keepalive:
|
||||
stream = add_keepalive_to_stream(raw_stream, keepalive_interval=settings.keepalive_interval)
|
||||
else:
|
||||
stream = raw_stream
|
||||
@@ -1089,8 +1089,8 @@ async def send_message_streaming(
|
||||
request_start_timestamp_ns=request_start_timestamp_ns,
|
||||
include_return_message_types=request.include_return_message_types,
|
||||
)
|
||||
# Conditionally wrap with keepalive based on settings
|
||||
if settings.enable_keepalive:
|
||||
# Conditionally wrap with keepalive based on request parameter
|
||||
if request.include_pings and settings.enable_keepalive:
|
||||
stream = add_keepalive_to_stream(raw_stream, keepalive_interval=settings.keepalive_interval)
|
||||
else:
|
||||
stream = raw_stream
|
||||
|
||||
Reference in New Issue
Block a user