File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,6 @@ async def filter_working_models(
8686 Asynchronously tests each model in free_models with the given test
8787 prompt and API endpoint returning only those models that respond
8888 without an error.
89-
9089 :param client: An instance of AsyncOpenRouterClient.
9190 :param free_models: A list of model dictionaries.
9291 :param test_prompt: The prompt to test.
@@ -98,13 +97,16 @@ async def filter_working_models(
9897 for i , model in enumerate (free_models )
9998 ]
10099 results = await asyncio .gather (* tasks , return_exceptions = True )
101- # Filter out any exceptions and only keep models where works is True.
102- return [
103- model
104- for result in results
105- if not isinstance (result , Exception ) and result [1 ]
106- for model in [result [0 ]]
107- ]
100+
101+ working_models = []
102+ for result in results :
103+ if isinstance (result , Exception ):
104+ continue
105+ model , works = result # pyright: ignore [reportGeneralTypeIssues]
106+ if works :
107+ working_models .append (model )
108+
109+ return working_models
108110
109111
110112async def main () -> None :
You can’t perform that action at this time.
0 commit comments