Skip to content

Adds provider, model vars docs to README #88

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
# This hook checks yaml files for parseable syntax.
- id: check-yaml
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.11.6
rev: v0.11.8
hooks:
- id: ruff
args:
Expand All @@ -28,7 +28,7 @@ repos:
- id: black
language_version: python3
- repo: https://github.com/python-poetry/poetry
rev: "2.1.2"
rev: "2.1.3"
hooks:
- id: poetry-check
- repo: https://github.com/tox-dev/pyproject-fmt
Expand Down
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,25 @@ Start with a manuscript repo [forked from Manubot rootstock](https://github.com/
1. If you haven't already, follow the directions above to create an account and get an API key for your chosen model provider.
1. In your fork's "⚙️ Settings" tab, make a new Actions repository secret with the name `PROVIDER_API_KEY` and paste in your API key as the secret.

If you prefer to select less options when running the workflow, you can optionally set up default values for the model provider and model at either the repo or organization level.

In your fork's "⚙️ Settings" tab, you can optionally create the folllowing Actions repository variables:
- `AI_EDITOR_MODEL_PROVIDER`: Either "openai" or "anthropic"; sets this as the default if "(repo default)" was selected in the workflow parameters.
If this is unspecified and "(repo default)" is selected, the workflow will throw an error.
- `AI_EDITOR_LANGUAGE_MODEL`: For the given provider, what model to use if the "model" field in the workflow parameters was left empty.
If this is unspecified, Manubot AI Editor will select the default model for your chosen provider.

### Multiple Providers

In case you want to use several providers in the same repo, you'll have to register an API key for each provider you intend to use.
Like `PROVIDER_API_KEY`, these keys are also registered as GitHub secrets, and can be specified at either the repository or organizational level.

We currently support the following secrets, with more to follow as we integrate more providers:
- `OPENAI_API_KEY`: the API key for the "openai" provider
- `ANTHROPIC_API_KEY`: the API key for the "anthropic" provider
Copy link
Collaborator

Choose a reason for hiding this comment

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

I could be imagining it but was there a reference to an environment variable glossary somewhere? Consider adding a link somewhere nearby if so.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is; it's further down in the document in the "Using from the command line" subsection. Good idea to add a link to it here, too, though, since it elaborates on how API keys are resolved.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

FYI, the link has been added as of 4e5c235.


See [the API key variables docs](https://github.com/manubot/manubot-ai-editor/blob/main/docs/env-vars.md#provider-api-key-configuration) for more information.

### Configuring prompts

In order to revise your manuscript, prompts must be provided to the AI model.
Expand Down Expand Up @@ -140,8 +159,7 @@ specific encodings, you can specify the input encoding with the
`AI_EDITOR_SRC_ENCODING` and the output encoding with the
`AI_EDITOR_DST_ENCODING` environment variables.

See
[these variables' help docs](https://github.com/manubot/manubot-ai-editor/blob/main/docs/env-vars.md#encodings)
See[these variables' help docs](https://github.com/manubot/manubot-ai-editor/blob/main/docs/env-vars.md#encodings)
for more information.

Also, see [Python 3 Docs: Standard Encodings](https://docs.python.org/3/library/codecs.html#standard-encodings) for
Expand Down
14 changes: 5 additions & 9 deletions docs/env-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@ support are "openai" for OpenAI and "anthropic" for Anthropic.

## Provider API Key Configuration

For providers that require API keys, you can specify an API key specific
to that provider via an environment variable named `<PROVIDER>_API_KEY`.
For example, for OpenAI, the API key variable would be named `OPENAI_API_KEY`
and for Anthropic, it would be `ANTHROPIC_API_KEY`.

Alternatively, you can use the environment variable `PROVIDER_API_KEY` to
set an API key that will be used for all providers.
If both a provider-specific key and `PROVIDER_API_KEY` are set, the provider-
specific key will take precedence.
For providers that require API keys, you can specify an API key specific to that provider via an environment variable named `<PROVIDER>_API_KEY`.
For example, for OpenAI, the API key variable would be named `OPENAI_API_KEY` and for Anthropic, it would be `ANTHROPIC_API_KEY`.

Alternatively, you can use the environment variable `PROVIDER_API_KEY` to set an API key that will be used for all providers.
If both a provider-specific key and `PROVIDER_API_KEY` are set, the provider-specific key will take precedence.

## Model Configuration

Expand Down