-
Notifications
You must be signed in to change notification settings - Fork 79
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
Expectations #596
Merged
Merged
Expectations #596
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hinthornw
force-pushed
the
wfh/expectations
branch
4 times, most recently
from
April 11, 2024 01:49
acad86e
to
3a6406e
Compare
hinthornw
force-pushed
the
wfh/expectations
branch
3 times, most recently
from
April 11, 2024 02:16
c10dbe9
to
2a269bc
Compare
hinthornw
force-pushed
the
wfh/expectations
branch
from
April 11, 2024 02:18
2a269bc
to
9958e4b
Compare
hinthornw
commented
Apr 11, 2024
python/langsmith/_testing.py
Outdated
@@ -114,13 +114,13 @@ def unit(*args: Any, **kwargs: Any) -> Callable: | |||
Caching is faster if you install libyaml. See | |||
https://vcrpy.readthedocs.io/en/latest/installation.html#speed for more details. | |||
|
|||
>>> os.environ["LANGCHAIN_TEST_CACHE"] = "tests/cassettes" | |||
>>> # os.environ["LANGCHAIN_TEST_CACHE"] = "tests/cassettes" |
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.
It's playing funky with doctest - looking into it more tonight
hinthornw
commented
Apr 11, 2024
hinthornw
force-pushed
the
wfh/expectations
branch
from
April 11, 2024 23:15
9427646
to
75129f2
Compare
rlancemartin
approved these changes
Apr 12, 2024
hinthornw
added a commit
that referenced
this pull request
Apr 12, 2024
- [x] change default dataset creation (should be unique per file) - [x] change env vars to use `LANGSMITH_` prefix Want feedback on: - [x] ergonomics: is this a general UX we want to support - [x] imports: should i re-implement string, embedding distance, etc.? - [x] Do we want default implementations? - [x] Any other we ought to include at the outset? - [x] I could also do a general `expect(value).is(...)` or something: want anything super generic like that? Example: ```python @Unit(inputs=x, outputs=y) def test_output_semantically_close(): response = oai_client.chat.completions.create( model="gpt-3.5-turbo", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Say hello!"}, ], ) # The embedding_distance call logs the embedding distance to LangSmith expect.embedding_distance( prediction=response.choices[0].message.content, reference="Hello!", # The following optional assertion logs a # pass/fail score to LangSmith # and raises an AssertionError if the assertion fails. ).to_be_less_than(0.5) # Compute damerau_levenshtein distance expect.string_distance( prediction=response.choices[0].message.content, reference="Hello!", # And then log a pass/fail score to LangSmith ).to_be_less_than(0.5) ``` The idea is it's still an easy onramp for developers to quickly write some scoring functions and get it running regularly in CI
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
change default dataset creation (should be unique per file)
change env vars to use
LANGSMITH_
prefixWant feedback on:
ergonomics: is this a general UX we want to support
imports: should i re-implement string, embedding distance, etc.?
Do we want default implementations?
Any other we ought to include at the outset?
I could also do a general
expect(value).is(...)
or something: want anything super generic like that?Example:
The idea is it's still an easy onramp for developers to quickly write some scoring functions and get it running regularly in CI