mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-25 16:18:13 +00:00
WIP
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user