Merge pull request #1059 from jlowin/await

Use isawaitable instead of iscoroutine
This commit is contained in:
Jeremiah Lowin 2025-07-06 12:11:28 -04:00 committed by GitHub
commit cbb8a0d110
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View file

@ -329,7 +329,7 @@ class FunctionPrompt(Prompt):
# Call function and check if result is a coroutine
result = self.fn(**kwargs)
if inspect.iscoroutine(result):
if inspect.isawaitable(result):
result = await result
# Validate messages

View file

@ -182,7 +182,7 @@ class FunctionResource(Resource):
kwargs[context_kwarg] = get_context()
result = self.fn(**kwargs)
if inspect.iscoroutinefunction(self.fn):
if inspect.isawaitable(result):
result = await result
if isinstance(result, Resource):

View file

@ -190,7 +190,7 @@ class FunctionResourceTemplate(ResourceTemplate):
kwargs[context_kwarg] = get_context()
result = self.fn(**kwargs)
if inspect.iscoroutine(result):
if inspect.isawaitable(result):
result = await result
return result