This commit is contained in:
Brandon Hancock
2025-03-25 10:36:59 -04:00
parent defb0c55e6
commit fa15c5eb1d
9 changed files with 171 additions and 345 deletions

View File

@@ -4,62 +4,57 @@ from crewai.tools import BaseTool
# A simple test tool
class TestTool(BaseTool):
name = "test_tool"
description = "A simple test tool"
class SecretLookupTool(BaseTool):
name = "secret_lookup"
description = "A tool to lookup secrets"
def _run(self, query: str) -> str:
return f"Test result for: {query}"
def _run(self) -> str:
return "SUPERSECRETPASSWORD123"
# Test with tools
def test_with_tools():
llm = LLM(model="gpt-4o")
agent = LiteAgent(
role="Test Agent",
goal="Test the system prompt formatting",
backstory="I am a test agent created to verify the system prompt works correctly.",
role="Secret Agent",
goal="Return the secret password",
backstory="I am a secret agent created to return the secret password",
llm=llm,
tools=[TestTool()],
tools=[SecretLookupTool()],
verbose=True,
)
# Get the system prompt
system_prompt = agent._get_default_system_prompt()
print("\n=== System Prompt (with tools) ===")
print(system_prompt)
# Test a simple query
response = agent.kickoff("Hello, can you help me?")
print("\n=== Agent Response ===")
print(response)
# Test without tools
def test_without_tools():
llm = LLM(model="gpt-4o")
agent = LiteAgent(
role="Test Agent",
goal="Test the system prompt formatting",
backstory="I am a test agent created to verify the system prompt works correctly.",
llm=llm,
verbose=True,
)
# # Test without tools
# def test_without_tools():
# llm = LLM(model="gpt-4o")
# agent = LiteAgent(
# role="Test Agent",
# goal="Test the system prompt formatting",
# backstory="I am a test agent created to verify the system prompt works correctly.",
# llm=llm,
# verbose=True,
# )
# Get the system prompt
system_prompt = agent._get_default_system_prompt()
print("\n=== System Prompt (without tools) ===")
print(system_prompt)
# # Get the system prompt
# system_prompt = agent._get_default_system_prompt()
# print("\n=== System Prompt (without tools) ===")
# print(system_prompt)
# Test a simple query
response = agent.kickoff("Hello, can you help me?")
print("\n=== Agent Response ===")
print(response)
# # Test a simple query
# response = agent.kickoff("Hello, can you help me?")
# print("\n=== Agent Response ===")
# print(response)
if __name__ == "__main__":
print("Testing LiteAgent with tools...")
test_with_tools()
print("\n\nTesting LiteAgent without tools...")
test_without_tools()
# print("\n\nTesting LiteAgent without tools...")
# test_without_tools()