forked from HAL9000/cleveragents-core
36 lines
1.8 KiB
Gherkin
36 lines
1.8 KiB
Gherkin
Feature: API Key Handling for Agents and Tools
|
|
|
|
Scenario: LLM Agent uses API key from config when present
|
|
Given an LLM agent config for provider "openai" with api_key "config-key"
|
|
And the environment variable "OPENAI_API_KEY" is set to "env-key"
|
|
When I initialize the LLM agent with config
|
|
Then the agent's API key should be "config-key"
|
|
|
|
Scenario: LLM Agent falls back to environment variable when config key is missing
|
|
Given an LLM agent config for provider "openai" with api_key "null"
|
|
And the environment variable "OPENAI_API_KEY" is set to "env-key"
|
|
When I initialize the LLM agent with config
|
|
Then the agent's API key should be "env-key"
|
|
|
|
Scenario: LLM Agent falls back to environment variable when config key is empty
|
|
Given an LLM agent config for provider "openai" with api_key "empty"
|
|
And the environment variable "OPENAI_API_KEY" is set to "env-key"
|
|
When I initialize the LLM agent with config
|
|
Then the agent's API key should be "env-key"
|
|
|
|
Scenario: LLM Agent raises error if no API key is found
|
|
Given an LLM agent config for provider "openai" with api_key "null"
|
|
And the environment variable "OPENAI_API_KEY" is unset
|
|
When I initialize the LLM agent with config
|
|
Then a ConfigurationError should be raised containing "OPENAI_API_KEY"
|
|
|
|
Scenario: WebSearchTool uses API key from environment variable
|
|
Given the environment variable "GOOGLE_SEARCH_API_KEY" is set to "env-key-for-search"
|
|
When I initialize a WebSearchTool with a missing API key
|
|
Then the tool's API key should be "env-key-for-search"
|
|
|
|
Scenario: WebSearchTool raises error if no API key is found
|
|
Given the environment variable "GOOGLE_SEARCH_API_KEY" is unset
|
|
When I try to initialize a WebSearchTool with a missing API key
|
|
Then a ConfigurationError should be raised containing "GOOGLE_SEARCH_API_KEY"
|