feat: add progress bar to experiments#730
Open
colodenn wants to merge 3 commits intolangfuse:mainfrom
Open
Conversation
|
@colodenn is attempting to deploy a commit to the langfuse Team on Vercel. A member of the Team first needs to authorize it. |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This file contains hidden or 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
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.
Problem
When running experiments with many items, developers have no feedback on progress or estimated time. A progress bar has been requested in langfuse/langfuse#11718 so we can see:
Changes
new experiment.run({ progress?: boolean })to control behavioroptionalDependenciesso it doesn’t block browser or edge usage. If the import fails, the experiment runs without the bar.tests/e2e/experiments.e2e.test.tsRelease info Sub-libraries affected
Bump level
Libraries affected
Changelog notes
Important
Adds optional TTY-style progress bar for experiment runs in Node.js with a
progressoption inExperimentParamsand tests for its functionality.progresspackage.progressoption inExperimentParamsto control progress bar visibility.ExperimentManager.run().progressas anoptionalDependencyinpackage.json.@types/progressas adevDependency.progressinExperimentManager.ts.experiments.e2e.test.ts.This description was created by
for 96c98f3. You can customize this summary. It will automatically update as commits are pushed.
Disclaimer: Experimental PR review
Greptile Overview
Greptile Summary
This PR adds an optional TTY-style progress bar for experiment runs in Node.js. The implementation uses the
progresspackage as an optional dependency to avoid blocking browser or edge environments. The progress bar displays current/total items, percentage, and ETA during experiment execution.Critical Issues:
if (canShowBar)statement on lines 213-214 creates a syntax errorprogressmodule violates the project's style guideline requiring imports at module topApproach:
progressoptionConfidence Score: 2/5
packages/client/src/experiment/ExperimentManager.ts- contains duplicate conditional and extra brace causing syntax errorsImportant Files Changed
progressparameter with clear documentationprogressas optional dependency and@types/progressas dev dependencySequence Diagram
sequenceDiagram participant User participant ExperimentManager participant ProgressBar participant Task User->>ExperimentManager: run(config with progress option) ExperimentManager->>ExperimentManager: Check progressOption & TTY alt canShowBar is true ExperimentManager->>ProgressBar: import("progress") ProgressBar-->>ExperimentManager: Progress constructor ExperimentManager->>ProgressBar: new Progress(format, options) end loop For each batch loop For each item in batch ExperimentManager->>Task: runItem(item) Task-->>ExperimentManager: result ExperimentManager->>ProgressBar: tick(1) end end ExperimentManager-->>User: ExperimentResultContext used:
dashboard- Move imports to the top of the module instead of placing them within functions or methods. (source)