Find answers from the community

Updated 2 months ago

i am getting `error: TypeError:

i am getting error: TypeError: FunctionTool.from_defaults() missing 1 required positional argument: 'fn'
my methods are Async functions so they need to be await

pick_func = FunctionTool.from_defaults(async_fn=flight_service.create_pickup_flight_alert)
any idea why the error is up?
m
L
7 comments
ok, the fn argument is requered.. but how i pass my async func , now i made it work but it took 20 seconds to finish and i got this :
RuntimeWarning: coroutine 'FlightStatesAPI.create_pickup_flight_alert' was never awaited
Did you pass an actual synchronous function?
fn is sync, async_fn is async
Plain Text
def create_pickup_flight_alert(..):
  """<DOCSTRING>"""
  return asyncio.run(flight_service.create_pickup_flight_alert)

pick_func = FunctionTool.from_defaults(
  fn=create_pickup_flight_alert,
  async_fn=flight_service.create_pickup_flight_alert
)
ok i will try this,
i have done it, it's working like u said
Add a reply
Sign up and join the conversation on Discord