Skip to content

Commit 9e63b84

Browse files
authored
chore(openai): update model listing, exclude audio (#6070)
this is especially important when using `provider_model_id="auto"` because all unknown models are considered to be llm/text models, when they may not be. Signed-off-by: Matthew Farrellee <matt@cs.wisc.edu>
1 parent 58441ed commit 9e63b84

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

  • src/ogx/providers/remote/inference/openai

src/ogx/providers/remote/inference/openai/openai.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This source code is licensed under the terms described in the LICENSE file in
55
# the root directory of this source tree.
66

7-
from collections.abc import AsyncIterator
7+
from collections.abc import AsyncIterator, Iterable
88

99
from ogx.log import get_logger
1010
from ogx.providers.utils.inference.openai_mixin import OpenAIMixin
@@ -57,6 +57,7 @@ class OpenAIInferenceAdapter(OpenAIMixin):
5757
supports_tokenized_embeddings_input: bool = True
5858

5959
embedding_model_metadata: dict[str, dict[str, int]] = {
60+
"text-embedding-ada-002": {"embedding_dimension": 1536, "context_length": 8192},
6061
"text-embedding-3-small": {"embedding_dimension": 1536, "context_length": 8192},
6162
"text-embedding-3-large": {"embedding_dimension": 3072, "context_length": 8192},
6263
}
@@ -82,6 +83,19 @@ def _get_max_output_tokens(self, model: str) -> int | None:
8283
)
8384
return None
8485

86+
async def list_provider_model_ids(self) -> Iterable[str]:
87+
"""
88+
Filter out realtime & audio models.
89+
"""
90+
ids = []
91+
for m in await super().list_provider_model_ids():
92+
for excluded in {"whisper", "tts", "realtime", "audio"}:
93+
if excluded in m:
94+
break
95+
else:
96+
ids.append(m)
97+
return ids
98+
8599
def construct_model_from_identifier(self, identifier: str) -> Model:
86100
model = super().construct_model_from_identifier(identifier)
87101

0 commit comments

Comments
 (0)