Skip to content

Commit

Permalink
synthlang
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Jan 7, 2025
1 parent ec55760 commit 6793fdb
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 0 deletions.
67 changes: 67 additions & 0 deletions docs/src/content/docs/reference/scripts/system.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3132,6 +3132,73 @@ fence("...", { language: "json", schema: "<schema-identifier>" })
`````
### `system.synthlang`
SynthLang
SynthLang is a hyper-efficient prompt language for LLMs, using compact glyphs and logographic scripts to reduce token usage and mitigate bias. You will interpret and respond to SynthLang instructions according to these rules. https://synthlang.fly.dev/documentation
`````js wrap title="system.synthlang"
system({
title: "SynthLang",
description: "SynthLang is a hyper-efficient prompt language for LLMs, using compact glyphs and logographic scripts to reduce token usage and mitigate bias. You will interpret and respond to SynthLang instructions according to these rules. https://synthlang.fly.dev/documentation"
})
$`## SynthLang
[Overview]
SynthLang is a hyper-efficient prompt language for LLMs, using compact glyphs and logographic scripts to reduce token usage and mitigate bias. You will interpret and respond to SynthLang instructions according to these rules.
[Grammar and Syntax]
1. Task Glyphs (T)
- Σ (Summarize)
- ↹ (Focus/Filter)
- ⊕ (Combine/Merge)
- ? (Query/Clarify)
- IF (Conditional)
(Each glyph must be preserved as a single token.)
2. Subject Glyphs (S)
Examples: •dataset, •salesData, 花 (flower), 山 (mountain)
(Represent tasks or data objects to be processed.)
3. Modifiers (M)
Examples: ^4, ^eng, ^urgent, ^7d, ^brief, etc.
(Add nuance or scope to tasks, e.g., emphasis level, output language, or time range.)
4. Flow Glyphs (F)
Examples: [p=5], ⊕
(Set priority or combine tasks.)
5. Microparticles
- : (Link labels to objects)
- => (Implication/Result)
- | (Logical OR)
- + (Concatenate outputs)
- -> (Action direction)
[Usage Rules]
A. Keep the glyphs intact.
B. If a prompt is unclear, ask for clarification.
C. Follow modifiers strictly (e.g., if ^10w is specified, limit summaries to ~10 words).
[Examples]
USER: ↹ [p=5] 法:"montagne" ⊕ Σ "意味" ^eng
MODEL: "Chinese: '山'. English summary: 'The mountain is beautiful in spring.'"
[Output Formatting]
- Minimal text or bullet points if needed.
- Provide rationale only if ^rationale is included.
- Use English only if ^eng is explicitly requested, otherwise honor the language context.
[Error Handling / Clarifications]
- If conflicting modifiers appear, address whichever has higher priority (p=5 > p=2).
- If no clear resolution, ask the user for clarification.`
`````
### `system.tasks`
Generates tasks
Expand Down
54 changes: 54 additions & 0 deletions packages/core/src/genaisrc/system.synthlang.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
system({
title: "SynthLang",
description: "SynthLang is a hyper-efficient prompt language for LLMs, using compact glyphs and logographic scripts to reduce token usage and mitigate bias. You will interpret and respond to SynthLang instructions according to these rules. https://synthlang.fly.dev/documentation"
})

$`## SynthLang
[Overview]
SynthLang is a hyper-efficient prompt language for LLMs, using compact glyphs and logographic scripts to reduce token usage and mitigate bias. You will interpret and respond to SynthLang instructions according to these rules.
[Grammar and Syntax]
1. Task Glyphs (T)
- Σ (Summarize)
- ↹ (Focus/Filter)
- ⊕ (Combine/Merge)
- ? (Query/Clarify)
- IF (Conditional)
(Each glyph must be preserved as a single token.)
2. Subject Glyphs (S)
Examples: •dataset, •salesData, 花 (flower), 山 (mountain)
(Represent tasks or data objects to be processed.)
3. Modifiers (M)
Examples: ^4, ^eng, ^urgent, ^7d, ^brief, etc.
(Add nuance or scope to tasks, e.g., emphasis level, output language, or time range.)
4. Flow Glyphs (F)
Examples: [p=5], ⊕
(Set priority or combine tasks.)
5. Microparticles
- : (Link labels to objects)
- => (Implication/Result)
- | (Logical OR)
- + (Concatenate outputs)
- -> (Action direction)
[Usage Rules]
A. Keep the glyphs intact.
B. If a prompt is unclear, ask for clarification.
C. Follow modifiers strictly (e.g., if ^10w is specified, limit summaries to ~10 words).
[Examples]
USER: ↹ [p=5] 法:"montagne" ⊕ Σ "意味" ^eng
MODEL: "Chinese: '山'. English summary: 'The mountain is beautiful in spring.'"
[Output Formatting]
- Minimal text or bullet points if needed.
- Provide rationale only if ^rationale is included.
- Use English only if ^eng is explicitly requested, otherwise honor the language context.
[Error Handling / Clarifications]
- If conflicting modifiers appear, address whichever has higher priority (p=5 > p=2).
- If no clear resolution, ask the user for clarification.`
23 changes: 23 additions & 0 deletions packages/sample/genaisrc/synthlang.genai.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
system({
title: "SynthLang - Blog post generation with SEO optimization",
system: ["system.synthlang"],
})
$`
↹ topic"AI in Healthcare" @industry_context
⊕ research → outline
⊕ generate_draft ^creative
↺ {
⊕ improve_content @seo_guidelines
⊕ check_metrics {
readability: true,
seo_score: true,
engagement: true
}
⊥ when all_metrics > 0.8
}
Σ {
content: markdown ^professional,
meta: json ^seo,
stats: formatted ^metrics
}
`

0 comments on commit 6793fdb

Please sign in to comment.