Skip to content

Conversation

@adrian-cowham
Copy link
Contributor

No description provided.

@adrian-cowham adrian-cowham requested a review from longcw November 26, 2025 06:38
Copy link
Contributor

@chenghao-mou chenghao-mou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Not sure if this is discussed before: there is a side effect on the logs/metrics part—if a fallback is chosen inside gateway, we will still report metrics/logs under _opts.model.

@adrian-cowham
Copy link
Contributor Author

Yeah, that's interesting i wonder if we should find a way to report back the model used by Inference. Also, @chenghao-mou can you coordinate with me before merging and releasing?

@adrian-cowham
Copy link
Contributor Author

Also, I just pushed a small change to address 3.9 type checks, hopefully.

Copy link
Member

@theomonnom theomonnom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise lgtm! Nice work!

name: Required[str]
"""Model name (e.g. "cartesia/sonic", "elevenlabs/eleven_flash_v2", "rime/arcana")."""

voice: Required[str | None]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the voice be None? Is this different than omitting it (removing the Required flag)

Comment on lines +95 to +102
class Fallback(TypedDict, total=False):
"""Configuration for fallback models when the primary model fails."""

models: Required[Sequence[FallbackModelType]]
"""Fallback models in priority order."""

connection: ConnectionOptions
"""Connection options for fallback attempts."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if this class is really useful.

Maybe the argument inside the TTS/STT can directly accept a Sequence of FallbackModelType and the ConnectionOptions can directly be inside the constructor?

Probably nitpicking but maybe we can also re-use

class APIConnectOptions:
?

I'm not 100% sure, wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, we already have conn_options as a parameter in stream or _recognize_impl, but it is often used with the default value somewhere behind the scenes (not exposed to the user). I think it is a good idea to expose this at the constructor level for all of them (we can start with inference in this PR) with the existing APIConnectOptions.

@chenghao-mou
Copy link
Contributor

Yeah, that's interesting i wonder if we should find a way to report back the model used by Inference. Also, @chenghao-mou can you coordinate with me before merging and releasing?

That would be nice-to-have, and we can do that in a later PR. And yes, I should be able to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants