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 tests for tools #209

Merged
merged 38 commits into from
Apr 16, 2024
Merged

Add tests for tools #209

merged 38 commits into from
Apr 16, 2024

Conversation

0xArdi
Copy link
Collaborator

@0xArdi 0xArdi commented Apr 8, 2024

This PR adds tests for tools.
To run the tests, you can use:

tox -e check-tools

or alternatively:

pytest tests/

Base automatically changed from fix/tools to main April 8, 2024 15:05
@cyberosa cyberosa self-assigned this Apr 16, 2024
return response

if self.llm_provider == "openrouter":
# TODO investigate the transform parameter https://openrouter.ai/docs#transforms
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can remove already this comment

):
results.append(url)
except Exception:
pass
unique_results = list(set(results))
Copy link
Collaborator

Choose a reason for hiding this comment

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

what if all queries fail and you have no urls?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not they ever all fail

Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't seen it happen at least



def extract_texts(urls: List[str], num_words: Optional[int] = None) -> List[Document]:
"""Extract texts from URLs with improved error handling, excluding failed URLs."""
extracted_texts = []
Copy link
Collaborator

Choose a reason for hiding this comment

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

if the list of urls is empty then there is nothing to batch, you could return an empty list and avoid the loop

Copy link
Contributor

Choose a reason for hiding this comment

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

Would this make a difference if the loop is for len(urls).
I'm going to leave this out for now for code clarity since I don't think the list is ever empty.



class TestPredictionCOT(BaseToolTest):
"""Test Prediction RAG."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess you mean Test Prediction COT

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

why deleted?

Copy link
Contributor

Choose a reason for hiding this comment

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

The whole tool has been deleted. Claude can now be used in prediction_request_rag.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

same

@0xArdi 0xArdi merged commit 7a3a480 into main Apr 16, 2024
7 checks passed
@0xArdi 0xArdi deleted the chore/tool-tests branch April 16, 2024 13:54
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.

4 participants