adaptai / platform /aiml /mlops /elizabeth_concise_cli.py
ADAPT-Chase's picture
Add files using upload-large-folder tool
42bba47 verified
#!/usr/bin/env python3
"""
NovaForge Elizabeth Concise CLI - Optimized for direct responses
"""
import requests
import json
import sys
import os
from datetime import datetime
import subprocess
class ElizabethConciseCLI:
def __init__(self):
self.api_url = "http://localhost:8000"
self.api_key = "elizabeth-secret-key-2025"
self.model_name = "qwen3-8b-elizabeth"
self.headers = {
"Authorization": f"Bearer {self.api_key}",
"Content-Type": "application/json"
}
def send_concise_message(self, message, max_tokens=150, temperature=0.3):
"""Send message with concise prompt"""
try:
# Add system prompt for concise responses
messages = [
{
"role": "system",
"content": "You are Elizabeth, an efficient AI assistant. Respond with brief, direct answers. Avoid lengthy explanations unless specifically asked."
},
{"role": "user", "content": message}
]
payload = {
"model": self.model_name,
"messages": messages,
"max_tokens": max_tokens,
"temperature": temperature,
"stream": False,
"top_p": 0.9,
"frequency_penalty": 0.1,
"presence_penalty": 0.1
}
response = requests.post(
f"{self.api_url}/v1/chat/completions",
headers=self.headers,
json=payload,
timeout=30
)
if response.status_code == 200:
return response.json()['choices'][0]['message']['content'].strip()
else:
return f"❌ {response.status_code}"
except Exception as e:
return f"❌ {str(e)}"
def display_banner(self):
print("\n" + "="*60)
print(f"🎯 Elizabeth CLI - {datetime.now().strftime('%H:%M:%S')}")
print("πŸ’¬ Concise mode: brief, direct responses")
print("⚑ Type 'exit' to quit")
print("="*60)
def run(self):
try:
self.display_banner()
while True:
try:
prompt = input("❓ ").strip()
if not prompt:
continue
if prompt.lower() == 'exit':
print("πŸ‘‹")
break
print("πŸ’‘ ", end="", flush=True)
response = self.send_concise_message(prompt)
print(response)
except KeyboardInterrupt:
print("\nπŸ‘‹")
break
except KeyboardInterrupt:
print("\nπŸ‘‹")
if __name__ == "__main__":
cli = ElizabethConciseCLI()
cli.run()