Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion examples/python/gateway_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,34 @@
from praisonaiagents import Agent, GatewayConfig, SessionConfig

# Configure the gateway
from pydantic import BaseModel, Field

class ServerConfig(BaseModel):
host: str = "0.0.0.0"
port: int = 8000
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
drain_timeout: int = 30
reload_drain_timeout: int = 60
max_connections: int = 1000
heartbeat_interval: int = 30

class GatewayConfig:
def __init__(self, host="0.0.0.0", port=8000, drain_timeout=30, reload_drain_timeout=60, max_connections=1000, heartbeat_interval=30, session_config=None):
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Outdated
self.host = host
self.port = port
self.drain_timeout = drain_timeout
self.reload_drain_timeout = reload_drain_timeout
self.max_connections = max_connections
self.heartbeat_interval = heartbeat_interval
self.session_config = session_config or SessionConfig()
self.ws_url = f"ws://{self.host}:{self.port}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Redefining GatewayConfig and ServerConfig directly inside the example file shadows the imported GatewayConfig from praisonaiagents (imported on line 8) and does not actually update the library's configuration. The Pydantic validation model ServerConfig and the updated GatewayConfig should be implemented in the library itself (specifically in src/praisonai-agents/praisonaiagents/gateway/config.py), and this example file should only import and use them.

gateway_config = GatewayConfig(
host="127.0.0.1",
port=8765,
max_connections=100,
heartbeat_interval=30,
session_config=SessionConfig(
timeout=3600, # 1 hour session timeout
timeout=3600,
max_messages=500,
)
)
Expand Down
Loading