Skip to content

Commit

Permalink
ref: add tracer into the tracker object of the action call
Browse files Browse the repository at this point in the history
  • Loading branch information
souvikg10 committed Sep 25, 2023
1 parent d35b042 commit 5893d96
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
5 changes: 3 additions & 2 deletions rasa_sdk/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,14 @@ async def webhook(request: Request) -> HTTPResponse:
if action_call is None:
body = {"error": "Invalid body request"}
return response.json(body, status=400)

action_call["tracker"]["tracer"] = tracer
action_call["tracker"]["context"] = context
utils.check_version_compatibility(action_call.get("version"))

if auto_reload:
executor.reload()
try:
result = await executor.run(action_call, tracer, context)
result = await executor.run(action_call)
except ActionExecutionRejection as e:
logger.debug(e)
body = {"error": e.message, "action_name": e.action_name}
Expand Down
4 changes: 2 additions & 2 deletions rasa_sdk/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def validate_events(events: List[Dict[Text, Any]], action_name: Text):
# we won't append this to validated events -> will be ignored
return validated

async def run(self, action_call: "ActionCall", tracer: Optional[Any] = None, context: Optional[Any] = None) -> Optional[Dict[Text, Any]]:
async def run(self, action_call: "ActionCall") -> Optional[Dict[Text, Any]]:
from rasa_sdk.interfaces import Tracker

action_name = action_call.get("next_action")
Expand All @@ -397,7 +397,7 @@ async def run(self, action_call: "ActionCall", tracer: Optional[Any] = None, con
dispatcher = CollectingDispatcher()

events = await utils.call_potential_coroutine(
action(dispatcher, tracker, domain, tracer, context)
action(dispatcher, tracker, domain)
)

if not events:
Expand Down
4 changes: 1 addition & 3 deletions rasa_sdk/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,7 @@ async def run(
self,
dispatcher: "CollectingDispatcher",
tracker: Tracker,
domain: "DomainDict",
tracer: Optional[Any] = None,
context: Optional[Any] = None
domain: "DomainDict"
) -> List[Dict[Text, Any]]:
"""Execute the side effects of this action.
Expand Down

0 comments on commit 5893d96

Please sign in to comment.