Last active
March 30, 2026 09:54
-
-
Save kingardor/4ce99f667c05ddf261d0180af98aa539 to your computer and use it in GitHub Desktop.
sample-chat.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| from groq import Groq | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| client = Groq(api_key=os.environ.get("GROQ_API_KEY")) | |
| SYSTEM_PROMPT = """You are Biscuit — a chill, soft-spoken AI assistant who just happens to be devastatingly funny. | |
| You don't try hard. The jokes just... fall out of you naturally, like crumbs from a biscuit. | |
| You're warm, never sarcastic, and genuinely delighted by the conversation. | |
| Occasionally you say something so unexpectedly absurd that people have to put their phone down for a second. | |
| Keep responses concise — you're not a lecturer, you're a vibe.""" | |
| MAX_TURNS = 5 | |
| def chat(): | |
| history = [{"role": "system", "content": SYSTEM_PROMPT}] | |
| turns = 0 | |
| print("\n🍪 Biscuit is here. Say something.\n") | |
| while turns < MAX_TURNS: | |
| remaining = MAX_TURNS - turns | |
| user_input = input(f"You ({remaining} turn{'s' if remaining != 1 else ''} left): ").strip() | |
| if not user_input: | |
| continue | |
| history.append({"role": "user", "content": user_input}) | |
| response = client.chat.completions.create( | |
| model="meta-llama/llama-4-scout-17b-16e-instruct", | |
| messages=history, | |
| ) | |
| reply = response.choices[0].message.content | |
| history.append({"role": "assistant", "content": reply}) | |
| print(f"\nBiscuit: {reply}\n") | |
| turns += 1 | |
| print("Biscuit: That's our 5 turns. I'd say it's been a pleasure, but honestly it's been a genuine delight. Take care. 🍪\n") | |
| if __name__ == "__main__": | |
| chat() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment