-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[OPIK-2787] [P SDK] GeneratorExit Error with LangGraph Integration #3986
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
Conversation
…er for LangChain integration - Introduced `skip_error_callback` to allow selective skipping of error outputs during trace handling. - Updated `OpikTracer` to incorporate conditional error handling based on the callback's result. - Enhanced error processing logic to handle skipped errors with placeholder outputs. - Added integration test `test_langchain_callback__skip_error_callback__error_output_skipped`.
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.
Pull Request Overview
This PR introduces selective error skipping functionality for the LangChain/LangGraph integration to prevent GeneratorExit errors from being logged as failures. A new skip_error_callback parameter allows users to define custom logic for determining which errors should be skipped during trace handling, with skipped errors resulting in a placeholder output instead of error information.
Key Changes:
- Added
skip_error_callbackparameter toOpikTracerfor conditional error handling - Implemented
_should_skip_errormethod to evaluate error skipping logic - Introduced
ERROR_SKIPPED_OUTPUTSconstant as placeholder for skipped errors - Updated error processing in
_persist_runand_process_end_span_with_errormethods
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
sdks/python/src/opik/integrations/langchain/opik_tracer.py |
Added skip_error_callback parameter, implemented error skipping logic in error handling methods |
sdks/python/tests/library_integration/langchain/test_langchain.py |
Added integration test verifying error skipping functionality with FakeStreamingListLLM |
sdks/python/tests/library_integration/langchain/test_langchain.py
Outdated
Show resolved
Hide resolved
…utput handling - Updated `OpikTracer` to improve error processing flow and conditional skipping logic using `skip_error_callback`. - Introduced explicit handling for placeholder outputs when errors are skipped. - Corrected typo in test prompt template for clarity.
…zation parameters - Revised and expanded `OpikTracer` constructor docstring to provide clearer descriptions for initialization parameters. - Removed duplicated docstring content for improved clarity and reduced redundancy.
…3986) * [OPIK-2787] [P SDK] Add skip error callback functionality in OpikTracer for LangChain integration - Introduced `skip_error_callback` to allow selective skipping of error outputs during trace handling. - Updated `OpikTracer` to incorporate conditional error handling based on the callback's result. - Enhanced error processing logic to handle skipped errors with placeholder outputs. - Added integration test `test_langchain_callback__skip_error_callback__error_output_skipped`. * [OPIK-2787] [P SDK] Refine skip error logic and enhance placeholder output handling - Updated `OpikTracer` to improve error processing flow and conditional skipping logic using `skip_error_callback`. - Introduced explicit handling for placeholder outputs when errors are skipped. - Corrected typo in test prompt template for clarity. * [OPIK-2787] [P SDK] Update `OpikTracer` docstring format for initialization parameters - Revised and expanded `OpikTracer` constructor docstring to provide clearer descriptions for initialization parameters. - Removed duplicated docstring content for improved clarity and reduced redundancy.
Details
Allows to skip specific errors with LangChain/LangGraph integration
skip_error_callbackto allow selective skipping of error outputs during trace handling.OpikTracerto incorporate conditional error handling based on the callback's result.test_langchain_callback__skip_error_callback__error_output_skipped.Example of usage
Result in UI
Change checklist
Issues
Testing
Implemented related integration test.
Documentation
Nothing added