Fixing telemetry condition that was missing

This commit is contained in:
João Moura
2024-08-11 22:07:45 -03:00
parent e9fa2bb556
commit 44e38b1d5e

View File

@@ -98,6 +98,7 @@ class Telemetry:
self._add_attribute(span, "crew_memory", crew.memory)
self._add_attribute(span, "crew_number_of_tasks", len(crew.tasks))
self._add_attribute(span, "crew_number_of_agents", len(crew.agents))
if crew.share_crew:
self._add_attribute(
span,
"crew_agents",
@@ -113,10 +114,13 @@ class Telemetry:
"max_iter": agent.max_iter,
"max_rpm": agent.max_rpm,
"i18n": agent.i18n.prompt_file,
"llm": json.dumps(self._safe_llm_attributes(agent.llm)),
"llm": json.dumps(
self._safe_llm_attributes(agent.llm)
),
"delegation_enabled?": agent.allow_delegation,
"tools_names": [
tool.name.casefold() for tool in agent.tools or []
tool.name.casefold()
for tool in agent.tools or []
],
}
for agent in crew.agents
@@ -135,7 +139,9 @@ class Telemetry:
"expected_output": task.expected_output,
"async_execution?": task.async_execution,
"human_input?": task.human_input,
"agent_role": task.agent.role if task.agent else "None",
"agent_role": task.agent.role
if task.agent
else "None",
"agent_key": task.agent.key if task.agent else None,
"context": (
[task.description for task in task.context]
@@ -143,7 +149,8 @@ class Telemetry:
else None
),
"tools_names": [
tool.name.casefold() for tool in task.tools or []
tool.name.casefold()
for tool in task.tools or []
],
}
for task in crew.tasks
@@ -155,8 +162,6 @@ class Telemetry:
self._add_attribute(span, "platform_system", platform.system())
self._add_attribute(span, "platform_version", platform.version())
self._add_attribute(span, "cpus", os.cpu_count())
if crew.share_crew:
self._add_attribute(
span, "crew_inputs", json.dumps(inputs) if inputs else None
)