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

Implement caching #26

Closed
TheR1D opened this issue Feb 15, 2023 · 1 comment · Fixed by #49
Closed

Implement caching #26

TheR1D opened this issue Feb 15, 2023 · 1 comment · Fixed by #49
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@TheR1D
Copy link
Owner

TheR1D commented Feb 15, 2023

In some cases, we may need to run sgpt twice with the same prompt in order to pipe the output somwhere else. For example:

sgpt --code "implement merge sort algorithm using C language"


#include <stdio.h>

void merge(int arr[], int l, int m, int r)
{
    int i, j, k;
    int n1 = m - l + 1;
    int n2 =  r - m;
...

The output in this case can be quite large, and it would be helpful to use less to view it:

sgpt --code "implement merge sort algorithm using C language" | less

But we would spent +1 query and couple seconds of waiting just to get same (not always) response. It would be useful to implement some form of caching for the last n outputs, as well as a way to invalidate the cache (for example, by using --cache and --no-cache arguments)."

@TheR1D TheR1D added the enhancement New feature or request label Feb 15, 2023
@Olshansk
Copy link

+1

I would go further and making this "memory" so I could search through by sgpt history to avoid overpaying, and have a historical backview.

@TheR1D TheR1D self-assigned this Mar 4, 2023
@TheR1D TheR1D linked a pull request Mar 4, 2023 that will close this issue
@TheR1D TheR1D added this to the Caching milestone Mar 4, 2023
@TheR1D TheR1D closed this as completed in #49 Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants