Skip to content

fix: avoid attempts of using blank environment variables as api keys #57

Description

@zimeg

Some confusion might arise if environment variables are set as empty strings! These providers might still appear in dropdown selections, but will not have a valid token to use.

Preview

$ echo $OPENAI_API_KEY

A quick workaround might unset this variable altogether:

$ unset OPENAI_API_KEY

def __init__(self):
self.api_key = os.environ.get("ANTHROPIC_API_KEY")

def __init__(self):
self.api_key = os.environ.get("OPENAI_API_KEY")

Note

The vertex provider has a guard for this when checking if a Google project should be used:

def __init__(self):
self.enabled = bool(os.environ.get("VERTEX_AI_PROJECT_ID", ""))
if self.enabled:
vertexai.init(
project=os.environ.get("VERTEX_AI_PROJECT_ID"),
location=os.environ.get("VERTEX_AI_LOCATION"),
)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions