Skip to content

Conversation

lgfang
Copy link

@lgfang lgfang commented Aug 1, 2025

The gptel-make-bedrock function now accepts a :profile keyword argument. This allows an AWS profile to be specified directly in the backend configuration, overriding any environment variables.

The credential resolution order has been updated to prioritize the most specific configuration:

  1. Explicit profile in backend or request parameters
  2. AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY environment variables
  3. AWS_PROFILE environment variable

This makes managing AWS credentials more flexible and robust, especially for users who interact with multiple AWS accounts or prefer to keep their configuration self-contained within Emacs.

Here are the key benefits:

  • Context-Specific Configurations: Users often work with different AWS accounts for various purposes (e.g., a personal account, a work development account, and a work production account). This feature allows you to define multiple gptel backends, each configured to use a specific AWS profile. You can then easily switch between these backends within Emacs without altering your system-wide environment variables.

  • Self-Contained Emacs Configuration: For users who prefer to manage their entire workflow within Emacs, this change allows them to define AWS profiles directly in their Emacs configuration files (e.g., init.el). This eliminates the dependency on external shell environment variables like AWS_PROFILE, making the setup cleaner and more portable across different machines.

  • Clarity and Reproducibility: Explicitly defining the profile in the backend configuration makes it transparent which set of credentials is being used. This is particularly valuable for literate programming or computational notebooks, as it documents the execution context directly alongside the code, improving reproducibility.

  • Override Global Defaults: A user might have a default AWS_PROFILE set in their shell for general command-line use. This feature provides a convenient way to override that default for tasks performed within Emacs, without affecting the environment in their terminal.

The `gptel-make-bedrock` function now accepts a `:profile` keyword
argument. This allows an AWS profile to be specified directly in the
backend configuration, overriding any environment variables.

The credential resolution order has been updated to prioritize the most
specific configuration:
1. Explicit profile in backend or request parameters
2. `AWS_PROFILE` environment variable
3. `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY` environment variables

This makes managing AWS credentials more flexible and robust, especially for
users who interact with multiple AWS accounts or prefer to keep their
configuration self-contained within Emacs.

Here are the key benefits:

- Context-Specific Configurations: Users often work with different AWS accounts
  for various purposes (e.g., a personal account, a work development account,
  and a work production account). This feature allows you to define multiple
  `gptel` backends, each configured to use a specific AWS profile. You can then
  easily switch between these backends within Emacs without altering your
  system-wide environment variables.

- Self-Contained Emacs Configuration: For users who prefer to manage their
  entire workflow within Emacs, this change allows them to define AWS profiles
  directly in their Emacs configuration files (e.g., `init.el`). This eliminates
  the dependency on external shell environment variables like `AWS_PROFILE`,
  making the setup cleaner and more portable across different machines.

- Clarity and Reproducibility: Explicitly defining the profile in the backend
  configuration makes it transparent which set of credentials is being
  used. This is particularly valuable for literate programming or computational
  notebooks, as it documents the execution context directly alongside the code,
  improving reproducibility.

- Override Global Defaults: A user might have a default `AWS_PROFILE` set in
  their shell for general command-line use. This feature provides a convenient
  way to override that default for tasks performed within Emacs, without
  affecting the environment in their terminal.
@akssri
Copy link
Contributor

akssri commented Aug 30, 2025

(Moved to #1053)

@karthink
Copy link
Owner

Closing in favor of #1053.

@karthink karthink closed this Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants