haystack icon indicating copy to clipboard operation
haystack copied to clipboard

Haystack CLI - Improvements

Open bilgeyucel opened this issue 1 year ago • 3 comments

We have a working CLI, thanks to @ZanSara for her efforts! Stemming from the discussions in #5129, I have some ideas to consider:

  • Update the haystack prompt fetch name as there is no command as haystack prompt. Can we change it to haystack prompt-fetch maybe?
  • Add a new command to print PROMPTHUB_CACHE_PATH. I have yet to get a name idea but I am happy to do a field search and try to find the best convention.
  • Add a new command to delete all saved prompts. haystack prompt delete --all and haystack prompt delete deepset/summarization? A log message should be displayed after this deletion process
  • Can we print a success message if a prompt is saved successfully? It can be deepset/summarization is saved to /Users/bilgeyucel/Library/Application Support/haystack/prompthub_cache so PROMPT_NAME is saved to PROMPTHUB_CACHE_PATH. However, a basic Saved! log would do if the option requires more work

bilgeyucel avatar Jun 13 '23 09:06 bilgeyucel

Update the haystack prompt fetch name as there is no command as haystack prompt. Can we change it to haystack prompt-fetch maybe?

I'll leave it as it is for now, see below

Add a new command to print PROMPTHUB_CACHE_PATH. I have yet to get a name idea but I am happy to do a field search and try to find the best convention.

That's precisely why I'd not change haystack prompt fetch into haystack prompt-fetch: this way we could add this new feature as haystack prompt list (lists cached prompts) haystack prompt list --path (lists with the whole path) etc etc

Add a new command to delete all saved prompts. haystack prompt delete --all and haystack prompt delete deepset/summarization? A log message should be displayed after this deletion process

I'm not sure this adds value, deleting the cache is just deleting a folder and there might be permission problems. It's easier to just explain people which folder to delete

Can we print a success message if a prompt is saved successfully? It can be deepset/summarization is saved to /Users/bilgeyucel/Library/Application Support/haystack/prompthub_cache so PROMPT_NAME is saved to PROMPTHUB_CACHE_PATH. However, a basic Saved! log would do if the option requires more work

On Linux, "well-behaving" CLI tools don't produce output on success. Many tools don't care tho :sweat_smile: Let's discuss pros and cons. Is this a tool people will use manually from the CLI? I imagined it to be more of a util used in Docker build files, so the output would be irrelevant, even noisy.

ZanSara avatar Jun 13 '23 09:06 ZanSara

Valid points 👍

I have one further comment about logs. You're right about logs creating noise. Is there a way to control it with an option? We can disable it when used in Docker build files. My concern is, as a beginner, I need to find out whether the prompt is saved, where it is saved etc. So I can't test the functionality of CLI. Another approach is, instead of printing a success message, we could add the list feature you mentioned and guide users to run haystack prompt list to check if the prompt is saved successfully.

~Another question I have rn is updating a prompt. I noticed we don't fetch the prompt again if the prompt is cached but is there a way or can we add a way to force fetching? I see us changing some prompts in the hub in the future. Even if we don't implement this now, we should start thinking about this feature. ofc, this is more important if we consider Haystack CLI to be used manually from the CLI. If it's a tool for Docker, we might not need this feature.~ Apparently, CLI updates the prompt every time it is fetched 👍

I guess, the first question we need to answer now is what's the main use case of Haystack CLI. Then we can start talking about features :)

bilgeyucel avatar Jun 13 '23 10:06 bilgeyucel

Another question I have rn is updating a prompt. I noticed we don't fetch the prompt again if the prompt is cached but is there a way or can we add a way to force fetching? I see us changing some prompts in the hub in the future. Even if we don't implement this now, we should start thinking about this feature. ofc, this is more important if we consider Haystack CLI to be used manually from the CLI. If it's a tool for Docker, we might not need this feature.

We always download th prompt even if it already exists.

By the way I agree with @ZanSara on not changing prompt-fetch to prompt fetch. Right now we only have this prompt subcommand but we're going to add new ones for sure, it's imporant to have a nice command hierarchy.

Other than the ones suggested by @bilgeyucel I also suggest:

  • prompt list --local or prompt list --cached to get the ones saved
  • prompt view <id>, prompt print <id>, prompt show <id> to print the prompt specified
  • prompt cache-path to get the current cache path
  • prompt cache-path <path> to set the new cache path, we're going to need a way to save configs to do this so let's avoid it for now
  • prompt cache-path <path> --keep or something similar o set the new path and copy over the already cached prompts

silvanocerza avatar Jun 13 '23 10:06 silvanocerza