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

cli configure #1107

Merged
merged 8 commits into from
Feb 8, 2025
Merged

cli configure #1107

merged 8 commits into from
Feb 8, 2025

Conversation

pelikhan
Copy link
Member

@pelikhan pelikhan commented Feb 7, 2025


Here's a high-level summary of the changes:

  1. Added Environment Variables
  • Added structured environment variables support in llms.json for safer AI service configuration
  • Includes fields like API keys, base URLs, required inputs, descriptions, and whether they are secrets (useful for web applications)
export const MODEL_ENVS = Object.freeze<
  providers: {
    "openai": {
      api_key: {
        description: "OpenAI API key",
        required: true,
        secret: true
      },
      openai_api_base: {
        description: "OpenAI API base URL"
      }
    }
  1. New CLI Command
  • Introduced configure as a new CLI command to manage AI service providers
  • Helps set up or update the provider configuration interactively
  • Allows editing of environment variables on local .env file (with proper security confirmation)
const configure = new.--promisesCMD()
  .setHelp('initialize ai service provider')
  1. Updated Configuration Handling
  • Now supports saving/retrieving configuration via the CLI configure command and updates values in both system processes and local files

This change streamlines AI service setup, making it more secure by leveraging environment variables while keeping user interaction simple through interactive prompts when handling sensitive data.

AI-generated content by pr-describe may be incorrect

Copy link

github-actions bot commented Feb 8, 2025

LGTM 🚀

  1. The code in configure.ts looks complete and follows a reasonable pattern for
    CLI-based configuration via an interactive prompt.

  2. A small issue with the order of imports:

    • They import parse from dotenv before reading the .env file, which could cause issues since it's called after. To fix this, they should swap the order so that parse is imported after reading the file.
  3. Another area for improvement: The code assumes provider.env has been defined
    outside of its use in configuration, which may not be appropriate for all cases.

Overall, the changes look good and add a useful configuration capability to the CLI

AI-generated content by pr-review may be incorrect

```sh
npx genaiscript configure
```

## OpenAI
Copy link

Choose a reason for hiding this comment

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

Missing header for new section. Consider adding a brief description or summary of the configure command.

AI-generated content by pr-docs-review-commit missing_header may be incorrect


```bash
npx genaiscript configure
```
Copy link

Choose a reason for hiding this comment

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

Front matter is missing at the beginning of the file. Add front matter to provide metadata and structure for the document.

AI-generated content by pr-docs-review-commit frontmatter_missing may be incorrect

@pelikhan pelikhan merged commit 0a08154 into main Feb 8, 2025
12 of 14 checks passed
@pelikhan pelikhan deleted the cli-configure branch February 8, 2025 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant