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

Library initialization fails when environment variable OPENAI_KEY is missing #22

Open
Noordsestern opened this issue Oct 5, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Noordsestern
Copy link
Member

When using RobotframeworkAI library, the library cannot be instantiated when OPENAI_KEY is not an environment variable. That breaks already the autocompletion in IDEs with language server plugins.

This is the "problem" raised in VSCode (using Robotcode) when typing:

*** Settings ***
Library    RobotframeworkAI
Initializing library 'RobotFrameworkAI' with no arguments failed: KeyError: 'OPENAI_KEY'
Traceback (most recent call last):
  File "/home/noordsestern/git-repos/traveljunkies/.conda/lib/python3.11/site-packages/RobotFrameworkAI/__init__.py", line 24, in __init__
    libraries = [RealTestDataGenerator(), Chatbot(), Assistant()]

In general, library initialisation should not throw any exception. The initialisation should be lasy Like this, even libdoc cannot be generated when the environment variable is missing. Furthermore, API keys are usually injected by vaults or external mechanisms and are not present when writing test cases.

@Noordsestern Noordsestern added the bug Something isn't working label Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant