@@ -139,7 +139,7 @@ def _choose_llm(self) -> BaseChatModel:
139
139
base_url = settings .AZURE_API_BASE ,
140
140
api_version = settings .AZURE_API_VERSION ,
141
141
azure_deployment = settings .AZURE_DEPLOYMENT_NAME ,
142
- api_key = settings .AZURE_OPENAI_API_KEY ,
142
+ api_key = settings .AZURE_OPENAI_API_KEY , # type: ignore
143
143
max_retries = settings .MAX_RETRY ,
144
144
timeout = settings .REQUEST_TIMEOUT ,
145
145
) # type: ignore
@@ -148,7 +148,7 @@ def _choose_llm(self) -> BaseChatModel:
148
148
149
149
return ChatOpenAI (
150
150
model = settings .MODEL ,
151
- api_key = settings .OPENAI_API_KEY ,
151
+ api_key = settings .OPENAI_API_KEY , # type: ignore
152
152
timeout = settings .REQUEST_TIMEOUT ,
153
153
temperature = settings .TEMPERATURE ,
154
154
max_retries = settings .MAX_RETRY ,
@@ -192,7 +192,7 @@ def _choose_agent(self) -> BaseSingleActionAgent:
192
192
193
193
def _history_backend (self ) -> BaseChatMessageHistory :
194
194
return (
195
- CodeBoxChatMessageHistory (codebox = self .codebox )
195
+ CodeBoxChatMessageHistory (codebox = self .codebox ) # type: ignore
196
196
if settings .HISTORY_BACKEND == "codebox"
197
197
else RedisChatMessageHistory (
198
198
session_id = str (self .session_id ),
@@ -263,7 +263,7 @@ def _run_handler(self, code: str) -> str:
263
263
if self .verbose :
264
264
print ("Error:" , output .content )
265
265
266
- elif modifications := get_file_modifications (code , self .llm ):
266
+ elif modifications := get_file_modifications (code , self .llm ): # type: ignore
267
267
for filename in modifications :
268
268
if filename in [file .name for file in self .input_files ]:
269
269
continue
@@ -426,8 +426,8 @@ def generate_response(
426
426
try :
427
427
self ._input_handler (user_request )
428
428
assert self .agent_executor , "Session not initialized."
429
- response = self .agent_executor .run ( input = user_request .content )
430
- return self ._output_handler (response )
429
+ response = self .agent_executor .invoke ({ " input" : user_request .content } )
430
+ return self ._output_handler (response [ "output" ] )
431
431
except Exception as e :
432
432
if self .verbose :
433
433
traceback .print_exc ()
@@ -452,8 +452,10 @@ async def agenerate_response(
452
452
try :
453
453
await self ._ainput_handler (user_request )
454
454
assert self .agent_executor , "Session not initialized."
455
- response = await self .agent_executor .arun (input = user_request .content )
456
- return await self ._aoutput_handler (response )
455
+ response = await self .agent_executor .ainvoke (
456
+ {"input" : user_request .content }
457
+ )
458
+ return await self ._aoutput_handler (response ["output" ])
457
459
except Exception as e :
458
460
if self .verbose :
459
461
traceback .print_exc ()
0 commit comments