johnbridges commited on
Commit
46c2685
·
1 Parent(s): 4cb71cc
Files changed (1) hide show
  1. models.py +9 -8
models.py CHANGED
@@ -77,8 +77,11 @@ class UserInfo(BaseModel):
77
  # JsonIgnore MonitorIPs in C#: we do not include it here
78
 
79
 
80
- # ---------- LLMServiceObj (field names match C# exactly) ----------
81
  class LLMServiceObj(BaseModel):
 
 
 
82
  # strings
83
  SessionId: str = ""
84
  JsonFunction: str = ""
@@ -106,27 +109,25 @@ class LLMServiceObj(BaseModel):
106
  IsSystemLlm: bool = False
107
  Timeout: Optional[int] = None
108
 
109
- # complex
110
  FunctionCallId: str = ""
111
- FunctionCallData: FunctionCallData = Field(default_factory=FunctionCallData)
112
- UserInfo: UserInfo = Field(default_factory=UserInfo)
113
  StartTimeUTC: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
114
 
115
- # stacks (arrays; C# Stack<T> will deserialize fine)
116
  LlmStack: List[str] = Field(default_factory=list)
117
  FunctionCallIdStack: List[str] = Field(default_factory=list)
118
  FunctionNameStack: List[str] = Field(default_factory=list)
119
  IsProcessedStack: List[bool] = Field(default_factory=list)
120
  MessageIDStack: List[str] = Field(default_factory=list)
121
 
122
- # function state flags (C# stores in FunctionState; we expose flat flags like your class does)
123
  IsFunctionCall: bool = False
124
  IsFunctionCallResponse: bool = False
125
  IsFunctionCallError: bool = False
126
  IsFunctionCallStatus: bool = False
127
  IsFunctionStillRunning: bool = False
128
-
129
-
130
  # ---------- ResultObj (from your C#) ----------
131
  class ResultObj(BaseModel):
132
  Message: str = ""
 
77
  # JsonIgnore MonitorIPs in C#: we do not include it here
78
 
79
 
80
+
81
  class LLMServiceObj(BaseModel):
82
+ # allow using field names or aliases
83
+ model_config = ConfigDict(populate_by_name=True)
84
+
85
  # strings
86
  SessionId: str = ""
87
  JsonFunction: str = ""
 
109
  IsSystemLlm: bool = False
110
  Timeout: Optional[int] = None
111
 
112
+ # complex (rename attrs; keep JSON names via alias)
113
  FunctionCallId: str = ""
114
+ function_call_data: FunctionCallData = Field(default_factory=FunctionCallData, alias="FunctionCallData")
115
+ user_info: UserInfo = Field(default_factory=UserInfo, alias="UserInfo")
116
  StartTimeUTC: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
117
 
118
+ # stacks
119
  LlmStack: List[str] = Field(default_factory=list)
120
  FunctionCallIdStack: List[str] = Field(default_factory=list)
121
  FunctionNameStack: List[str] = Field(default_factory=list)
122
  IsProcessedStack: List[bool] = Field(default_factory=list)
123
  MessageIDStack: List[str] = Field(default_factory=list)
124
 
125
+ # function state flags
126
  IsFunctionCall: bool = False
127
  IsFunctionCallResponse: bool = False
128
  IsFunctionCallError: bool = False
129
  IsFunctionCallStatus: bool = False
130
  IsFunctionStillRunning: bool = False
 
 
131
  # ---------- ResultObj (from your C#) ----------
132
  class ResultObj(BaseModel):
133
  Message: str = ""