mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-26 08:38:15 +00:00
linted
This commit is contained in:
@@ -272,9 +272,6 @@ class CrewAgentExecutor(CrewAgentExecutorMixin):
|
|||||||
response_model=self.response_model,
|
response_model=self.response_model,
|
||||||
executor_context=self,
|
executor_context=self,
|
||||||
)
|
)
|
||||||
print("--------------------------------")
|
|
||||||
print("get_llm_response answer", answer)
|
|
||||||
print("--------------------------------")
|
|
||||||
# breakpoint()
|
# breakpoint()
|
||||||
if self.response_model is not None:
|
if self.response_model is not None:
|
||||||
try:
|
try:
|
||||||
@@ -375,9 +372,6 @@ class CrewAgentExecutor(CrewAgentExecutorMixin):
|
|||||||
Returns:
|
Returns:
|
||||||
Final answer from the agent.
|
Final answer from the agent.
|
||||||
"""
|
"""
|
||||||
print("--------------------------------")
|
|
||||||
print("invoke_loop_native_tools")
|
|
||||||
print("--------------------------------")
|
|
||||||
# Convert tools to OpenAI schema format
|
# Convert tools to OpenAI schema format
|
||||||
if not self.original_tools:
|
if not self.original_tools:
|
||||||
# No tools available, fall back to simple LLM call
|
# No tools available, fall back to simple LLM call
|
||||||
@@ -403,21 +397,6 @@ class CrewAgentExecutor(CrewAgentExecutorMixin):
|
|||||||
|
|
||||||
enforce_rpm_limit(self.request_within_rpm_limit)
|
enforce_rpm_limit(self.request_within_rpm_limit)
|
||||||
|
|
||||||
# Debug: Show messages being sent to LLM
|
|
||||||
print("--------------------------------")
|
|
||||||
print(f"Messages count: {len(self.messages)}")
|
|
||||||
for i, msg in enumerate(self.messages):
|
|
||||||
role = msg.get("role", "unknown")
|
|
||||||
content = msg.get("content", "")
|
|
||||||
if content:
|
|
||||||
preview = (
|
|
||||||
content[:200] + "..." if len(content) > 200 else content
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
preview = "(no content)"
|
|
||||||
print(f" [{i}] {role}: {preview}")
|
|
||||||
print("--------------------------------")
|
|
||||||
|
|
||||||
# Call LLM with native tools
|
# Call LLM with native tools
|
||||||
# Pass available_functions=None so the LLM returns tool_calls
|
# Pass available_functions=None so the LLM returns tool_calls
|
||||||
# without executing them. The executor handles tool execution
|
# without executing them. The executor handles tool execution
|
||||||
@@ -434,10 +413,6 @@ class CrewAgentExecutor(CrewAgentExecutorMixin):
|
|||||||
response_model=self.response_model,
|
response_model=self.response_model,
|
||||||
executor_context=self,
|
executor_context=self,
|
||||||
)
|
)
|
||||||
print("--------------------------------")
|
|
||||||
print("invoke_loop_native_tools answer", answer)
|
|
||||||
print("--------------------------------")
|
|
||||||
# print("get_llm_response answer", answer[:500] + "...")
|
|
||||||
|
|
||||||
# Check if the response is a list of tool calls
|
# Check if the response is a list of tool calls
|
||||||
if (
|
if (
|
||||||
@@ -649,7 +624,6 @@ class CrewAgentExecutor(CrewAgentExecutorMixin):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Execute the tool
|
# Execute the tool
|
||||||
print(f"Using Tool: {func_name}")
|
|
||||||
result = "Tool not found"
|
result = "Tool not found"
|
||||||
if func_name in available_functions:
|
if func_name in available_functions:
|
||||||
try:
|
try:
|
||||||
@@ -931,10 +905,6 @@ class CrewAgentExecutor(CrewAgentExecutorMixin):
|
|||||||
response_model=self.response_model,
|
response_model=self.response_model,
|
||||||
executor_context=self,
|
executor_context=self,
|
||||||
)
|
)
|
||||||
print("--------------------------------")
|
|
||||||
print("native llm completion answer", answer)
|
|
||||||
print("--------------------------------")
|
|
||||||
|
|
||||||
# Check if the response is a list of tool calls
|
# Check if the response is a list of tool calls
|
||||||
if (
|
if (
|
||||||
isinstance(answer, list)
|
isinstance(answer, list)
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ from collections.abc import Callable, Coroutine
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import json
|
import json
|
||||||
import threading
|
import threading
|
||||||
import time
|
|
||||||
from typing import TYPE_CHECKING, Any, Literal, cast
|
from typing import TYPE_CHECKING, Any, Literal, cast
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
@@ -330,12 +329,8 @@ class AgentExecutor(Flow[AgentReActState], CrewAgentExecutorMixin):
|
|||||||
Returns routing decision based on parsing result.
|
Returns routing decision based on parsing result.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
iteration_start = time.time()
|
|
||||||
|
|
||||||
enforce_rpm_limit(self.request_within_rpm_limit)
|
enforce_rpm_limit(self.request_within_rpm_limit)
|
||||||
|
|
||||||
llm_start = time.time()
|
|
||||||
|
|
||||||
answer = get_llm_response(
|
answer = get_llm_response(
|
||||||
llm=self.llm,
|
llm=self.llm,
|
||||||
messages=list(self.state.messages),
|
messages=list(self.state.messages),
|
||||||
|
|||||||
Reference in New Issue
Block a user