diff options
| author | Sergey Kostyaev <s-kostyaev@users.noreply.github.com> | 2026-05-01 16:46:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-01 10:46:20 -0400 |
| commit | 4ef511ad1ce11539e3848edf8a2f0ef439506c01 (patch) | |
| tree | fc3ff18907dbddc713f4defbe7fd5d17947652ca /llm-github.el | |
| parent | 4f69909fcc81d9d0f54ccb0d44ef3fa6e95ee09c (diff) | |
Redact provider keys in printed structs (#276)externals/llm
## Summary
- wrap string provider keys in zero-argument functions so provider
structs do not print raw secrets in backtraces
- update key-bearing provider constructors to apply the wrapping at
construction time
- add a regression test for OpenAI-compatible providers
Original issue: https://github.com/s-kostyaev/ellama/issues/318
## Testing
- emacs -Q --batch -L . -L /Users/sergeykostyaev/.emacs.d/elpa/plz-0.9.1
-L /Users/sergeykostyaev/.emacs.d/elpa/plz-event-source-0.1.3 -L
/Users/sergeykostyaev/.emacs.d/elpa/plz-media-type-0.2.4 -L
/Users/sergeykostyaev/.emacs.d/elpa-old/compat-30.0.2.0 --eval "(setq
load-prefer-newer t)" -l llm-test.el -l llm-provider-utils-test.el -l
llm-prompt-test.el -l llm-models-test.el --eval
"(ert-run-tests-batch-and-exit)"
- byte-compilation of touched files with the same load path
Diffstat (limited to 'llm-github.el')
| -rw-r--r-- | llm-github.el | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/llm-github.el b/llm-github.el index 4bb1448..063030f 100644 --- a/llm-github.el +++ b/llm-github.el @@ -28,8 +28,19 @@ (require 'llm) (require 'llm-azure) -(cl-defstruct (llm-github (:include llm-azure - (url "https://models.inference.ai.azure.com")))) +(cl-defstruct (llm-github + (:include llm-azure + (url "https://models.inference.ai.azure.com")) + (:constructor make-llm-github + (&key default-chat-temperature + default-chat-max-tokens + default-chat-non-standard-params + ((:key raw-key)) + (chat-model "unset") + (embedding-model "unset") + (url "https://models.inference.ai.azure.com") + &aux + (key (llm-provider-utils--wrap-key raw-key)))))) (cl-defmethod llm-provider-chat-url ((provider llm-github)) (format "%s/chat/completions" (llm-azure-url provider))) |
