-
[OPIK-1872]: [Docs] Add documentation page for P SDK thread evaluation (#2615)
发布于
2025-07-07 13:08:53 +00:00 -
[OPIK-1833]: Added threads evaluation engine stub
-
[OPIK-1833]: Added ThreadsClient stub with core methods for thread search and feedback logging
-
[OPIK-1833]: Added ThreadsClient stub with core methods for thread search and feedback logging
-
[OPIK-1833]: Implemented threads evaluation engine with multi-threading support
- Added
ThreadsEvaluationEnginefor evaluating threads and logging feedback scores. - Integrated
ThreadsEvaluationResultmodel for structured evaluation outputs. - Developed
executefunction with ThreadPoolExecutor for parallel task processing. - Added types and utilities to support thread evaluation tasks.
-
[OPIK-1833]: Implemented proper handling of score results
-
[OPIK-1833]: Refactored
ThreadsEvaluationEngineconstructor to accept an instance ofthreads_client.ThreadsClientto allow easy mocking during testing. -
[OPIK-1833]: Refactored conversation imports to use a centralized
typesmodule
Streamlined
Conversationand related type imports by using the newly centralizedtypesmodule. Updated method signatures and replaced inline type definitions for better maintainability.- [OPIK-1833]: Enhanced error handling and logging in
ThreadsEvaluationEngine
- Added a logging framework for better traceability.
- Introduced specific exceptions to handle empty metrics and thread data scenarios.
- Improved conversation trace validation to skip evaluation for threads without conversation traces.
- Enhanced span and trace outputs to include detailed evaluation results.
- [OPIK-1833]: Added unit tests for
ThreadsEvaluationEngine
- Implemented comprehensive test coverage for
ThreadsEvaluationEnginemethods. - Added tests for conversation trace retrieval, feedback score logging, and thread evaluation.
- Verified concurrency behavior with multiple threads and workers.
- Ensured proper exception handling and logging for edge cases.
- [OPIK-1833]: Added
evaluate_threadsfunction and updated__init__.pyexports
- Implemented
evaluate_threadsto enable conversation thread evaluation with custom metrics. - Updated
__all__in__init__.pyfor proper module export of the new function.
-
[OPIK-1833]: Wrapped threads evaluation by
async_http_connections_expire_immediatelycontext manager -
[OPIK-1833]: Replaced
MetricComputationErrorwithEvaluationErrorin thread evaluation logic
- Introduced
EvaluationErrorfor better exception clarity. - Updated exception handling in
ThreadsEvaluationEngineand corresponding unit tests.
- [OPIK-1833]: Fixed typo in
_get_conversation_threadmethod name and updated logic to handle scoring failures
- Renamed
_get_conversation_treadto_get_conversation_threadacross implementation and tests. - Enhanced scoring logic to exclude failed scores from feedback logging in
ThreadsEvaluationEngine.
- [OPIK-1833]: Refactored
ThreadsEvaluationEnginemethods and added context management for evaluations
- Renamed
_evaluate_threadtoevaluate_threadfor better clarity. - Introduced
evaluate_llm_conversation_contextto manage context and trace data during evaluations. - Moved trace and span logic into
context_helperfor cleaner code organization. - Updated unit tests to reflect method renaming and added context mock handling.
- General improvement to exception handling and error logging mechanisms across evaluation flows.
- [OPIK-1833]: Refactored threads evaluation to align with the shared engine framework
- Replaced
_types.ThreadTestResultwithevaluation_result.ThreadEvaluationResultfor consistency. - Merged evaluation logic into
evaluation_tasks_executorfromevaluation_executor. - Updated thread evaluation tasks to use generic
EvaluationTaskwith TypeVar to improve type safety. - Simplified
ThreadsEvaluationResultstructure for clearer results handling. - Refactored tests to reflect the updated structure and improve validation of evaluation results.
- [OPIK-1833]: Added better type annotations and comments
- Introduced
Literalfor type hintingconversationkeys, improving clarity and type safety. - Included comments to enhance code readability and maintainability.
- [OPIK-1833]: Refactored threading helpers and removed redundant methods
- Extracted
_get_conversation_threadand_log_feedback_scoresintohelpersmodule, improving modularity and reusability. - Updated
ThreadsEvaluationEngineto use new helper methods and streamlined logic. - Added unit tests for
helpers.pyto ensure correctness of extracted functionality.
-
[OPIK-1833]: Fixed coment
-
[OPIK-1834] [P SDK] ConversationalCoherence conversation metric (#2579)
-
[OPIK-1834]: Fixed imports
-
[OPIK-1834]: Added synchronous Conversational Coherence Metric implementation.
- Introduced
ConversationalCoherenceMetricfor evaluating coherence of conversation exchanges within sliding windows. - Implemented templates and schema for constructing evaluation queries and parsing responses.
- Added helper methods to generate sliding windows of conversation turns.
- Included Pydantic models for validating and handling evaluation responses.
- Integrated scoring calculation and irrelevancy extraction logic for detailed analysis.
- [OPIK-1834]: Enhanced Conversational Coherence and Session Completeness metrics.
- Added
ConversationTurnclass for structured representation of conversation exchanges. - Implemented
build_conversation_turnsandmerge_turnsutilities for processing conversational data. - Refactored window-based scoring logic to use conversation turns, improving clarity and modularity.
- Introduced comprehensive tests for conversational coherence and session completeness metrics, covering error scenarios and ensuring robustness.
- Improved error handling and logging across metric computation functions.
- [OPIK-1834]: Added and tested conversation turn utilities
- Introduced
test_build_conversation_turns__happy_pathfor validating thebuild_conversation_turnsutility. - Rewrote
test_window_sizeastest_get_turns_in_sliding_windowto align with the updated sliding window logic. - Enhanced test coverage for sliding window generation and conversation turn processing functions.
- [OPIK-1834]: Added asynchronous support for Conversational Coherence Metric
- Introduced
ascoremethods for asynchronous scoring and evaluation. - Added
_a_calculate_score,_a_reason_from_verdicts, and_a_evaluate_conversationto handle async operations seamlessly. - Extracted common logic into
_extract_turns_windows_from_conversationto reduce redundancy and improve readability. - Extended test suite with async tests to ensure correctness of async metric computation and error handling.
- Updated logging and exception handling for async workflows.
- [OPIK-1834]: Updated imports and added tests for Conversation Coherence Metric.
- Refactored imports for Session Completeness Metric to improve maintainability.
- Introduced tests for Conversation Coherence Metric, including synchronous and asynchronous scenarios.
- Adjusted
trackparameter in Session Completeness Metric tests to avoid delays while trying to log metric to not running server. - Verified integration with real model outputs through expanded test coverage.
-
[OPIK-1834]: Fixed imports
-
[OPIK-1834]: Added another example of irrelevant response reason
-
[OPIK-1834]: Simplified conversation turn extraction logic.
-
[OPIK-1834]: Added documentation to the ConversationalCoherenceMetric and exposed it as export from
opik.evaluation.metrics -
[P SDK] UserFrustration conversation metric (#2603)
-
[OPIK-1835]: Implemented User Frustration Score Metric - synchronous mode.
- Added
UserFrustrationMetricto evaluate user frustration in conversations based on sliding window analysis. - Introduced templates and schema for constructing LLM queries and parsing frustration-related responses.
- Implemented scoring and reasoning generation, leveraging context and per-message analysis.
- Refactored common sliding window logic to
helpers.pyfor reusability. - Updated
ConversationTurnutilities to handle cases whereoutputis absent.
- [OPIK-1835]: Added comprehensive tests for User Frustration Metric
- Implemented unit tests for
UserFrustrationMetriccovering various scenarios: no frustration, mixed responses, all frustration, and error handling. - Added support for asynchronous test cases (
test_score__async) ensuring correctness of async methods. - Updated logic in
metric.pyto fix the calculation of frustrated counts. - Ensured detailed validation of edge cases such as empty conversations and invalid response formats.
- [OPIK-1835]: Added asynchronous support for User Frustration Metric
- Introduced
ascoremethod for asynchronous frustration score evaluation. - Added
_a_calculate_score,_a_reason_from_verdicts, and_a_evaluate_conversationmethods to handle async operations. - Leveraged
asyncio.gatherfor efficient asynchronous processing of conversation sliding windows. - Enhanced logging and error handling for async workflows, ensuring robustness.
- [OPIK-1835]: Updated User Frustration Metric with documentation and integration tests.
- Detailed class documentation for
UserFrustrationMetric, explaining arguments, behavior, and scoring. - Integrated metric into the library's exports for seamless access.
- Added integration tests to validate real model outputs for both synchronous and asynchronous methods.
-
[OPIK-1872]: Updated documentation to include threads evaluation.
-
[OPIK-1872]: Updated threads evaluation documentation
-
[OPIK-1872]: Enhanced documentation for
evaluate_threadsto detail supported fields and operators. -
[OPIK-1872]: Fixed
feedback_scoresfilter example -
[OPIK-1872]: Added
feedback_scoresfilter parameters description. -
[OPIK-1872]: Fixed broken link
-
[OPIK-1872]: Changed screenshot for threads evaluation
-
Optimised images with calibre/image-actions
-
Optimised images with calibre/image-actions
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
下载附件
-