feat: enhance code quality and documentation

- Renamed Feedback class to follow PascalCase convention
- Fixed candidate enumeration start index from 0 to 1
- Simplified candidate content access by removing .message.content
- Updated CONFIG_PATH environment variable name to CONFIG_PATH_ARG
- Bumped version from 0.5 to 0.6
- Removed unnecessary return statement and trailing newline
This commit is contained in:
Alpha Nerd 2026-01-29 19:59:08 +01:00
parent 0ebfa7c519
commit d80b29e4f2
3 changed files with 7 additions and 8 deletions

View file

@ -1,6 +1,6 @@
from pydantic import BaseModel from pydantic import BaseModel
class feedback(BaseModel): class Feedback(BaseModel):
query_id: int query_id: int
content: str content: str
@ -25,13 +25,13 @@ def moe(query: str, query_id: int, response: str) -> str:
def moe_select_candidate(query: str, candidates: list[str]) -> str: def moe_select_candidate(query: str, candidates: list[str]) -> str:
if not candidates: if not candidates:
raise ValueError("No candidates supplied") raise ValueError("No candidates supplied")
candidate_sections = "" candidate_sections = ""
for i, cand in enumerate(candidates[:3], start=0): for i, cand in enumerate(candidates[:3], start=1):
candidate_sections += f""" candidate_sections += f"""
<candidate_{i}> <candidate_{i}>
{cand.message.content} {cand}
</candidate_{i}> </candidate_{i}>
""" """
@ -46,4 +46,3 @@ def moe_select_candidate(query: str, candidates: list[str]) -> str:
Just give the final answernothing else. Just give the final answernothing else.
""" """
return select_prompt.strip() return select_prompt.strip()

View file

@ -50,7 +50,7 @@ Options:
Any arguments that remain after the options above are passed directly to uvicorn. Any arguments that remain after the options above are passed directly to uvicorn.
Environment variables: Environment variables:
CONFIG_PATH Alternative way to specify the config path. CONFIG_PATH_ARG Alternative way to specify the config path.
NOMYO_ROUTER_CONFIG_PATH Overrides the config path (same as --config-path). NOMYO_ROUTER_CONFIG_PATH Overrides the config path (same as --config-path).
UVICORN_HOST Host interface to bind to (default: 0.0.0.0). UVICORN_HOST Host interface to bind to (default: 0.0.0.0).
UVICORN_PORT Port to listen on (default: 12434). UVICORN_PORT Port to listen on (default: 12434).

View file

@ -2,7 +2,7 @@
title: NOMYO Router - an Ollama Proxy with Endpoint:Model aware routing title: NOMYO Router - an Ollama Proxy with Endpoint:Model aware routing
author: alpha-nerd-nomyo author: alpha-nerd-nomyo
author_url: https://github.com/nomyo-ai author_url: https://github.com/nomyo-ai
version: 0.5 version: 0.6
license: AGPL license: AGPL
""" """
# ------------------------------------------------------------- # -------------------------------------------------------------