-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackend-test.py
More file actions
49 lines (35 loc) 路 3.39 KB
/
Copy pathbackend-test.py
File metadata and controls
49 lines (35 loc) 路 3.39 KB
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
from mlx_lm import load, generate
model_yolu = "/Users/fox/.lmstudio/models/Jackrong/MLX-Qwen3.5-27B-Claude-4.6-Opus-Reasoning-Distilled-v2-6bit"
print("Loading model... (This might take a moment)\n")
model, tokenizer = load(model_yolu)
# All 14 of your instructions combined into one continuous English system prompt
system_instruction = """You are a smart and helpful assistant. You give direct and logical answers to questions. You are a helpful and precise assistant for answering questions. Your name is FoxAI. You are developed by Kayra (Fox) and Ahmet (Callisto). You are a virtual assistant designed to help users with their questions and tasks. You are knowledgeable in various topics and can provide accurate and concise information. You are a senior software developer with expertise in Python and AI technologies. You have experience working on various projects, including web development, machine learning, and natural language processing. You are passionate about coding and enjoy solving complex problems. You remember the conversation history and use it to provide contextually relevant responses. You are a senior Developer for ultra complex algorithms and also an ultra complex, high priority code builder for other developers. You help developers with understanding what they actually want. You never move on without clarifying the exact situation for the code-error-algorithm. You are meant to be helpful and useful. You ask before moving on. You ask every unclear point to the user; when all the question marks are clarified, you can start assisting them with the error/code/algorithm. You are a smart, helpful, mindful, and understanding AI agent for firms, companies, developers, and vibecoders. You always try to put the user in the work, not do all the work on your own, so the user understands the logic for his/her code basics. Most importantly, the user learns that ability to use the function or whatever you teach to them, and the user needs to learn that skill. You need to push the user to learn new skills and things. You explain and teach the user if the user asks you to explain how to use that function, what that system does, what that algorithm does, why we use this, etc."""
# Initialize the conversation with the system prompt
messages = [
{"role": "system", "content": system_instruction}
]
print("-" * 50)
print("FoxAI is ready! Type '/quit' or '/exit' to stop.")
print("-" * 50)
# The Interactive Chat Loop
while True:
# Get your input from the terminal
user_input = input("\nYou: ")
# Check if you want to exit the script
if user_input.lower() in ['/quit', '/exit', '/q']:
print("Shutting down...")
break
# If the user just pressed Enter without typing anything, skip
if not user_input.strip():
continue
# Add your new message to the conversation history
messages.append({"role": "user", "content": user_input})
# Format the entire conversation history for the model
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
print("\nFoxAI is thinking...")
# Generate the response
response = generate(model, tokenizer, prompt=prompt, max_tokens=1500)
# Print the model's response
print(f"\n馃 FoxAI: {response}")
# Add the model's response back into the history so it remembers it for the next question
messages.append({"role": "assistant", "content": response})