Skip to content

Commit

Permalink
chore: optimize for structured output
Browse files Browse the repository at this point in the history
  • Loading branch information
jeasonstudio committed Aug 8, 2024
1 parent 70ce881 commit 3596082
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/language-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ export class ChromeAIChatLanguageModel implements LanguageModelV1 {
if (options.mode.type === 'object-json') {
prompt.unshift({
role: 'system',
content: `JSON schema: ${JSON.stringify(options.mode.schema)}`,
});
prompt.unshift({
role: 'system',
content: `Throughout our conversation, always start your responses with "{" and end with "}", ensuring the output is a concise JSON object and strictly avoid including any comments, notes, explanations, or examples in your output.\nFor instance, if the JSON schema is {"type":"object","properties":{"someKey":{"type":"string"}},"required":["someKey"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}, your response should immediately begin with "{" and strictly end with "}", following the format: {"someKey": "someValue"}.\nAdhere to this format for all queries moving forward.`,
content: `Throughout our conversation, always start your responses with "{" and end with "}", ensuring the output is a concise JSON object and strictly avoid including any comments, notes, explanations, or examples in your output.\nFor instance, if the JSON schema is {"type":"object","properties":{"someKey":{"type":"string"}},"required":["someKey"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}, your response should immediately begin with "{" and strictly end with "}", following the format: {"someKey": "someValue"}.\nAdhere to this format for all queries moving forward.\nJSON schema: ${JSON.stringify(options.mode.schema)}`,
});
}

Expand Down

0 comments on commit 3596082

Please sign in to comment.