-
Notifications
You must be signed in to change notification settings - Fork 267
Update to latest SDK version #176
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| return | ||
|
|
||
| client = ElevenLabs(api_key=ELEVENLABS_API_KEY) | ||
| elevenlabs = ElevenLabs(api_key=ELEVENLABS_API_KEY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The print_rules function uses the old API path pronunciation_dictionary.download() which should be updated to match the new v2 SDK API structure.
View Details
📝 Patch Details
diff --git a/examples/pronunciation-dictionaries/python/main.py b/examples/pronunciation-dictionaries/python/main.py
index 394ba57..e48a4a2 100644
--- a/examples/pronunciation-dictionaries/python/main.py
+++ b/examples/pronunciation-dictionaries/python/main.py
@@ -17,7 +17,7 @@ if not ELEVENLABS_API_KEY:
def print_rules(client: ElevenLabs, dictionary_id: str, version_id: str):
- rules = client.pronunciation_dictionary.download(
+ rules = client.pronunciation_dictionaries.download(
dictionary_id=dictionary_id,
version_id=version_id,
)
Analysis
Outdated API call in print_rules() function causes AttributeError
What fails: Function print_rules() in examples/pronunciation-dictionaries/python/main.py:20 uses client.pronunciation_dictionary.download() but pronunciation_dictionary attribute doesn't exist in ElevenLabs SDK v2
How to reproduce:
from elevenlabs.client import ElevenLabs
client = ElevenLabs()
client.pronunciation_dictionary.download(dictionary_id="test", version_id="test")Result: AttributeError: 'ElevenLabs' object has no attribute 'pronunciation_dictionary'
Expected: Should use client.pronunciation_dictionaries.download() per ElevenLabs v2 upgrade guide where pronunciation dictionary methods were moved to pronunciation_dictionaries
| let event; | ||
|
|
||
| try { | ||
| event = await elevenLabsClient.webhooks.constructEvent(req.text(), req.headers.get("ElevenLabs-Signature"), secret); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| event = await elevenLabsClient.webhooks.constructEvent(req.text(), req.headers.get("ElevenLabs-Signature"), secret); | |
| event = await elevenLabsClient.webhooks.constructEvent(await req.text(), req.headers.get("ElevenLabs-Signature"), secret); |
The req.text() method call is missing the await keyword, causing the webhook construction to receive a Promise object instead of the actual request body string.
View Details
Analysis
Missing await keyword causes webhook signature verification to fail
What fails: elevenLabsClient.webhooks.constructEvent() in app/api/convai-webhook/route.ts:25 receives Promise instead of string, causing webhook signature verification to reject valid requests
How to reproduce:
# Send POST request to webhook endpoint with valid signature
curl -X POST http://localhost:3000/api/convai-webhook \
-H "Content-Type: application/json" \
-H "ElevenLabs-Signature: t=timestamp,v0=hash" \
-d '{"type":"post_call_transcription","data":{}}'Result: Returns 401 Unauthorized with signature verification error due to Promise object being passed instead of request body string
Expected: Should validate signature correctly when req.text() is properly awaited per Request.text() Web API documentation which returns Promise
No description provided.