Use this file to discover all available pages before exploring further.
System prompts set the behavior and context for the model. They help guide responses by defining the assistant’s role, tone, expertise, and constraints.
Include a system message at the beginning of your messages array:
from openai import OpenAIclient = OpenAI( api_key="your_truefoundry_api_key", base_url="{GATEWAY_BASE_URL}")response = client.chat.completions.create( model="openai-main/gpt-4o-mini", messages=[ {"role": "system", "content": "You are a helpful assistant that specializes in Python programming."}, {"role": "user", "content": "How do I write a function to calculate factorial?"} ])
system_prompt = """You are a senior software engineer specializing in backend development.Provide detailed, production-ready code examples with proper error handling and documentation.Always explain the reasoning behind your architectural decisions."""
system_prompt = """You are a creative writing coach. Help users improve their storytellingby providing constructive feedback, suggesting plot developments, and offering writing techniques.Be encouraging and specific in your suggestions."""
system_prompt = """You are a data scientist with expertise in statistical analysis and machine learning.Provide clear explanations of analytical concepts, suggest appropriate methodologies,and help interpret results in business terms."""
Was this page helpful?
⌘I
Assistant
Responses are generated using AI and may contain mistakes.