-
-
Notifications
You must be signed in to change notification settings - Fork 340
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
Config from file outside home directory #953
Comments
What is your end goal? To hide the tokens? |
No, it's fine for users to be able to view the config file (including tokens). The goal is to have all default config that I provide living outside users' home directories, i.e. coming from my custom image. Config within users' home directories should be all their own. When my system-level config has to live in users' home directories, it is persisted to their backing persistent volume in Kubernetes, which shadows the home directory in my custom image. This means that if I have to push an update out to my system-level config, I can't just change a file in my custom image, I instead have to run some migration script at container startup to first check their potentially-customized config in their home directory, and ideally detect and preserve any customizations they made that don't conflict with the changes I need to make. |
If this isn't currently supported, is there a workaround you'd suggest? E.g. some way to pass a CLI param to specify a custom path where jupyter-ai should look for its config? Also meant to say before, thanks for the quick response! |
I am surprised that moving it to Of note, jupyter-ai has two types of config files which can be put in a JSON, one is the standard traitlets config and one is an internal one which should not be modified by the user. |
I also tried wrapping this config inside the two extra layers that appear here (
I don't understand this error message, since the JSON I'm providing does associate the Can you please confirm what you expect the contents of my Again, when Thanks again for your help with this. |
The screenshot confirms what I mentioned about two config file formats. You are mixing them up (not that documentation is super clear here). The The
Can you show the exact config that you tried? |
Thanks @krassowski, I thought that might be the case. Here is my working config.json:
...except that it doesn't work in JupyterHub on Kubernetes due to the home directory being shadowed by the persistent volume. I tried moving this config file into a subdirectory of one of the
|
I would recommend using As for the path, here is the code: jupyter-ai/packages/jupyter-ai/jupyter_ai/config_manager.py Lines 19 to 26 in e45eff5
The data dir is documented in more details here: https://docs.jupyter.org/en/latest/use/jupyter-directories.html#data-files Briefly, you can check which of the data dirs is "the" selected data dir with:
and you can adjust it by setting |
Thank you for the warning about using Running I am already using [1] Here are all the other extensions that this approach works with, in case it's helpful:
|
Which specific ones? |
Yes and not. I do think that some settings like the current provider/model should be configured via JupyterLab configuration system (which then feeds into
Yes, because |
Thanks for explaining. As long as there is some way for administrators to provide default values for all the extension's required settings in a file outside each user's home directory, that would satisfy the need here.
Will do. To facilitate this (and answering your previous question), could the https://jupyter-ai.readthedocs.io/en/latest/users/index.html#configuring-as-a-config-file documentation please be updated to document the schema for this configuration? Currently it only provides a small example config that is apparently an incomplete example of all the settings that can be configured via this file. In particular, it is not clear how to translate the settings I shared previously into this other format. And when you provide invalid config, the error message makes it hard to figure out what's wrong:
Thank you for your ongoing help with this! |
This is a fair ask. Traitlets has a way to auto-generate documentation for traits ( As a user you can either submit a PR for the above, or use command line: python -c 'import jupyter_ai; print(jupyter_ai.AiExtension().document_config_options())' |
Thanks. I'm still having trouble getting this to work, but the trick you shared helped me get farther: I figured out that if I replace the {
"AiExtension": {
"default_language_model": "openai-chat:dls-gpt-4o",
"default_api_keys": {"OPENAI_API_KEY": "<redacted>"},
"default_url": "https://ailab-litellm-proxy-dev.chicagotrading.io",
"model_parameters": {
"openai-chat:dls-gpt-4o": {
"model_kwargs": {
}
}
}
}
} ...then the AI extension UI starts out appearing to be configured (i.e. it looks like the second screenshot in this comment above rather than the first one). That is good progress. However, when I try to use the chatbot, I get errors like:
This occurs even though I'm setting OPENAI_API_KEY to the same value I used in the old, working config.json that I shared above. So there must be something about the new config that isn't properly translated over from the old. Can you tell what's wrong? I'll paste the old, working config again here, for convenience:
I combed through the
Other fields just document an underspecified shape like
Thanks again for your ongoing help with this. |
I do not see anything wrong with how you specify
jupyter-ai/packages/jupyter-ai/jupyter_ai/extension.py Lines 118 to 127 in 4b45ec2
|
I work with @ctcjab and have made some progress based on your suggestions. The last issue seems to be getting the in-line completions configured this way. the current configuration that I have is (some strings altered w/ REDACTED, if the altered strings look potenially mis-aligned it is more likely a copy-paste error than a configuration error):
It seems like |
That's correct, this is tracked in #781 - please see the discussion - your feedback on what the configuration should look like will help to move it forward (as would opening a PR or enabling someone to spend time on it). |
Context: I am developing a custom image for my JupyterHub users that has jupyter-ai installed and configured out-of-the-box. The custom image is built on top of the jupyter-minimal base image.
Right now I can only get this to work if I put the configuration in
$HOME/.local/share/jupyter/jupyter_ai/config.json
. It would be preferable if I could put this in a jupyter data dir outside the home directory and still have jupyter-ai pick it up (e.g./usr/share/jupyter/jupyter_ai/config.json
), but that doesn't work.I also tried following the docs I found here and moving the config to
/etc/jupyter/jupyter_jupyter_ai_config.json
, but that didn't work either. Any help would be much appreciated.Thanks, and thanks for maintaining Jupyter-AI!
The text was updated successfully, but these errors were encountered: