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:
parent
0ebfa7c519
commit
d80b29e4f2
3 changed files with 7 additions and 8 deletions
11
enhance.py
11
enhance.py
|
|
@ -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}>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -45,5 +45,4 @@ def moe_select_candidate(query: str, candidates: list[str]) -> str:
|
||||||
**Do NOT** mention candidate numbers, strengths, weaknesses, or any other commentary.
|
**Do NOT** mention candidate numbers, strengths, weaknesses, or any other commentary.
|
||||||
Just give the final answer—nothing else.
|
Just give the final answer—nothing else.
|
||||||
"""
|
"""
|
||||||
return select_prompt.strip()
|
return select_prompt.strip()
|
||||||
|
|
||||||
|
|
@ -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).
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
"""
|
"""
|
||||||
# -------------------------------------------------------------
|
# -------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue