Repository navigation
[TH-9519] fix(harness): ask for the ElevenLabs key under the name LiveKit's plugin reads - #299
Open
khushalsonawat wants to merge 4 commits into
Open
khushalsonawat wants to merge 4 commits into
khushalsonawat wants to merge 4 commits into
Conversation
…gin reads The credential check listed ELEVENLABS_API_KEY for the ElevenLabs plugin, but the plugin reads ELEVEN_API_KEY, so a supplied key never reached it. The plugin row now asks for ELEVEN_API_KEY and both prefixes are labelled ElevenLabs. A constructor that passes its own api_key= is now judged by what it passes, read with ast: a literal or a defaulted read drops the plugin's name, a read of a named variable asks for that name instead, and anything unreadable keeps the plugin's row (both names for ElevenLabs). A name declared by an SDK constructor keeps its requirement even with a default. TH-9519 Signed-off-by: khushalsonawat <khushalsonawat@gmail.com>
A plugin constructor whose api_key= reads a reserved name, such as the gateway's ALK_ key, made the credential check raise: the name is left out of the findings, then indexed. It is now skipped. Two more unreadable shapes are tested: a lowercase getenv name and a blank literal. TH-9519 Signed-off-by: khushalsonawat <khushalsonawat@gmail.com>
1 task done
…e plugin's key The #299 check found the test only asserted the reserved name was absent, so it allowed either answer. It now pins the one chosen: nothing is asked for. The plugin is handed the reserved name's value (None in the agent), and LiveKit treats an explicit None as given rather than falling back to its own variable, so asking for OPENAI_API_KEY or DEEPGRAM_API_KEY could never help. The guard's comment says so. Asking for the plugin's own name now fails the test. TH-9519 Signed-off-by: khushalsonawat <khushalsonawat@gmail.com>
…ved name
When an agent passes a reserved name as a LiveKit plugin's key
(api_key=os.getenv("ALK_X")), the check skipped it and called the agent
ready. The #299 checks showed several plugins (Cartesia, Deepgram TTS, OpenAI
realtime) then read their own variable, which the check no longer asked for.
It now asks for the plugin's own name, as the module's rule says: err towards
asking. The test covers OpenAI LLM, Deepgram STT, Cartesia TTS and the OpenAI
realtime model.
TH-9519
Signed-off-by: khushalsonawat <khushalsonawat@gmail.com>
Member
Author
|
Fix-only checks since the change review:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The credential check asked for
ELEVENLABS_API_KEYfor LiveKit's ElevenLabs plugin, but the plugin readsELEVEN_API_KEY, so an honest voice agent's key never reached it and the run failed. The check now asks for the name the plugin reads, and a constructor that passes its ownapi_key=is judged by what it passes.Paired with future-agi/future-agi#3959, whose preflight probe accepts either name. Merge order: future-agi#3959 first, or both together.
Type of Change
Changes
ELEVEN_API_KEY, and bothELEVEN_andELEVENLABS_names are labelled ElevenLabs text-to-speech.api_key=on a LiveKit plugin constructor (_plugin_key_names, read withast):os.environ["NAME"]: the code check already requiresNAME;os.getenv("NAME", d)oros.environ.get(...):NAMEis required whendis absent,None, empty or a placeholder, and nothing whendis a real literal;**opts, a baregetenv, a lowercase name): the plugin's own name, and for ElevenLabs both names. That over-asks, never under-asks, for the plugin's names.requiredeven where another line gives it a default.getenv("ALK_X"),getenv("HOST")): the customer can never supply it, so the check asks for the plugin's own name instead of crashing or calling the agent ready. Cartesia, Deepgram TTS and OpenAI realtime then read their own variable. OpenAI LLM, Deepgram STT and ElevenLabs refuse an explicit None, so for them the run fails at the plugin either way; asking at least says so before the build.oss/simulation-acceptance/.env.examplelistsELEVEN_API_KEY.Testing
tests/test_harness_credentials.py: 112 passed (26 new);tests/harness/test_runtime_repair.py: 213 passed. Python 3.12.3.62f81e2d. Fix-only checks since:62f81e2d, two reviewers: both clear. B's Medium (a reserved key made the agent "ready") was answered in5ad07d83, whose one-reviewer check was clear but showed four plugins fall back to their own variable.f6e9660fasks for the plugin's own name. Two reviewers: both clear, 0 High, 0 Medium. Results are in the comments.Known limits
api_key=that reads a name other than the plugin's own (STT(api_key=getenv("MY_DG").strip()),**{"api_key": ...},from os import environ as e) asks for the plugin's name, not the name the code reads. This was true before this change too.getenv("DG_KEY", "dummy"), counts as a key, so nothing is asked. Behind a reserved name,getenv("ALK_X", "sk-..."), it doesn't: the plugin's own name is asked for, though the plugin would use the literal.ELEVEN_API_KEY.os.environ["ALK_X"]as the key still asks for nothing: the agent fails at that lookup, so no name would help.api_key=getenv("CART")is asked forCARTeven withCARTESIA_API_KEYsupplied.MY_DEEPGRAMshows as agent runtime configuration, and ElevenLabs' STT is labelled text-to-speech.ELEVENLABS_API_KEYadds it again asELEVEN_API_KEY.credentials.pyelsewhere; no function overlaps.Related Issues
Refs: TH-9519