diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ae534f4..8d8ada9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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: @@ -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 diff --git a/README.md b/README.md index 6e6b7a9..5840393 100644 --- a/README.md +++ b/README.md @@ -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 + +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. @@ -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 diff --git a/docs/env-vars.md b/docs/env-vars.md index e5b84ad..521e63c 100644 --- a/docs/env-vars.md +++ b/docs/env-vars.md @@ -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 `_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 `_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