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

[Meru][Assistant Builder] Improved description suggestion #4559

Merged
merged 5 commits into from
Apr 4, 2024

Conversation

philipperolet
Copy link
Contributor

@philipperolet philipperolet commented Apr 3, 2024

Description

  • A single suggestion automatically populates an empty description field when arriving on the Naming tab (except on empty instructions)
  • Possibility to re-generate by clicking on the sparkles
  • heads up when regenerating if user modified the field (no heads up on empty or generated field)

Note: the heads up is a simple confirm, an immediately following PR will make a lib for alert/confirm with our standard modals and use them

Screencast from 2024-04-03 22-21-43

Risk

none, gated

Deploy Plan

deploy front

@spolu
Copy link
Contributor

spolu commented Apr 4, 2024

I think I would remove the confirmation when clicking on sparkles with a description already there. No big deal if we override that description no?

const descriptionSuggestions = await getDescriptionSuggestions({
owner,
instructions: builderState.instructions || "",
name: builderState.handle || "",
});
if (descriptionSuggestions.isOk()) {
setDescriptionSuggestions(descriptionSuggestions.value);
const suggestion =
descriptionSuggestions.value.status === "ok" &&
Copy link
Contributor

Choose a reason for hiding this comment

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

This return type fields weird, the http code should be enough to say if the suggestion calls worked.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. This is debatable, since there are cases where user input is correct, the API call works, the dust app is run, and the LLM decides it's not time to create suggestions (e.g. because of the content of the instructions). So it's not exactly an error, the API call worked and is saying "ok, I looked, with this data it's not appropriate to give you suggestions" (but the request body was correct, with valid arguments, and no way to tell beforehand)

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

From a FE standpoint, we don't need to know all this conditional logic around the LLM deciding whether or not it's time to generate a description.

I'd suggest to go with an empty array in those scenarios.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, depending on the reason for the empty array, the front end will need to react differently. Agree that's debatable, boils down to deciding what are valid answers from the endpoint and what are "errors" and I agree the duplicate status is indeed weird. But changing API scope is not for this PR. We can discuss it further for another PR if you beleive it's warranted

});
}
} else {
sendNotification({
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we display notification in all cases? Only on user intent?

builderState.instructions?.trim() &&
!generatingDescription
) {
suggestDescription().catch((error) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we have the catch directly in suggestDescription to centralize the error handling?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMHO the catch is not necessary (so I would not wrap the whole suggestDescription in a try / catch) -- but IIRC we decided we should not void promises? glad to void it if I remembered wrong

Copy link
Contributor

Choose a reason for hiding this comment

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

Seen IRL, we should wrap the fetch call with a catch and return Err if needed / or throw for unexpected errors. Down the line we can only check isErr.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 as per irl we will void in the useEffect and await in the onclick

<Page.SectionHeader title="Description" />
<div className="flex gap-1">
<Page.SectionHeader title="Description" />
{generatingDescription && <Spinner size="sm" />}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use Spinner2?

@philipperolet
Copy link
Contributor Author

I think I would remove the confirmation when clicking on sparkles with a description already there. No big deal if we override that description no?

Not sure about that; my assumption is that some users won't pay attention and click (curiosity, misclick, etc.). If they had taken the time to write a description, they'll be frustrated.

Note that the confirmation is asked only if it's user-written, there is no confirmation to replace generated description

import { isDevelopmentOrDustWorkspace } from "@app/lib/development";
import { debounce } from "@app/lib/utils/debounce";
import { as } from "fp-ts/lib/Option";
Copy link
Contributor

Choose a reason for hiding this comment

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

🤔

});
}
return new Ok(await res.json());
return await fetchWithErr(
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return await fetchWithErr(
return fetchWithErr(

@philipperolet philipperolet merged commit f1e99cf into main Apr 4, 2024
5 checks passed
@philipperolet philipperolet deleted the meru-descr-suggestions branch April 4, 2024 11:00
flvndvd pushed a commit that referenced this pull request May 26, 2024
* update description suggestion app

* clean dust app + don't use cache

* improve description suggestions behaviour

* review

* clean
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.

3 participants