Skip to content

Pattern for having Toolbox instances use secrets without passing them in logged configuration #1093

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

Closed
simonw opened this issue May 26, 2025 · 3 comments
Labels
design documentation Improvements or additions to documentation plugins tools

Comments

@simonw
Copy link
Owner

simonw commented May 26, 2025

Refs:

@simonw simonw added this to the LLM tools v2 milestone May 26, 2025
@simonw
Copy link
Owner Author

simonw commented May 26, 2025

One possible design:

llm chat -T 'Datasette("https://private.datasette.io/content", key="private-datasette"})'

This would not require additional code in core, it could be a convention that plugins know how to look things up in LLM keys.

(I originally had secret="name-of-key" but using key= is more consistent with how things are named already.)

@simonw
Copy link
Owner Author

simonw commented May 26, 2025

The llm.get_key() method is currently undocumented and confusing to use:

>>> import llm
>>> llm.get_key("hi")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: get_key() missing 1 required positional argument: 'key_alias'
>>> help(llm.get_key)

>>> llm.get_key(key_alias="hi")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: get_key() missing 1 required positional argument: 'explicit_key'
>>> help(llm.get_key)

>>> llm.get_key(None, key_alias="hi")
>>> llm.get_key(None, key_alias="openai")
'sk-proj...

@simonw
Copy link
Owner Author

simonw commented May 26, 2025

Now that llm.get_key() is documented I'm going to suggest people use that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design documentation Improvements or additions to documentation plugins tools
Projects
None yet
Development

No branches or pull requests

1 participant