File size: 3,066 Bytes
42bba47 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
#!/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() |