Skip to content

Commit 9af7278

Browse files
authored
feat(consensus): add dockerfile, use pydantic, resolve pyright
feat(consensus): add dockerfile, use pydantic, resolve pyright
2 parents dedadb1 + 2fb64cb commit 9af7278

File tree

4 files changed

+9
-40
lines changed

4 files changed

+9
-40
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,5 +265,4 @@ fabric.properties
265265
*.csv
266266
.DS_Store
267267
.ruff_cache/
268-
269-
*.json
268+
final_consensus.json

src/data/final_consensus.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/flare_ai_consensus/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ class Config(BaseSettings):
3939

4040
# Create a global settings instance
4141
config = Config()
42-
logger.debug("settings", settings=config.model_dump())
42+
logger.debug("config", settings=config.model_dump())

tests/working_models.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def _test_model_completion(
4747
"model": model_id,
4848
"messages": [{"role": "user", "content": test_prompt}],
4949
"max_tokens": model.max_tokens,
50-
"temperature": model.max_tokens,
50+
"temperature": model.temperature,
5151
}
5252
send_func = client.send_chat_completion
5353
else:
@@ -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.
@@ -97,16 +96,17 @@ async def filter_working_models(
9796
_test_model_completion(client, model, test_prompt, api_endpoint, delay=i * 3)
9897
for i, model in enumerate(free_models)
9998
]
100-
results = await asyncio.gather(*tasks)
99+
results = await asyncio.gather(*tasks, return_exceptions=True)
101100

102-
valid_models = []
101+
working_models = []
103102
for result in results:
104103
if isinstance(result, Exception):
105104
continue
106-
model, works = result
105+
model, works = result # pyright: ignore [reportGeneralTypeIssues]
107106
if works:
108-
valid_models.append(model)
109-
return valid_models
107+
working_models.append(model)
108+
109+
return working_models
110110

111111

112112
async def main() -> None:

0 commit comments

Comments
 (0)