@@ -139,7 +139,7 @@ def _choose_llm(self) -> BaseChatModel:
139139 base_url = settings .AZURE_API_BASE ,
140140 api_version = settings .AZURE_API_VERSION ,
141141 azure_deployment = settings .AZURE_DEPLOYMENT_NAME ,
142- api_key = settings .AZURE_OPENAI_API_KEY ,
142+ api_key = settings .AZURE_OPENAI_API_KEY , # type: ignore
143143 max_retries = settings .MAX_RETRY ,
144144 timeout = settings .REQUEST_TIMEOUT ,
145145 ) # type: ignore
@@ -148,7 +148,7 @@ def _choose_llm(self) -> BaseChatModel:
148148
149149 return ChatOpenAI (
150150 model = settings .MODEL ,
151- api_key = settings .OPENAI_API_KEY ,
151+ api_key = settings .OPENAI_API_KEY , # type: ignore
152152 timeout = settings .REQUEST_TIMEOUT ,
153153 temperature = settings .TEMPERATURE ,
154154 max_retries = settings .MAX_RETRY ,
@@ -192,7 +192,7 @@ def _choose_agent(self) -> BaseSingleActionAgent:
192192
193193 def _history_backend (self ) -> BaseChatMessageHistory :
194194 return (
195- CodeBoxChatMessageHistory (codebox = self .codebox )
195+ CodeBoxChatMessageHistory (codebox = self .codebox ) # type: ignore
196196 if settings .HISTORY_BACKEND == "codebox"
197197 else RedisChatMessageHistory (
198198 session_id = str (self .session_id ),
@@ -263,7 +263,7 @@ def _run_handler(self, code: str) -> str:
263263 if self .verbose :
264264 print ("Error:" , output .content )
265265
266- elif modifications := get_file_modifications (code , self .llm ):
266+ elif modifications := get_file_modifications (code , self .llm ): # type: ignore
267267 for filename in modifications :
268268 if filename in [file .name for file in self .input_files ]:
269269 continue
@@ -426,8 +426,8 @@ def generate_response(
426426 try :
427427 self ._input_handler (user_request )
428428 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" ] )
431431 except Exception as e :
432432 if self .verbose :
433433 traceback .print_exc ()
@@ -452,8 +452,10 @@ async def agenerate_response(
452452 try :
453453 await self ._ainput_handler (user_request )
454454 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" ])
457459 except Exception as e :
458460 if self .verbose :
459461 traceback .print_exc ()
0 commit comments