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

feat(playground): add non streaming option to ui #5250

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Parker-Stafford
Copy link
Contributor

@Parker-Stafford Parker-Stafford commented Oct 31, 2024

resolves #5250

  • adds a non streaming option to the playground UI

@Parker-Stafford Parker-Stafford force-pushed the parker/5181-non-streaming-playground-ui branch from 88441b8 to caa8dd9 Compare October 31, 2024 23:57
@Parker-Stafford Parker-Stafford changed the title remove unused runInstance on store feat(playground): add non streaming option to ui Nov 1, 2024
@@ -125,6 +140,8 @@ export function PlaygroundOutput(props: PlaygroundOutputProps) {
);
}
return "click run to see output";
// eslint-disable-next-line react-compiler/react-compiler
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [hasRunId, instance.output, instanceId, runId]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is hacky, but does work we have to remove streaming from deps array otherwise when you toggle it it will switch and rerun the mutation or stream (whichever you're switching to)

@@ -253,7 +270,136 @@ function toGqlChatCompletionRole(
}
}

function PlaygroundOutputText(props: PlaygroundInstanceProps) {
function NonStreamingPlaygroundOutputText(props: PlaygroundInstanceProps) {
const instances = usePlaygroundContext((state) => state.instances);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is just copied from streaming, can probably make a wrapper and just change the subscription or mutation, just wanted to get something out

@@ -388,7 +536,7 @@ function PlaygroundOutputText(props: PlaygroundInstanceProps) {
},
});

if (instance.isRunning) {
if (output == null && toolCalls.length === 0) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@axiomofjoy you made this change, but it breaks streaming since the instance is still running while the chunks are coming in, it doesn't show the output till it's all done, i reverted it back but wanted to make sure the change wasn't fixing some other issue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

alternatively we can mark it as complete when the first chunk comes in but not sure if that's the right call

"TOOL_CHOICE"
> = "TOOL_CHOICE";

export const TOOL_CHOICE_PARAM_NAME = "tool_choice";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is not necessarily stable, we need to pull from the backend and map this and use the real models tool_choice name at run time, or allow passing in one of the canonical or param name to the subscription cc @cephalization @anticorrelator, right now they are all the same so it doesn't matter

@@ -0,0 +1,14 @@
import strawberry
Copy link
Contributor Author

Choose a reason for hiding this comment

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

dummy to be removed when #4774 is done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📘 Todo
Development

Successfully merging this pull request may close these issues.

1 participant