Closed mrdylanyin closed 6 months ago
Sure. Would you be interested in adding it?
On Sun, Dec 17, 2023, 5:41 AM mrdylanyin @.***> wrote:
Gemini is Google’s AI model and free for personal usage. User can get an API key via their page on Google AI Studio https://makersuite.google.com/app/apikey
— Reply to this email directly, view it on GitHub https://github.com/karthink/gptel/issues/149, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBVOLFR3ALHCTTHESC23EDYJ3ZAHAVCNFSM6AAAAABAYLXYUOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA2DKMRSGQYTANY . You are receiving this because you are subscribed to this thread.Message ID: @.***>
I really want to make this feature happen, but truth be told, I'm a newbie when it comes to writing Emacs Lisp. Spent a few hours digging through the source code, and I'm still clueless on where to begin. Apologies for that.
@mrdylanyin Almost all of the code is LLM agnostic, so it will not need changing. You also do not need to understand these parts to add a new backend. Assuming gemini has a http API and replies with JSON, there are only three API-specific functions (technically implementations of generic methods) needed:
gptel--parse-buffer
: This scans the buffer where you type and assembles a list of user prompts and LLM responses.gptel--request-data
: This creates the full payload (to be JSON encoded and sent) including all model parameters required by the API.If streaming responses are supported:
gptel-curl--parse-stream
: This extracts the content of the response from the JSON stream returned by the API.If streaming responses are not supported:
gptel--parse-response
: This extracts the content of the response from the full JSON structure returned by the API.You can look at the implementation of these methods (as cl-defmethod
) in the files gptel-openai.el
and gptel-ollama.el
. You might be able to get gemini working just by tweaking one of these.
Gemini is Google’s AI model and free for personal usage. User can get an API key via their page on Google AI Studio