MarketSquare / MarketSquare/robotframework-ai

Library initialization fails when environment variable `OPENAI_KEY` is missing

Open
#22 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
38
Forks
6
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at RobotFrameworkAI/init.py, especially the initialization path shown at line 24, and reproduce library loading without OPENAI_KEY. Done means library initialization and libdoc generation no longer raise when the variable is absent, while AI-dependent use remains deferred until credentials are available.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.