Skip to content

Commit 332474b

Browse files
authored
Remove individual runtime printing from progress messages (#723)
- Removed runtime display from Agent._format_agent_progress method - Removed runtime display from TeamAgent._format_team_progress method - Total execution time is still displayed in completion messages
1 parent 851a47b commit 332474b

File tree

2 files changed

+37
-42
lines changed

2 files changed

+37
-42
lines changed

aixplain/modules/agent/__init__.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,6 @@ def _format_agent_progress(
393393
if tool:
394394
msg = f"⚙️ {agent_name} | {tool} | {status_icon}"
395395

396-
if runtime is not None and runtime > 0 and success is not None:
397-
msg += f" ({runtime:.1f} s)"
398-
399396
if tool_input:
400397
msg += f" | Input: {tool_input}"
401398

@@ -604,27 +601,27 @@ def run(
604601
Dict: parsed output from model
605602
"""
606603
start = time.time()
607-
604+
608605
# Extract deprecated parameters from kwargs
609606
output_format = kwargs.get("output_format", None)
610607
expected_output = kwargs.get("expected_output", None)
611-
608+
612609
if output_format is not None:
613610
warnings.warn(
614611
"The 'output_format' parameter is deprecated and will be removed in a future version. "
615612
"Set the output format during agent initialization instead.",
616613
DeprecationWarning,
617614
stacklevel=2,
618615
)
619-
616+
620617
if expected_output is not None:
621618
warnings.warn(
622619
"The 'expected_output' parameter is deprecated and will be removed in a future version. "
623620
"Set the expected output during agent initialization instead.",
624621
DeprecationWarning,
625622
stacklevel=2,
626623
)
627-
624+
628625
if session_id is not None and history is not None:
629626
raise ValueError("Provide either `session_id` or `history`, not both.")
630627

@@ -661,7 +658,7 @@ def run(
661658
poll_url, name=name, timeout=timeout, wait_time=wait_time, progress_verbosity=progress_verbosity
662659
)
663660
if result.status == ResponseStatus.FAILED:
664-
raise Exception("Model failed to run with error: " + result.error_message)
661+
raise Exception("Model failed to run with error: " + result.error_message)
665662
result_data = result.get("data") or {}
666663
return AgentResponse(
667664
status=ResponseStatus.SUCCESS,

aixplain/modules/team_agent/__init__.py

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class TeamAgent(Model, DeployableMixin[Agent]):
103103
instructions (Optional[Text]): Instructions to guide the team agent.
104104
output_format (OutputFormat): Response format. Defaults to TEXT.
105105
expected_output (Optional[Union[BaseModel, Text, dict]]): Expected output format.
106-
106+
107107
Deprecated Attributes:
108108
llm_id (Text): DEPRECATED. Use 'llm' parameter instead. Large language model ID.
109109
mentalist_llm (Optional[LLM]): DEPRECATED. LLM for planning.
@@ -132,6 +132,32 @@ def __init__(
132132
expected_output: Optional[Union[BaseModel, Text, dict]] = None,
133133
**additional_info,
134134
) -> None:
135+
"""Initialize a TeamAgent instance.
136+
137+
Args:
138+
id (Text): Unique identifier for the team agent.
139+
name (Text): Name of the team agent.
140+
agents (List[Agent], optional): List of agents in the team. Defaults to [].
141+
description (Text, optional): Description of the team agent. Defaults to "".
142+
llm (Optional[LLM], optional): LLM instance. Defaults to None.
143+
supervisor_llm (Optional[LLM], optional): Supervisor LLM instance. Defaults to None.
144+
api_key (Optional[Text], optional): API key. Defaults to config.TEAM_API_KEY.
145+
supplier (Union[Dict, Text, Supplier, int], optional): Supplier. Defaults to "aiXplain".
146+
version (Optional[Text], optional): Version. Defaults to None.
147+
cost (Optional[Dict], optional): Cost information. Defaults to None.
148+
inspectors (List[Inspector], optional): List of inspectors. Defaults to [].
149+
inspector_targets (List[InspectorTarget], optional): Inspector targets. Defaults to [InspectorTarget.STEPS].
150+
status (AssetStatus, optional): Status of the team agent. Defaults to AssetStatus.DRAFT.
151+
instructions (Optional[Text], optional): Instructions for the team agent. Defaults to None.
152+
output_format (OutputFormat, optional): Output format. Defaults to OutputFormat.TEXT.
153+
expected_output (Optional[Union[BaseModel, Text, dict]], optional): Expected output format. Defaults to None.
154+
**additional_info: Additional keyword arguments.
155+
156+
Deprecated Args:
157+
llm_id (Text, optional): DEPRECATED. Use 'llm' parameter instead. ID of the language model. Defaults to "6646261c6eb563165658bbb1".
158+
mentalist_llm (Optional[LLM], optional): DEPRECATED. Mentalist/Planner LLM instance. Defaults to None.
159+
use_mentalist (bool, optional): DEPRECATED. Whether to use mentalist/planner. Defaults to True.
160+
"""
135161
# Handle deprecated parameters from kwargs
136162
if "llm_id" in additional_info:
137163
llm_id = additional_info.pop("llm_id")
@@ -143,7 +169,7 @@ def __init__(
143169
)
144170
else:
145171
llm_id = "6646261c6eb563165658bbb1"
146-
172+
147173
if "mentalist_llm" in additional_info:
148174
mentalist_llm = additional_info.pop("mentalist_llm")
149175
warnings.warn(
@@ -153,7 +179,7 @@ def __init__(
153179
)
154180
else:
155181
mentalist_llm = None
156-
182+
157183
if "use_mentalist" in additional_info:
158184
use_mentalist = additional_info.pop("use_mentalist")
159185
warnings.warn(
@@ -164,32 +190,6 @@ def __init__(
164190
else:
165191
use_mentalist = True
166192

167-
"""Initialize a TeamAgent instance.
168-
169-
Args:
170-
id (Text): Unique identifier for the team agent.
171-
name (Text): Name of the team agent.
172-
agents (List[Agent], optional): List of agents in the team. Defaults to [].
173-
description (Text, optional): Description of the team agent. Defaults to "".
174-
llm (Optional[LLM], optional): LLM instance. Defaults to None.
175-
supervisor_llm (Optional[LLM], optional): Supervisor LLM instance. Defaults to None.
176-
api_key (Optional[Text], optional): API key. Defaults to config.TEAM_API_KEY.
177-
supplier (Union[Dict, Text, Supplier, int], optional): Supplier. Defaults to "aiXplain".
178-
version (Optional[Text], optional): Version. Defaults to None.
179-
cost (Optional[Dict], optional): Cost information. Defaults to None.
180-
inspectors (List[Inspector], optional): List of inspectors. Defaults to [].
181-
inspector_targets (List[InspectorTarget], optional): Inspector targets. Defaults to [InspectorTarget.STEPS].
182-
status (AssetStatus, optional): Status of the team agent. Defaults to AssetStatus.DRAFT.
183-
instructions (Optional[Text], optional): Instructions for the team agent. Defaults to None.
184-
output_format (OutputFormat, optional): Output format. Defaults to OutputFormat.TEXT.
185-
expected_output (Optional[Union[BaseModel, Text, dict]], optional): Expected output format. Defaults to None.
186-
**additional_info: Additional keyword arguments.
187-
188-
Deprecated Args:
189-
llm_id (Text, optional): DEPRECATED. Use 'llm' parameter instead. ID of the language model. Defaults to "6646261c6eb563165658bbb1".
190-
mentalist_llm (Optional[LLM], optional): DEPRECATED. Mentalist/Planner LLM instance. Defaults to None.
191-
use_mentalist (bool, optional): DEPRECATED. Whether to use mentalist/planner. Defaults to True.
192-
"""
193193
super().__init__(id, name, description, api_key, supplier, version, cost=cost)
194194
self.additional_info = additional_info
195195
self.agents = agents
@@ -369,9 +369,6 @@ def _format_team_progress(
369369
# Full verbosity: detailed info
370370
msg = f"{emoji} {context} | {status_icon}"
371371

372-
if runtime is not None and runtime > 0 and success is not None:
373-
msg += f" ({runtime:.1f} s)"
374-
375372
if current_step and total_steps:
376373
msg += f" | Step {current_step}/{total_steps}"
377374

@@ -576,6 +573,7 @@ def run(
576573
max_iterations (int, optional): maximum number of iterations between the agents. Defaults to 30.
577574
trace_request (bool, optional): return the request id for tracing the request. Defaults to False.
578575
progress_verbosity (Optional[str], optional): Progress display mode - "full" (detailed), "compact" (brief), or None (no progress). Defaults to "compact".
576+
**kwargs: Additional deprecated keyword arguments (output_format, expected_output).
579577
580578
Returns:
581579
AgentResponse: parsed output from model
@@ -589,7 +587,7 @@ def run(
589587
DeprecationWarning,
590588
stacklevel=2,
591589
)
592-
590+
593591
expected_output = kwargs.pop("expected_output", None)
594592
if expected_output is not None:
595593
warnings.warn(
@@ -598,7 +596,7 @@ def run(
598596
DeprecationWarning,
599597
stacklevel=2,
600598
)
601-
599+
602600
start = time.time()
603601
result_data = {}
604602
if session_id is not None and history is not None:

0 commit comments

Comments
 (0)