Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration tests #9

Merged
merged 12 commits into from
May 3, 2024
Merged

Add integration tests #9

merged 12 commits into from
May 3, 2024

Conversation

BespalovSergey
Copy link
Collaborator

No description provided.

Comment on lines 39 to 69
def single_llama_index_test():
"""Test example single_llama_index"""

function_name = inspect.stack()[0][3]
search_tool = DuckDuckGoSearchRun()
researcher = ReActLlamaIndexMotleyAgent(
goal="Uncover cutting-edge developments in AI and data science",
tools=[search_tool],
verbose=True,
)
crew = MotleyCrew()
# Create tasks for your agents
task1 = Task(
crew=crew,
name="produce comprehensive analysis report on AI advancements",
description="""Conduct a comprehensive analysis of the latest advancements in AI in 2024.
Identify key trends, breakthrough technologies, and potential industry impacts.
Your final answer MUST be a full analysis report""",
agent=researcher,
documents=["paper1.pdf", "paper2.pdf"],
)

# Instantiate your crew with a sequential process
result = crew.run(
agents=[researcher],
verbose=2, # You can set it to 1 or 2 to different logging levels
)

content = list(result._done)[0].outputs[0].response
excepted_content = read_content(function_name)
comparison_results(content, excepted_content)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's import the code from examples (isolating it to a function returning agent output) and call it from here, instead of duplicating

comparison_results(content, excepted_content)


def comparison_results(result: str, excepted_result: str) -> list:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call it compare_results

return f_o.read()


def find_tests_functions():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def find_tests_functions():
def find_test_functions():

return diff


def build_excepted_content_file_path(function_name: str, extension: str = "txt") -> str:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename function_name to test_name

@whimo whimo merged commit 002dc3e into main May 3, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants