Skip to content
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

howto add key #330

Merged
merged 8 commits into from
Aug 11, 2023
Merged

Conversation

bjornjorgensen
Copy link
Contributor

@bjornjorgensen bjornjorgensen commented Aug 10, 2023

Hi, I did have some problems with setting up the API key in a jupyter notebook. Like in #315

This in a code cell does work for chatgpt.

import os
os.environ["OPENAI_API_KEY"]='sk-'

Hi, I did have some problems with setting up the API key in a jupyter notebook.

This in a code cell does work for chatgpt.

import os
os.environ["OPENAI_API_KEY"]='sk-'
@welcome
Copy link

welcome bot commented Aug 10, 2023

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please make sure you followed the pull request template, as this will help us review your contribution more quickly.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@JasonWeill JasonWeill added documentation Improvements or additions to documentation enhancement New feature or request labels Aug 10, 2023
@JasonWeill
Copy link
Collaborator

This is a partial fix for #315.

@JasonWeill
Copy link
Collaborator

@bjornjorgensen Thank you very much for opening this pull request! Because configuration is required for all of our model providers, it might be better to modify the Requirements section of README.md to mention the requirement to configure your models, as suggested in #315:

## Requirements
- Python 3.8 - 3.11
- JupyterLab 4

You will need API keys or other credentials for each model provider you use
with Jupyter AI. For information about credentials and how to provide them, see
[the model providers documentation](https://jupyter-ai.readthedocs.io/en/latest/users/index.html#model-providers).

@bjornjorgensen
Copy link
Contributor Author

bjornjorgensen commented Aug 11, 2023

what if we change the text to

## Setting Up Model Providers in a Notebook

To use any AI model provider within this notebook, you'll need the appropriate credentials, such as API keys.

Obtain the necessary credentials (e.g., API keys) from your model provider's platform.

In a new cell, set the credentials as follows:

import os

# NOTE: Replace 'YOUR_CREDENTIAL_HERE' with your actual credential.
# And replace 'YOUR_ENVIRONMENT_VARIABLE' with the appropriate name.
os.environ["YOUR_ENVIRONMENT_VARIABLE"] = 'YOUR_CREDENTIAL_HERE'

If you're using ChatGPT from OpenAI, it would look like:
import os
os.environ["OPENAI_API_KEY"] = 'YOUR_API_KEY_HERE'

Adjust the environment variable name and the placeholder for your specific model provider. 
For more specific instructions for each model provider, refer to the model providers documentation.

README.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@JasonWeill JasonWeill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor suggestions, but otherwise looks good. Thank you very much for your contributions!

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
bjornjorgensen and others added 3 commits August 11, 2023 20:58
Co-authored-by: Jason Weill <93281816+JasonWeill@users.noreply.github.com>
Co-authored-by: Jason Weill <93281816+JasonWeill@users.noreply.github.com>
Co-authored-by: Jason Weill <93281816+JasonWeill@users.noreply.github.com>
@JasonWeill JasonWeill merged commit a0b949e into jupyterlab:main Aug 11, 2023
5 checks passed
@welcome
Copy link

welcome bot commented Aug 11, 2023

Congrats on your first merged pull request in this project! 🎉
congrats
Thank you for contributing, we are very proud of you! ❤️

@bjornjorgensen bjornjorgensen deleted the add-key-in-notebook branch August 11, 2023 19:16
@bjornjorgensen bjornjorgensen mentioned this pull request Aug 13, 2023
dbelgrod pushed a commit to dbelgrod/jupyter-ai that referenced this pull request Jun 10, 2024
* howto add key

Hi, I did have some problems with setting up the API key in a jupyter notebook.

This in a code cell does work for chatgpt.

import os
os.environ["OPENAI_API_KEY"]='sk-'

* Move to Requirements

* Setting Up Model Providers in a Notebook

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove chatgpt

* Update README.md

Co-authored-by: Jason Weill <93281816+JasonWeill@users.noreply.github.com>

* Update README.md

Co-authored-by: Jason Weill <93281816+JasonWeill@users.noreply.github.com>

* Update README.md

Co-authored-by: Jason Weill <93281816+JasonWeill@users.noreply.github.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jason Weill <93281816+JasonWeill@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants