-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom system prompt? #171
Comments
System prompt is first message in chat from const UserSchema = z.object({
// Description will be used in the prompt
age: z.number().min(0).max(120).int().describe('The age of the user'),
firstName: z
.string()
.describe(
'The first name of the user, lowercase with capital first letter'
),
surname: z
.string()
.describe('The surname of the user, lowercase with capital first letter'),
sex: z
.enum(['M', 'F'])
.describe('The sex of the user, guess if not provided'),
})
// User will be of type z.infer<typeof UserSchema>
const user = await client.chat.completions.create({
messages: [
{
role: 'system',
content:
'You are a world class extractor. You always respond in JSON. Current date is ' +
new Date().toISOString(),
},
{
role: 'user',
content: 'John Doe born in 1988',
},
],
model: 'llama3-70b-8192',
temperature: 0.0,
max_retries: 3,
response_model: { schema: UserSchema, name: 'UserSchema' },
}) |
The system prompt I mentioned is added to the array of messages before your "You are a world class extractor..." message. So there are two system prompts with your example stacked. |
This system prompt is only used when using the "MD_JSON" mode - it gets added in the params resolver that we use here: I have not had any requests to be able to customize, but it would be relatively straightforward to add an option - I've mostly just tried to avoid adding too many options but maybe a straight up pass-through to zod-stream would work? |
this issue is now urgent with the o1 models erroring when a system prompt is given
and you seem to inject ith with EVERY mode not just |
Where is this system prompt coming from and can it be customized?
The text was updated successfully, but these errors were encountered: