Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -265,5 +265,4 @@ fabric.properties
*.csv
.DS_Store
.ruff_cache/

*.json
final_consensus.json
30 changes: 0 additions & 30 deletions src/data/final_consensus.json

This file was deleted.

2 changes: 1 addition & 1 deletion src/flare_ai_consensus/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ class Config(BaseSettings):

# Create a global settings instance
config = Config()
logger.debug("settings", settings=config.model_dump())
logger.debug("config", settings=config.model_dump())
14 changes: 7 additions & 7 deletions tests/working_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def _test_model_completion(
"model": model_id,
"messages": [{"role": "user", "content": test_prompt}],
"max_tokens": model.max_tokens,
"temperature": model.max_tokens,
"temperature": model.temperature,
}
send_func = client.send_chat_completion
else:
Expand Down Expand Up @@ -86,7 +86,6 @@ async def filter_working_models(
Asynchronously tests each model in free_models with the given test
prompt and API endpoint returning only those models that respond
without an error.

:param client: An instance of AsyncOpenRouterClient.
:param free_models: A list of model dictionaries.
:param test_prompt: The prompt to test.
Expand All @@ -97,16 +96,17 @@ async def filter_working_models(
_test_model_completion(client, model, test_prompt, api_endpoint, delay=i * 3)
for i, model in enumerate(free_models)
]
results = await asyncio.gather(*tasks)
results = await asyncio.gather(*tasks, return_exceptions=True)

valid_models = []
working_models = []
for result in results:
if isinstance(result, Exception):
continue
model, works = result
model, works = result # pyright: ignore [reportGeneralTypeIssues]
if works:
valid_models.append(model)
return valid_models
working_models.append(model)

return working_models


async def main() -> None:
Expand Down