-
Notifications
You must be signed in to change notification settings - Fork 59
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
Support Context Propagation #599
Merged
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
- [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
hinthornw
force-pushed
the
wfh/dt
branch
2 times, most recently
from
April 12, 2024 20:04
4ec1507
to
a6719e9
Compare
agola11
approved these changes
Apr 13, 2024
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 good but would remove all of the code that switches from Run to Span, that's a bigger change that we're going to need to coordinate with the UI and docs
agola11
reviewed
Apr 13, 2024
hinthornw
added a commit
that referenced
this pull request
Apr 15, 2024
Client Side: ``` async def the_parent_function(): async with AsyncClient(app=fake_app, base_url="http://localhost:8000") as client: headers = {} if span := get_current_span(): headers.update(span.to_headers()) return await client.post("/fake-route", headers=headers) ``` Server Side: ``` @fake_app.post("/fake-route") async def fake_route(request: Request): with tracing_context(headers=request.headers): fake_function() return {"message": "Fake route response"} ``` If people like, we could add some fun middleware, but probably not necessary
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.
Client Side:
Server Side:
If people like, we could add some fun middleware, but probably not necessary