You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ability to query the response headers, specifically to get the request-id.
The client.TextToSpeechClient class doesn't expose the HTTPS response object, nor the request-id. That makes it difficult to populate the previous_request_ids argument to methods such as convert.
Including the response as an attribute would allow generational conditioning from the Python API, as in the code below:
previous_request_ids = deque(maxlen=MAX_REQUEST_IDS)
# The following code is in a loop iterating over the lines of text.
try:
previous_text = OMIT if is_first_paragraph or len(text) == 1 else ' '.join(text[:line_no])
next_text = OMIT if is_last_paragraph or len(text) == 1 else ' '.join(text[line_no + 1:])
previous_request_argument = previous_request_ids if ((len(previous_request_ids) > 0)
and condition_on_past_generations) else OMIT
audio = client.text_to_speech.convert(
voice_id=voice_id,
optimize_streaming_latency=None,
output_format=output_format,
text=line,
model_id=model,
voice_settings=settings,
previous_text=previous_text,
next_text=next_text,
previous_request_ids=previous_request_argument,
pronunciation_dictionary_locators=pronunciation_dictionary_locators
)
except Exception as e:
log_exception(e)
print(e)
break
else:
for chunk in audio:
audio_segments.append(chunk)
if condition_on_past_generations:
request_id = client.text_to_speech.response.headers['request-id'] # <------------------
if request_id:
previous_request_ids.append(request_id)
Use Case
Passing previous request IDs to the various methods of the TextToSpeechClient object.
The methods accept a previous_request_ids argument, but the class doesn't provide an obvious way to obtain the request IDs.
Alternatives Considered
At the moment I edit client.py to add the attribute:
Feature Description
Ability to query the response headers, specifically to get the request-id.
The client.TextToSpeechClient class doesn't expose the HTTPS response object, nor the request-id. That makes it difficult to populate the
previous_request_ids
argument to methods such asconvert
.Including the response as an attribute would allow generational conditioning from the Python API, as in the code below:
Use Case
Passing previous request IDs to the various methods of the TextToSpeechClient object.
The methods accept a
previous_request_ids
argument, but the class doesn't provide an obvious way to obtain the request IDs.Alternatives Considered
At the moment I edit client.py to add the attribute:
then update self.response from _response in each of the methods. I have to make that change again each time the elevenlabs package is updated.
Additional Context
No response
The text was updated successfully, but these errors were encountered: