|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
import asyncio
|
|
|
|
import json
|
|
|
|
import json
|
|
|
|
from json import JSONDecodeError
|
|
|
|
from json import JSONDecodeError
|
|
|
|
from typing import List, Union
|
|
|
|
from typing import List, Union
|
|
|
@ -80,5 +81,12 @@ class OpenAIFunctionsAgentOutputParser(AgentOutputParser):
|
|
|
|
message = result[0].message
|
|
|
|
message = result[0].message
|
|
|
|
return self._parse_ai_message(message)
|
|
|
|
return self._parse_ai_message(message)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def aparse_result(
|
|
|
|
|
|
|
|
self, result: List[Generation]
|
|
|
|
|
|
|
|
) -> Union[AgentAction, AgentFinish]:
|
|
|
|
|
|
|
|
return await asyncio.get_running_loop().run_in_executor(
|
|
|
|
|
|
|
|
None, self.parse_result, result
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def parse(self, text: str) -> Union[AgentAction, AgentFinish]:
|
|
|
|
def parse(self, text: str) -> Union[AgentAction, AgentFinish]:
|
|
|
|
raise ValueError("Can only parse messages")
|
|
|
|
raise ValueError("Can only parse messages")
|
|
|
|