Skip to content

How to integrate this into our own applications? #110

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

Open
trevtravtrev opened this issue Mar 21, 2023 · 2 comments
Open

How to integrate this into our own applications? #110

trevtravtrev opened this issue Mar 21, 2023 · 2 comments

Comments

@trevtravtrev
Copy link

trevtravtrev commented Mar 21, 2023

chatGPT has an API that allows you to easily integrate it into your own applications. alpaca.cpp currently runs in the terminal, but is there an existing way to call it from our own programs?

The only way I've seen this to be possible currently is via a terminal command similar to below (#103):
.\Release\chat.exe -p "write a python script that prints the current time" --interactive

The problem with this solution is that it requires restarting/reloading the entire model for every prompt you ask it. This becomes increasingly time consuming and compute intensive the larger the weight you use as well.

Is there a better way to do this currently? If not, how can it be added?

@frenchmustard
Copy link

There's two parts to your question, the integration part I can't really answer due to my lack of knowledge on C++ but I can say that you can probably (and this is very inefficient mind you) open the executable as a process from a different script like use Popen in Python and then read/write to the chat.

As for the restarting/reloading: ChatGPT stores parts of the conversation that is relevant I believe, so in order for this to do the same you'd need to either implement some hefty algorithm that summarizes important parts of the convo (tokens are heavy) or, way less efficient, give back the history of the convo in the background with lots of "You said" and "I responded".

@dzid26
Copy link

dzid26 commented Mar 22, 2023

Maybe ggml-org#278 (comment)

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

No branches or pull requests

3 participants