-
Notifications
You must be signed in to change notification settings - Fork 90
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
python[minor]: pytest integration #1362
base: main
Are you sure you want to change the base?
Conversation
I like the functionality. I kinda like using a single module/object to access the methods, like
or something |
This comment was marked as outdated.
This comment was marked as outdated.
I like |
This comment was marked as outdated.
This comment was marked as outdated.
why is it "reference" input vs target, expect, etc |
"reference outputs" is what we call this when defining evaluators for historically this decision was made bc target/expected seemed a bit too narrow/prescriptive when this can be any information relevant for evaluating outputs, not necessarily the actual expected outputs. eg could just be agent trajectories not actual agent outputs. but see the argument that target/expected are more common terms and it wasn't worth us introducing a new term for such a small nuance |
pytest_nodeid=pytest_nodeid, | ||
) | ||
|
||
def _end_run( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs review, very open to less hacky ideas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't think of any great solutions right now without async. Would add a detailed comment about this and address later as a TODO
|
||
@warn_beta | ||
@contextlib.contextmanager | ||
def trace_feedback( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worth review
) | ||
|
||
|
||
def _run_test( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worth review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks reasonable to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just one main comment
def end_run( | ||
self, run_tree, example_id, outputs, pytest_plugin=None, pytest_nodeid=None | ||
) -> Future: | ||
return self._executor.submit( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to submit this in an executor? run_tree.patch
calls update_run
which is async already
pytest_nodeid=pytest_nodeid, | ||
) | ||
|
||
def _end_run( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't think of any great solutions right now without async. Would add a detailed comment about this and address later as a TODO
) | ||
|
||
|
||
def _run_test( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks reasonable to me
Log pytest tests to LangSmith. Useful for:
Install
pip install "langsmith[pytest]==0.2.11rc7"
Simple usage
Run
pytest --outputs='ls' tests/test_foo.py
Results
Advanced usage
Run using pytest-xdist to parallelize (
pip install pytest-xdist first
)Results: https://dev.smith.langchain.com/public/cea0e7fd-2d27-47d1-8ada-141069acdf0d/d