Skip to content

Commit

Permalink
deploy: 9bb23f0
Browse files Browse the repository at this point in the history
  • Loading branch information
klntsky committed Nov 20, 2024
1 parent 83c2d34 commit b666037
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 145 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,5 @@ <h1 id="links">Links<a class="headerlink" href="#links" title="Permanent link">&

<!--
MkDocs version : 1.6.1
Build Date UTC : 2024-11-20 08:56:49.708931+00:00
Build Date UTC : 2024-11-20 12:05:00.016839+00:00
-->
118 changes: 0 additions & 118 deletions modules/index.html

This file was deleted.

2 changes: 1 addition & 1 deletion search/search_index.json

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
<loc>https://docs.metaprompt-lang.org/</loc>
<lastmod>2024-11-20</lastmod>
</url>
<url>
<loc>https://docs.metaprompt-lang.org/modules/</loc>
<lastmod>2024-11-20</lastmod>
</url>
<url>
<loc>https://docs.metaprompt-lang.org/syntax/</loc>
<lastmod>2024-11-20</lastmod>
Expand Down
Binary file modified sitemap.xml.gz
Binary file not shown.
39 changes: 18 additions & 21 deletions syntax/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,9 @@ <h1 id="text">Text<a class="headerlink" href="#text" title="Permanent link">&par

<p>will be expanded to the same string, because it does not contain any MetaPrompt constructs.</p>
<h1 id="variables">Variables<a class="headerlink" href="#variables" title="Permanent link">&para;</a></h1>
<pre class="codehilite"><code class="language-metaprompt">Here's a variable: [:variable_name].

If a variable is used before first assignment, it is treated as a required
prompt parameter automatically.

[:variable_name=it can be reassigned to any value, however]
[:variable_name=Including a value containing its old value: [:variable_name]]
</code></pre>

<p>Variables should be referenced using this sintax: <code>[:variable_name]</code>. Variable names should match <code>[a-zA-Z_][a-zA-Z0-9_]*</code>.</p>
<p>The syntax for assignments is <code>[:variable_name=any expression]</code>.</p>
<p>Optional assignments use <code>?=</code> instead of <code>=</code> - they update the value only if a variable is unset.</p>
<h1 id="comments">Comments<a class="headerlink" href="#comments" title="Permanent link">&para;</a></h1>
<pre class="codehilite"><code class="language-metaprompt">[# Text for the human reader can be written like this.

Expand Down Expand Up @@ -140,28 +134,31 @@ <h1 id="escaping">Escaping<a class="headerlink" href="#escaping" title="Permanen
<p><code>\\[:foo]</code> → (text <code>\\</code>) (variable <code>foo</code>)</p>
<p><code>\[some text</code> -&gt; (text <code>[some text</code>) - note that in this case the <code>\</code> character disappears, although escaping does not happen because <code>[some text</code> is not a special MetaPrompt construct.</p>
<h1 id="modules">Modules<a class="headerlink" href="#modules" title="Permanent link">&para;</a></h1>
<p>Every <code>.metaprompt</code> file is a function.</p>
<p>Unbound variables used in a file are its parameters, that must be provided.</p>
<pre class="codehilite"><code class="language-metaprompt">Hello, [:what]! [# `what` is a parameter ]
[:who=you] [# `who` is NOT a parameter, because it is assigned before first use]
<p>Every <code>.metaprompt</code> file is a module. Conceptually, a module is a function that accepts a number of arguments, runs the executable parts, and returns text.</p>
<h2 id="passing-parameters">Passing parameters<a class="headerlink" href="#passing-parameters" title="Permanent link">&para;</a></h2>
<p>Unbound variables used in a module are its parameters, that must be provided when calling the module.</p>
<p><strong>Example</strong></p>
<p>Consider a file named <a href="../examples/hello.metaprompt"><code>hello.metaprompt</code></a>:</p>
<pre class="codehilite"><code class="language-metaprompt">Hello, [:what]! [# `what` is a required parameter ]
[:who?=you]
[# ^ `who` is NOT a required parameter, because it is assigned
before first use. However, optional assignment is used, so
the default value can be overridden from the caller module
]
How are [:who] feeling today?
</code></pre>

<p>The <code>hello</code> module can be used like this from <a href="../examples/module-demo.metaprompt">another module</a>:</p>
<pre class="codehilite"><code>[:use ./hello :what=world :who=we]
</code></pre>

<h2 id="file-imports">File imports<a class="headerlink" href="#file-imports" title="Permanent link">&para;</a></h2>
<p>The following expression will include <code>./relative-import.metaprompt</code> file (relative to the directory of the file, NOT to the current working dir):</p>
<pre class="codehilite"><code class="language-metaprompt">[:use ./relative-import]
</code></pre>

<h2 id="package-imports">Package imports<a class="headerlink" href="#package-imports" title="Permanent link">&para;</a></h2>
<p><strong>NOT IMPLEMENTED</strong></p>
<h2 id="passing-parameters">Passing parameters<a class="headerlink" href="#passing-parameters" title="Permanent link">&para;</a></h2>
<pre class="codehilite"><code>[:use ./relative-import
:someParameter= arbitrary value, potentially using
any other MetaPrompt constructs
:otherParameter= another value
]
</code></pre>

<h2 id="special-variables">Special variables<a class="headerlink" href="#special-variables" title="Permanent link">&para;</a></h2>
<ul>
<li><code>MODEL</code> - used to determine active LLM id.</li>
Expand Down

0 comments on commit b666037

Please sign in to comment.