Module de.seggebaeing.sqlanalyzer
Class RateLimitedSQLDummy
java.lang.Object
de.seggebaeing.sqlanalyzer.logic.promptable.impl.dummy.SQLDummy
de.seggebaeing.sqlanalyzer.logic.promptable.impl.dummy.RateLimitedSQLDummy
- All Implemented Interfaces:
Promptable
A dummy
Promptable
implementation that simulates an LLM being occasionally rate-limited.
This class delegates to SQLDummy
for generating a mock SQL query but introduces random
rate-limiting behavior via an internal RateLimiter
. If a rate limit is active,
a RateLimitException
is thrown instead of returning a result.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
RateLimitedSQLDummy
public RateLimitedSQLDummy()
-
-
Method Details
-
prompt
public String prompt(String input, String model, String apiKey, double temperature) throws LLMException Simulates prompting an LLM while enforcing random rate limits.Before delegating to
SQLDummy.prompt(String, String, String, double)
, this method checks whether a rate limit is currently active using theRateLimiter
. If so, it throws aRateLimitException
. Otherwise, it returns the dummy SQL response from the superclass.- Specified by:
prompt
in interfacePromptable
- Overrides:
prompt
in classSQLDummy
- Parameters:
input
- the input prompt textmodel
- the (unused) model identifierapiKey
- the (unused) API keytemperature
- the (unused) sampling temperature- Returns:
- a dummy SQL query string
- Throws:
LLMException
- if a rate limit is active or another error occurs
-