-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gptel: Add arbitrary params to request
Provide a way to add arbitrary parameters to the `gptel-request' payload. This is required for customizing parameters that gptel does not provide user options for. Examples in #330, #415, #471. This is done by adding a `:request-params' field to the backend and the model. This should be a plist whose key/value pairs are the additional request parameters and their values. In case of conflict, the model-specific request-parameters override the backend-specific ones, which override gptel's dynamically set user options. Valid parameters depend on the specific API being queried, and can be found in the corresponding API documentation. * gptel.el (gptel--merge-plists, gptel--model-request-params): Add utility functions. * gptel-openai.el (gptel-backend, gptel-make-openai, gptel-make-azure, gptel-make-gpt4all, gptel--request-data): Add request-params slot to `gptel-backend' and keyword to `gptel-make-openai' and its derivatives. Merge model and backend-specific request parameters when sending a request. * gptel-privategpt.el (gptel-make-privategpt): Add request-params keyword. * gptel-ollama.el (gptel-make-ollama, gptel--request-data): Add request-params keywod to `gptel-make-ollama'. Merge model and backend-specific request parameters when sending a request. Remove ad hoc value of :num_ctx used according to #330 -- this is no longer needed as :num_ctx can be set explicitly when defining the Ollama model or backend. * gptel-kagi.el (gptel--request-data): Add TODO to implement model and backend-specific request parameters. * gptel-gemini.el (gptel-make-gemini, gptel--request-data): Add request-params keywod to `gptel-make-gemini'. Merge model and backend-specific request parameters when sending a request. * gptel-curl.el (gptel-curl-get-response): Check model and backend-specific stream settings in their request-params slot when sending the request. These take priority over the global `gptel-stream' and the backend's `:stream' value. * gptel-anthropic.el (gptel-make-anthropic, gptel--request-data): Add request-params keywod to `gptel-make-ollama'. Merge model and backend-specific request parameters when sending a request.
- Loading branch information
Showing
8 changed files
with
124 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.