// Multi-turn conversation example openai = require("openai") // Create a stateful conversation with custom configuration chat = openai.session({ system = "You are a helpful assistant that teaches programming concepts", temperature = 0.8 }) // First turn print("User: What is a closure?") response1 = chat.prompt("What is a closure?") print("Assistant: " + response1) print("") // Second turn - context is maintained across prompts print("User: Can you give me a code example?") response2 = chat.prompt("Can you give me a code example?") print("Assistant: " + response2) print("") // Check token usage print("Tokens used: " + format_json(chat.usage)) // Clear conversation for new session if needed // chat.clear()