-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Python] Release W/ LLM Expectations (#596)
- [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
- Loading branch information
Showing
22 changed files
with
3,099 additions
and
3,515 deletions.
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.