Spaces:
Sleeping
Sleeping
File size: 1,126 Bytes
c96b98a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | from typing import Optional, Any, Dict
from pydantic import BaseModel, ConfigDict
class WorkflowSession(BaseModel):
"""Workflow Session that is stored in the database"""
# Session UUID
session_id: str
# ID of the workflow that this session is associated with
workflow_id: Optional[str] = None
# ID of the user interacting with this workflow
user_id: Optional[str] = None
# Workflow Memory
memory: Optional[Dict[str, Any]] = None
# Workflow Metadata
workflow_data: Optional[Dict[str, Any]] = None
# User Metadata
user_data: Optional[Dict[str, Any]] = None
# Session Metadata
session_data: Optional[Dict[str, Any]] = None
# The Unix timestamp when this session was created
created_at: Optional[int] = None
# The Unix timestamp when this session was last updated
updated_at: Optional[int] = None
model_config = ConfigDict(from_attributes=True)
def monitoring_data(self) -> Dict[str, Any]:
return self.model_dump()
def telemetry_data(self) -> Dict[str, Any]:
return self.model_dump(include={"created_at", "updated_at"})
|