Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add agent event if agentName in metadata #44

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions lunary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,25 @@ def on_llm_start(
params = filter_params(params)
input = _parse_input(prompts)

agentName = metadata.get("agentName")

if agentName is not None:
self.__track_event(
"agent",
"start",
user_id=user_id,
run_id=run_id_str,
Copy link
Author

@shaw-matt shaw-matt May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern is this run_id will be the same as the regular 'llm' event that is tracked on the chat model start

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this is a problem as it will break the traces. I'll see what I can do to avoid that

parent_run_id=parent_run_id,
name=name,
input=input,
tags=tags,
metadata=metadata,
params=params,
user_props=user_props,
app_id=self.__app_id,
callback_queue=self.queue
)

self.__track_event(
"llm",
"start",
Expand Down