Diomedes Git
commited on
Commit
·
a2a6cfa
1
Parent(s):
2f85af2
rotating providers for rate lmit dodging
Browse files- src/characters/corvus.py +4 -4
- src/characters/crow.py +2 -2
- src/characters/magpie.py +2 -2
- src/characters/neutral_moderator.py +5 -5
- src/characters/raven.py +4 -4
- src/gradio/app.py +7 -34
src/characters/corvus.py
CHANGED
|
@@ -45,11 +45,11 @@ class Corvus(Character):
|
|
| 45 |
|
| 46 |
if provider_config is None:
|
| 47 |
provider_config = {
|
| 48 |
-
"primary": "
|
| 49 |
-
"fallback": ["
|
| 50 |
"models": {
|
| 51 |
-
"
|
| 52 |
-
"
|
| 53 |
},
|
| 54 |
"timeout": 30,
|
| 55 |
"use_cloud": True
|
|
|
|
| 45 |
|
| 46 |
if provider_config is None:
|
| 47 |
provider_config = {
|
| 48 |
+
"primary": "nebius",
|
| 49 |
+
"fallback": ["groq"],
|
| 50 |
"models": {
|
| 51 |
+
"nebius": "Qwen3-235B-A22B-Instruct-2507",
|
| 52 |
+
"groq": "llama-3.1-8b-instant"
|
| 53 |
},
|
| 54 |
"timeout": 30,
|
| 55 |
"use_cloud": True
|
src/characters/crow.py
CHANGED
|
@@ -62,9 +62,9 @@ class Crow(Character):
|
|
| 62 |
"fallback": ["nebius"],
|
| 63 |
"models": {
|
| 64 |
"groq": "llama-3.1-8b-instant",
|
| 65 |
-
"nebius": "
|
| 66 |
},
|
| 67 |
-
"timeout":
|
| 68 |
"use_cloud": True
|
| 69 |
}
|
| 70 |
|
|
|
|
| 62 |
"fallback": ["nebius"],
|
| 63 |
"models": {
|
| 64 |
"groq": "llama-3.1-8b-instant",
|
| 65 |
+
"nebius": "Qwen3-235B-A22B-Instruct-2507"
|
| 66 |
},
|
| 67 |
+
"timeout": 60,
|
| 68 |
"use_cloud": True
|
| 69 |
}
|
| 70 |
|
src/characters/magpie.py
CHANGED
|
@@ -50,9 +50,9 @@ class Magpie(Character):
|
|
| 50 |
"fallback": ["nebius"],
|
| 51 |
"models": {
|
| 52 |
"groq": "llama-3.1-8b-instant",
|
| 53 |
-
"nebius": "
|
| 54 |
},
|
| 55 |
-
"timeout":
|
| 56 |
"use_cloud": True
|
| 57 |
}
|
| 58 |
|
|
|
|
| 50 |
"fallback": ["nebius"],
|
| 51 |
"models": {
|
| 52 |
"groq": "llama-3.1-8b-instant",
|
| 53 |
+
"nebius": "Qwen3-235B-A22B-Instruct-2507"
|
| 54 |
},
|
| 55 |
+
"timeout": 60,
|
| 56 |
"use_cloud": True
|
| 57 |
}
|
| 58 |
|
src/characters/neutral_moderator.py
CHANGED
|
@@ -23,14 +23,14 @@ class Moderator(Character):
|
|
| 23 |
def __init__(self, location: Optional[str] = None, provider_config: Optional[Dict] = None):
|
| 24 |
super().__init__(location, provider_config)
|
| 25 |
|
| 26 |
-
#
|
| 27 |
if provider_config is None:
|
| 28 |
provider_config = {
|
| 29 |
-
"primary": "
|
| 30 |
-
"fallback": ["
|
| 31 |
"models": {
|
| 32 |
-
"
|
| 33 |
-
"
|
| 34 |
},
|
| 35 |
"timeout": 30,
|
| 36 |
"use_cloud": True
|
|
|
|
| 23 |
def __init__(self, location: Optional[str] = None, provider_config: Optional[Dict] = None):
|
| 24 |
super().__init__(location, provider_config)
|
| 25 |
|
| 26 |
+
# Optimized config for moderator (summarization only, no tools)
|
| 27 |
if provider_config is None:
|
| 28 |
provider_config = {
|
| 29 |
+
"primary": "nebius",
|
| 30 |
+
"fallback": ["groq"],
|
| 31 |
"models": {
|
| 32 |
+
"nebius": "Qwen3-30B-A3B-Instruct-2507", # Quality 85, cost-effective for summaries
|
| 33 |
+
"groq": "llama-3.1-8b-instant" # Fallback
|
| 34 |
},
|
| 35 |
"timeout": 30,
|
| 36 |
"use_cloud": True
|
src/characters/raven.py
CHANGED
|
@@ -44,11 +44,11 @@ class Raven(Character):
|
|
| 44 |
# Default provider priority
|
| 45 |
if provider_config is None:
|
| 46 |
provider_config = {
|
| 47 |
-
"primary": "
|
| 48 |
-
"fallback": ["
|
| 49 |
"models": {
|
| 50 |
-
"
|
| 51 |
-
"
|
| 52 |
},
|
| 53 |
"timeout": 30,
|
| 54 |
"use_cloud": True
|
|
|
|
| 44 |
# Default provider priority
|
| 45 |
if provider_config is None:
|
| 46 |
provider_config = {
|
| 47 |
+
"primary": "nebius",
|
| 48 |
+
"fallback": ["groq"],
|
| 49 |
"models": {
|
| 50 |
+
"nebius": "Qwen3-235B-A22B-Instruct-2507",
|
| 51 |
+
"groq": "llama-3.1-8b-instant"
|
| 52 |
},
|
| 53 |
"timeout": 30,
|
| 54 |
"use_cloud": True
|
src/gradio/app.py
CHANGED
|
@@ -563,28 +563,6 @@ def format_deliberation_html(entries: list | dict) -> str:
|
|
| 563 |
html_parts.append('</div>')
|
| 564 |
return ''.join(html_parts)
|
| 565 |
|
| 566 |
-
# theme = gr.themes.Soft(
|
| 567 |
-
# primary_hue=None,
|
| 568 |
-
# secondary_hue=None,
|
| 569 |
-
# neutral_hue=None,
|
| 570 |
-
# font=None,
|
| 571 |
-
# font_mono=[gr.themes.GoogleFont("JetBrains Mono"), "monospace"],
|
| 572 |
-
# radius_size=None,
|
| 573 |
-
# spacing_size=None,
|
| 574 |
-
# text_size=None,
|
| 575 |
-
# )
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
# theme = gr.themes.Base(
|
| 579 |
-
# primary_hue=None,
|
| 580 |
-
# secondary_hue=None,
|
| 581 |
-
# neutral_hue=None,
|
| 582 |
-
# font=None, # Let CSS handle fonts
|
| 583 |
-
# font_mono=None, # CSS handles monospace fonts
|
| 584 |
-
# radius_size=None, # CSS handles border-radius
|
| 585 |
-
# spacing_size=None, # CSS handles spacing
|
| 586 |
-
# text_size=None, # CSS handles text size
|
| 587 |
-
# )
|
| 588 |
|
| 589 |
# Create Gradio interface
|
| 590 |
with gr.Blocks(title="Cluas Huginn") as demo:
|
|
@@ -604,14 +582,6 @@ with gr.Blocks(title="Cluas Huginn") as demo:
|
|
| 604 |
# TAB 1: Chat mode
|
| 605 |
with gr.Tab("Chat"):
|
| 606 |
gr.Markdown("**Chat Mode:** Talk directly with the council. Use @CharacterName to address specific members.")
|
| 607 |
-
|
| 608 |
-
# Optional accordion for full character bios
|
| 609 |
-
with gr.Accordion("Character Bios", open=False):
|
| 610 |
-
bio_lines = "\n".join([
|
| 611 |
-
f"- **{char.name}** {char.emoji}: {char.location}"
|
| 612 |
-
for char in CHARACTERS
|
| 613 |
-
])
|
| 614 |
-
gr.Markdown(bio_lines)
|
| 615 |
|
| 616 |
# Load avatars dynamically from folder
|
| 617 |
avatar_folder = Path("avatars")
|
|
@@ -630,17 +600,20 @@ with gr.Blocks(title="Cluas Huginn") as demo:
|
|
| 630 |
msg = gr.Textbox(
|
| 631 |
label="Your Message",
|
| 632 |
placeholder="Ask the council a question...",
|
| 633 |
-
scale=
|
| 634 |
container=False,
|
| 635 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 636 |
user_key = gr.Textbox(
|
| 637 |
label="API Key (Optional)",
|
| 638 |
placeholder="OpenAI (sk-...), Anthropic (sk-ant-...), or HF (hf_...)",
|
| 639 |
type="password",
|
| 640 |
-
|
| 641 |
-
container=False,
|
| 642 |
)
|
| 643 |
-
submit_btn = gr.Button("Send", variant="primary", scale=1)
|
| 644 |
|
| 645 |
# Handle submit
|
| 646 |
msg.submit(chat_fn, [msg, chat_state, user_key], [chat_state], queue=True)\
|
|
|
|
| 563 |
html_parts.append('</div>')
|
| 564 |
return ''.join(html_parts)
|
| 565 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 566 |
|
| 567 |
# Create Gradio interface
|
| 568 |
with gr.Blocks(title="Cluas Huginn") as demo:
|
|
|
|
| 582 |
# TAB 1: Chat mode
|
| 583 |
with gr.Tab("Chat"):
|
| 584 |
gr.Markdown("**Chat Mode:** Talk directly with the council. Use @CharacterName to address specific members.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 585 |
|
| 586 |
# Load avatars dynamically from folder
|
| 587 |
avatar_folder = Path("avatars")
|
|
|
|
| 600 |
msg = gr.Textbox(
|
| 601 |
label="Your Message",
|
| 602 |
placeholder="Ask the council a question...",
|
| 603 |
+
scale=4,
|
| 604 |
container=False,
|
| 605 |
)
|
| 606 |
+
submit_btn = gr.Button("Send", variant="primary", scale=1)
|
| 607 |
+
|
| 608 |
+
# API Key input (separated with spacing)
|
| 609 |
+
gr.HTML("<div style='margin-top: 20px;'></div>") # Spacer
|
| 610 |
+
with gr.Column(scale=1, max_width=300):
|
| 611 |
user_key = gr.Textbox(
|
| 612 |
label="API Key (Optional)",
|
| 613 |
placeholder="OpenAI (sk-...), Anthropic (sk-ant-...), or HF (hf_...)",
|
| 614 |
type="password",
|
| 615 |
+
container=True,
|
|
|
|
| 616 |
)
|
|
|
|
| 617 |
|
| 618 |
# Handle submit
|
| 619 |
msg.submit(chat_fn, [msg, chat_state, user_key], [chat_state], queue=True)\
|