From 4fd6a6c209bbcb85190cb9cc6f4fd1daae78d1bf Mon Sep 17 00:00:00 2001 From: Arshan Dabirsiaghi Date: Thu, 23 May 2024 10:34:43 -0400 Subject: [PATCH 1/3] draft spec --- cli.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cli.md b/cli.md index 4633058..50a4e2d 100644 --- a/cli.md +++ b/cli.md @@ -80,6 +80,20 @@ The `executable` could involve multiple command line tokens (e.g., `npm run` or } ``` +## Configuring Azure OpenAI + +Codemods request access to OpenAI models by name, and by default are given access to types that talk to OpenAI directly. It's possible to override the default behavior to use Azure OpenAI in codemods by specifying the following environment variables, like in the following example: + +```bash +CODEMODDER_AZURE_OPENAI_API_KEY= +CODEMODDER_AZURE_OPENAI_ENDPOINT= +CODEMODDER_AZURE_OPENAI_GPT-3_5-TURBO-2024-12-12_DEPLOYMENT= +CODEMODDER_AZURE_OPENAI_GPT-4-TURBO-2024-04-12_API_DEPLOYMENT= +``` + +- Providing `CODEMODDER_AZURE_OPENAI_API_KEY` without `CODEMODDER_AZURE_OPENAI_ENDPOINT` (and vice versa) will cause a failure on startup. +- If using Azure OpenAI and a codemod requests access to a model for which there is no corresponding `CODEMODDER_AZURE_OPENAI_(MODELNAME)_DDEPLOYMENT` variable, the codemod should fail immediately with an error message. + ## Console output The codemodder CLI output is described in [its own specification](logging.md). From 0ff1f30d1a163dc98d73b9710de312dcbff396ed Mon Sep 17 00:00:00 2001 From: Arshan Dabirsiaghi Date: Thu, 23 May 2024 10:50:59 -0400 Subject: [PATCH 2/3] feedback --- cli.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cli.md b/cli.md index 50a4e2d..a047ebf 100644 --- a/cli.md +++ b/cli.md @@ -80,9 +80,18 @@ The `executable` could involve multiple command line tokens (e.g., `npm run` or } ``` -## Configuring Azure OpenAI +## Configuring OpenAI -Codemods request access to OpenAI models by name, and by default are given access to types that talk to OpenAI directly. It's possible to override the default behavior to use Azure OpenAI in codemods by specifying the following environment variables, like in the following example: +You can optionally allow codemods to access OpenAI by adding the following environment variable: +```bash +CODEMODDER_OPENAI_API_KEY= +``` + +In the case of problems communicating with an AI subprocessor, all other codemods should still run normally. + +### Using Azure OpenAI + +Codemods request access to OpenAI models by name, and by default are given access to types that talk to OpenAI directly. It's possible to override the default behavior to use Azure OpenAI in codemods by specifying the following environment variables: ```bash CODEMODDER_AZURE_OPENAI_API_KEY= @@ -92,7 +101,7 @@ CODEMODDER_AZURE_OPENAI_GPT-4-TURBO-2024-04-12_API_DEPLOYMENT= ``` - Providing `CODEMODDER_AZURE_OPENAI_API_KEY` without `CODEMODDER_AZURE_OPENAI_ENDPOINT` (and vice versa) will cause a failure on startup. -- If using Azure OpenAI and a codemod requests access to a model for which there is no corresponding `CODEMODDER_AZURE_OPENAI_(MODELNAME)_DDEPLOYMENT` variable, the codemod should fail immediately with an error message. +- If using Azure OpenAI and a codemod requests access to a model for which there is no corresponding `CODEMODDER_AZURE_OPENAI_(MODELNAME)_DEPLOYMENT` variable, the deployment name will be assumed to be the name of the model (e.g., "gpt-4o"). ## Console output From 1121d377f14b75b5293f36f83a3fc4adb83a719d Mon Sep 17 00:00:00 2001 From: Arshan Dabirsiaghi Date: Thu, 23 May 2024 12:47:18 -0400 Subject: [PATCH 3/3] feedback --- cli.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cli.md b/cli.md index a047ebf..2de1af5 100644 --- a/cli.md +++ b/cli.md @@ -82,7 +82,7 @@ The `executable` could involve multiple command line tokens (e.g., `npm run` or ## Configuring OpenAI -You can optionally allow codemods to access OpenAI by adding the following environment variable: +You can optionally allow codemods to access OpenAI by running with the following environment variable during execution: ```bash CODEMODDER_OPENAI_API_KEY= ``` @@ -91,7 +91,7 @@ In the case of problems communicating with an AI subprocessor, all other codemod ### Using Azure OpenAI -Codemods request access to OpenAI models by name, and by default are given access to types that talk to OpenAI directly. It's possible to override the default behavior to use Azure OpenAI in codemods by specifying the following environment variables: +Codemods request access to OpenAI models by name, and by default are given access to types that talk to OpenAI directly. It's possible to use Azure OpenAI in codemods by specifying the following environment variables: ```bash CODEMODDER_AZURE_OPENAI_API_KEY= @@ -102,6 +102,7 @@ CODEMODDER_AZURE_OPENAI_GPT-4-TURBO-2024-04-12_API_DEPLOYMENT= - Providing `CODEMODDER_AZURE_OPENAI_API_KEY` without `CODEMODDER_AZURE_OPENAI_ENDPOINT` (and vice versa) will cause a failure on startup. - If using Azure OpenAI and a codemod requests access to a model for which there is no corresponding `CODEMODDER_AZURE_OPENAI_(MODELNAME)_DEPLOYMENT` variable, the deployment name will be assumed to be the name of the model (e.g., "gpt-4o"). +- If both Azure and OpenAI instructions are available, Azure will be preferred. ## Console output