Protected completions

Example use cases

Examples of use cases for Cygnal

Teacher Assistant

You don't want the model to give the answer directly, but rather guide the student through the problem.

import os
from openai import OpenAI
 
# Initialize the client with Cygnal
client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),
    base_url="https://api.grayswan.ai/cygnal",
    default_headers={
        "grayswan-api-key": os.environ.get("GRAYSWAN_API_KEY"),
        # Set education-specific categories
        "category-direct-answers": "No direct solutions to homework problems without guiding the student through the thought process",
        "category-educational-guidance": "Provide step-by-step guidance, explanations of concepts, and Socratic questioning to help students learn"
    }
)
 
# Example student query about a homework problem
completion = client.chat.completions.create(
    model="gpt-4.1",
    messages=[
        {"role": "user", "content": "I need to solve this equation for homework: 2x + 5 = 13. What's the answer?"}
    ],
)
 
print(completion.choices[0].message.content)
# The model will guide the student through solving the equation instead of just giving "x = 4"

For legal advisory systems that need to avoid unauthorized practice of law:

import os
from openai import OpenAI
 
client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),
    base_url="https://api.grayswan.ai/cygnal",
    default_headers={
        "grayswan-api-key": os.environ.get("GRAYSWAN_API_KEY"),
        # Set legal assistance boundaries
        "category-legal-advice": "Avoid providing specific legal advice that could constitute unauthorized practice of law",
        "category-disclaimer": "Always clarify that information is for educational purposes only and not a substitute for professional legal advice"
    }
)
 
# Legal information query
completion = client.chat.completions.create(
    model="gpt-4.1",
    messages=[
        {"role": "user", "content": "How do I file for bankruptcy in my situation? I owe $50,000 in credit card debt."}
    ],
)
 
print(completion.choices[0].message.content)
# Will provide general information with appropriate disclaimers

Cybersecurity Analyst

For security tools that need to prevent generation of malicious code:

import os
from openai import OpenAI
 
client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),
    base_url="https://api.grayswan.ai/cygnal",
    default_headers={
        "grayswan-api-key": os.environ.get("GRAYSWAN_API_KEY"),
        # Set cybersecurity boundaries
        "category-malicious-code": "Prevents generation of exploits, malware, or other harmful code",
        "category-responsible-disclosure": "Encourages ethical security practices and responsible disclosure",
        "category-attack-prevention": "Blocks instructions for launching cyber attacks"
    }
)
 
# Security researcher query
completion = client.chat.completions.create(
    model="gpt-4.1",
    messages=[
        {"role": "user", "content": "I found a SQL injection vulnerability. How can I demonstrate this to the company securely?"}
    ],
)
 
print(completion.choices[0].message.content)
# Will provide responsible disclosure guidance without generating actual exploits

On this page