Skip to content
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

[OPIK-655]: finish initial dataset UI #1016

Merged
merged 4 commits into from
Jan 10, 2025

Conversation

aadereiko
Copy link
Contributor

@aadereiko aadereiko commented Jan 9, 2025

Details

Core features:

  • Added datasets
  • Started using zustand in order to avoid re-rendering components. Each output and prompt is re-rendered only when it is changed now. The store is connected to the localStorage. The key has changed, so all previous playgrounds will be reset.
  • The playground sends up tp 5 requests for streaming and 2 requests for logging traces at once. It is done with async library
image image image

Issues

Resolves #

Testing

Documentation

@aadereiko aadereiko requested a review from a team as a code owner January 9, 2025 23:06
Copy link
Collaborator

@ferc ferc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! I added some suggestions and improvements in the code and logic, overall it looks great, nice management of async queues, streaming and performance

Let's address the changes in the next PR (logic changes + design feedback), thanks!

Comment on lines +79 to +83
const flattenedDatasetItem = flattenObject(datasetItem);

const notDefinedVariables = messageTags.filter((tag) =>
isUndefined(flattenedDatasetItem[tag]),
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better to replace the flattenObject with the lodash get instead?


return {
role: message.role,
content: mustache.render(message.content, datasetItem),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we need extra logic here in case we pass an object since mustache is using toString instead of JSON.stringify for replacing the values

Comment on lines +143 to +145
async (task) => {
await createTraceSpan(task);
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just passing createTraceSpan should be okay, right?

Comment on lines +234 to +236
(combination: DatasetItemPromptCombination, callback) => {
processCombination(combination, callback);
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe the callback here is actually needed if you just return the Promise from processCombination like:

    asyncLib.mapLimit(
      combinations,
      LIMIT_STREAMING_CALLS,
      processCombination,
      () => {
        setIsRunning(false);
        isToStopRef.current = false;
        abortControllersOngoingRef.current.clear();
      },
    );

And removing the processCallback(null) calls

useEffect(() => {
// stop streaming whenever the location changes
return () => stopAll();
}, [location, stopAll]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove the location dependency since it's prone to error in case in the future we introduce search/hash locations in the Playground, just removing the dependency should do the trick and it'll be called on unmount the component

@ferc ferc merged commit b0a49c6 into main Jan 10, 2025
5 checks passed
@ferc ferc deleted the sashaa/OPIK-655/finish-initial-dataset-ui branch January 10, 2025 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants