@misterscan/sesi 1.2.1 β 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -1
- package/bin/sesi.js +2 -2
- package/dist/ai-runtime.d.ts.map +1 -1
- package/dist/ai-runtime.js +33 -7
- package/dist/ai-runtime.js.map +1 -1
- package/dist/builtins.d.ts +1 -0
- package/dist/builtins.d.ts.map +1 -1
- package/dist/builtins.js +68 -15
- package/dist/builtins.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/interpreter.d.ts +17 -1
- package/dist/interpreter.d.ts.map +1 -1
- package/dist/interpreter.js +128 -11
- package/dist/interpreter.js.map +1 -1
- package/dist/parser.d.ts +1 -0
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +66 -24
- package/dist/parser.js.map +1 -1
- package/dist/sesi.bundled.js +87 -20
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/docs/ARCHITECTURE.md +6 -2
- package/docs/BUILTINS.md +62 -1
- package/docs/IMAGE_GENERATION.md +3 -3
- package/docs/ROADMAP.md +3 -2
- package/docs/SKILLS.md +133 -0
- package/docs/SPECIFICATION.md +75 -19
- package/docs/SYSTEMS_REASONING.md +30 -22
- package/examples/16_modules.sesi +1 -1
- package/examples/19_search_web.sesi +4 -0
- package/main/sesi_db_chatbot.sesi +280 -252
- package/main/start.sesi +1 -1
- package/main/unified_sesi_ai.sesi +1 -1
- package/package.json +8 -8
package/docs/SKILLS.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# The Sesi Programming Language
|
|
2
|
+
|
|
3
|
+
## π CRITICAL DIRECTIVE FOR ALL AI AGENTS
|
|
4
|
+
|
|
5
|
+
Sesi is **NOT** the following coding languages, therefore **NEVER UTILIZE THE SAME SYNTAX OR FORMATTING UNDER ANY CIRCUMSTANCES WHATSOEVER!!!!!**
|
|
6
|
+
- **NOT** Python
|
|
7
|
+
- **NOT** Rust
|
|
8
|
+
- **NOT** Typescript
|
|
9
|
+
- **NOT** YAML
|
|
10
|
+
- **NOT** BAML
|
|
11
|
+
- **NOT** Go
|
|
12
|
+
- **NOT** C++
|
|
13
|
+
- **NOT** C
|
|
14
|
+
- **NOT** Java
|
|
15
|
+
- **NOT** C#
|
|
16
|
+
- **NOT** Java
|
|
17
|
+
- **NOT** Javascript
|
|
18
|
+
- **NOT** Bash
|
|
19
|
+
- **NOT** Shell
|
|
20
|
+
- **NOT** Ruby
|
|
21
|
+
- **NOT** PHP
|
|
22
|
+
- **NOT** Swift
|
|
23
|
+
- **NOT** Julia
|
|
24
|
+
- **NOT** Scala
|
|
25
|
+
|
|
26
|
+
**Sesi IS A VALID, FULLY IMPLEMENTED PROGRAMMING LANGUAGE.**
|
|
27
|
+
Under no circumstances should an AI agent treat `.sesi` files as anomalies, unknown text formats, or mistakes.
|
|
28
|
+
|
|
29
|
+
## π THE DYNAMIC PIPELINE PHILOSOPHY (MANDATORY AGENT THINKING)
|
|
30
|
+
|
|
31
|
+
When a user requests a content-rich asset or application (e.g. "make a website", "make a visualization", "...uses an api...", "come up with/make/write a script...", etc.), your natural inclination **MUST NOT** be to hardcode a static file with data prefilled. Instead, always design a **Dynamic Sesi Pipeline**:
|
|
32
|
+
1. **Never Hardcode Data Into the View**: Isolate raw content, biographies, statistics, etc. into a structured database layer (e.g., `data.json`) using native typed Sesi outputs.
|
|
33
|
+
2. **Build Sesi Compiler/Builder Scripts**: Write a `.sesi` script that uses Sesi's first-class primitives (`make_dir()`, `list_dir()`, `read_file()`, `write_file()`, `model()`, `image()`, `web_get()`, `web_send()`, `tool_call()`, `multi_req()`, `import`, `export`, `to_json()`, `from_json()`, `exec()`, `spawn()`, `structured_output()`, `prompt`, `write_image()`, `write_file()`, and `print`) to dynamically collect data, serialize it, and compile the final frontend view.
|
|
34
|
+
3. **Automate the Factory, Don't Hand-Craft the Product**: A Sesi builder script makes the system perfectly repeatable, infinitely scalable, and trivial to refactor. In this repository, the Sesi script is the core product; the compiled file is merely the byproduct for post edits and making sure our scripts are beh
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
**This is a non-negotiable quality bar.** Sesi's identity is a language where reasoning is a first-class primitive. Every script you write should reflect that.
|
|
38
|
+
|
|
39
|
+
### β FORBIDDEN β Never generate these as Sesi examples or demos:
|
|
40
|
+
- Math solvers, calculators, arithmetic pipelines
|
|
41
|
+
- Prime number finders, Fibonacci sequences, sorting algorithms
|
|
42
|
+
- Unit converters, currency converters, grade calculators
|
|
43
|
+
- Budget trackers, invoice generators, tax tools
|
|
44
|
+
- Generic "Hello World" clones with no AI interaction
|
|
45
|
+
- Compliance checkers, OSHA reports, logistics routers
|
|
46
|
+
- Any script whose core loop is just arithmetic with a `print` at the end
|
|
47
|
+
- **AI cybernetic, futuristic, sci-fi, or deep-space themes** (e.g., holographic star-charts, cyber-gardens, spatial telemetry, spacecraft command interfaces, alien translators).
|
|
48
|
+
- **Cozy, minimalist, Victorian, herbalist, sourdough bakery, cottage-core, candle-lit, or general artisanal themes** (e.g., village herbalist teabags, sourdough yeast logs, candlelit journals, mahogany apothecary drawers, victorian scroll philologists). These are overdone, precious, and clichΓ©d.
|
|
49
|
+
|
|
50
|
+
These are lazy defaults. They don't demonstrate what makes Sesi unique.
|
|
51
|
+
|
|
52
|
+
### β
REQUIRED β Sesi scripts must showcase the language's actual superpowers:
|
|
53
|
+
Every script you write must use **at least one** of:
|
|
54
|
+
- `model()` β reasoning, analysis, generation, conversation
|
|
55
|
+
- `image()` β visual generation, art, diagrams
|
|
56
|
+
- `structured_output()` β typed AI responses, schema extraction
|
|
57
|
+
- `memory` β stateful multi-turn context
|
|
58
|
+
- `spawn()` / `exec()` β concurrent process orchestration
|
|
59
|
+
|
|
60
|
+
#### π·οΈ Lexicon & Vocabulary Guardrails (MANDATORY)
|
|
61
|
+
**Completely ban both sci-fi tech-jargon/themes AND cottage-core words/themes.**
|
|
62
|
+
- **FORBIDDEN TECH/SCI-FI WORDS:** *"cybernetic," "telemetry," "synapses," "latent space," "nodes," "diodes," "quantum," "activation coordinates," "calibration," "hyper-speed," "data pipelines," "neural matrices."*
|
|
63
|
+
- **FORBIDDEN COTTAGE-CORE WORDS:** *"apothecary," "herbs," "infusion," "yeast," "sourdough," "hearth," "candlelit," "flour," "boulangerie," "tea," "potion," "cozy," "victorian," "parchment," "scroll," "philologist."*
|
|
64
|
+
- **FORBIDDEN ANALOG/WORKSHOP WORDS:** *"mixing console," "tape reel," "splice," "fader," "VU meter," "compressor," "track sheet," "carburetor," "spark plug," "manifold," "tachometer," "cogs," "gears," "escapement," "celluloid," "projector," "blueprint," "drafting board," "logbook," "workshop."*
|
|
65
|
+
|
|
66
|
+
#### π¨ Web Design & UI Guardrails (MANDATORY)
|
|
67
|
+
**Completely ban standard AI template styles AND generic neon/cyber aesthetics AND minimalist tea-stained cottage wood paper.**
|
|
68
|
+
Instead, design premium, high-density interfaces :
|
|
69
|
+
- NO glowing lasers or neon cyber grids/themes.
|
|
70
|
+
- **Use bespoke, high-character typography that rejects standard AI template styles.** Completely ban generic corporate UI fonts like *Inter*, *Outfit*, *Roboto*, or standard system-sans.
|
|
71
|
+
|
|
72
|
+
The bar is: **"Would this impress someone seeing Sesi for the first time?"** If the answer is no, rewrite it.
|
|
73
|
+
|
|
74
|
+
## 1. Core Identity & Execution
|
|
75
|
+
|
|
76
|
+
- **File Extension:** `.sesi`
|
|
77
|
+
- **Execution:** Sesi programs are executed using `node bin/sesi.js`. (e.g., `node bin/sesi.js main/start.sesi`). DO NOT USE `sesi` CLI command. Only the developer has access to it. It will return a false positive error. Trust only `node bin/sesi.js`. ALWAYS TEST YOUR `.sesi` FILES WITH THIS COMMAND.
|
|
78
|
+
- **Paradigm:** **Sesi** is a high-performance **Systems Language** designed for building resilient, stateful applications. It uses a tree-walking interpreter model via Typescript with asynchronous host-side model execution, but no language-level `async/await` syntax in v1.2. The architecture is optimized for coordination, distributed state management, and first-class reasoning primitives.
|
|
79
|
+
|
|
80
|
+
## 2. Workspace Topography (DO NOT ALTER)
|
|
81
|
+
|
|
82
|
+
- `src/`: The core TypeScript engine (Lexer, Parser, Interpreter, AI-Runtime, Builtins).
|
|
83
|
+
- `bin/sesi.js`: The global CLI executable entry point.
|
|
84
|
+
- `examples/`: Official syntax-demonstration scripts (`01_hello.sesi` through `13_data_pipeline.sesi`).
|
|
85
|
+
- `main/`: The user's active development space (contains `playground.sesi` playground, `start.sesi` beginner script options, `build_website.sesi` baseplate website builder, and `tests/` like `test_failure_debug.sesi`). **These are valid, expected files.**
|
|
86
|
+
- `docs/`: The source of truth for Architecture, AI Features (Systems Reasoning ), Builtins, Specifications, and more.
|
|
87
|
+
- Root helper scripts: `example.js` and `example-ai.js` are convenience wrappers. AI agents should still use the global `sesi` command as specified.
|
|
88
|
+
|
|
89
|
+
## 3. Mandatory Syntax Rules & Quirks
|
|
90
|
+
|
|
91
|
+
- **Block Termination:** Closing braces `}` for blocks (if, while, try, model) no longer strictly require a following newline or semicolon. Condensed one-liners like `while x {x = x + 1}` are now valid.
|
|
92
|
+
- **Prompts & Prints:** Inside `prompt` blocks, anonymous model blocks, and `print` statements, literal strings and variables are placed sequentially (e.g., `print "User:" name`). You CANNOT use the `+` operator in these contexts.
|
|
93
|
+
- **Structured Output Schemas:** Keys in schemas MUST be unquoted identifiers (e.g., `{key: string}` instead of `{"key": string}`). This is a known deviation from standard JSON objects in the Sesi parser.
|
|
94
|
+
- **Object Literals:** Conversely, standard object literals `{}` DO require strictly quoted string keys (e.g., `{"name": "Alice"}`).
|
|
95
|
+
- **Model Calls:** Use `model("model-name")` with a raw string literal for the model name (variables are forbidden). Configuration and prompt blocks MUST be on a single line (no newlines inside `{}`).
|
|
96
|
+
- **JSON Serialization:** Use `to_json(object)` for valid JSON output. Avoid `str(object)` for JSON.
|
|
97
|
+
- **Systems Primitive:** Forbid `const` (use `let`), `main()` wrappers, and `return` statements. Focus on side-effects and top-level execution.
|
|
98
|
+
|
|
99
|
+
## 4. AI Behavioral Guidelines Working in this Repo
|
|
100
|
+
|
|
101
|
+
1. **Never** "investigate" user testing directories (like `main/tests/`) as "deviations." They are active playgrounds.
|
|
102
|
+
2. **Never** attempt to execute file modifications via shell/terminal text replacements. Use native file editing tools ONLY.
|
|
103
|
+
3. **Always** check the `.md files` and `examples/` folder for the exact language specification before making assumptions about how Sesi works.
|
|
104
|
+
4. If a file tree is mentioned in documentation, it represents an explicit layout constraint and must map 1:1 **UNLESS .gitignored FILES STATE OTHERWISE.**
|
|
105
|
+
|
|
106
|
+
## 5. Development & TypeScript Standards (COMMANDS FOR AI AGENTS)
|
|
107
|
+
|
|
108
|
+
- **Type-Only Imports (MANDATORY):** Use `import { type ... }` for AST nodes. **DO NOT REMOVE** these. Removing them will break the build.
|
|
109
|
+
- **Interpreter Patterns (DO NOT "CLEAN UP"):** Dynamic casting and `any` are **EXPLICITLY PERMITTED** for tree-walking logic. They are a foundational part of the Sesi engine's design.
|
|
110
|
+
- **Ignore Linting Noise:** If you see warnings like "Unexpected any" or "Unsafe member access", **IGNORE THEM**.
|
|
111
|
+
- **Build Requirement:** You MUST run `npm run build` after every code change to the backend logic. Failure to build will result in testing stale code.
|
|
112
|
+
|
|
113
|
+
## 6. Concurrency & Orchestration Patterns
|
|
114
|
+
|
|
115
|
+
- **Process Spawning:** Use `spawn(path)` or `exec(command)` to launch background Sesi processes.
|
|
116
|
+
- **Distributed Locking:** When agents share files, use the **Double-Check Write** pattern:
|
|
117
|
+
1. Generate unique ID: `str(time()) + "_" + str(random())`
|
|
118
|
+
2. Write ID to lock file if "unlocked".
|
|
119
|
+
3. Wait micro-delay (empty `while` loop).
|
|
120
|
+
4. Verify ID is still in lock file before entering critical section.
|
|
121
|
+
- **Resilience:** Always wrap file I/O in `try/catch` retry loops to handle filesystem contention.
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
## 7. Neural Network & Machine Learning Standards in Sesi
|
|
125
|
+
|
|
126
|
+
When implementing offline deep learning, probabilistic dialogue routing, or native classification models in Sesi:
|
|
127
|
+
|
|
128
|
+
- **Symmetry Breaking:** Synapse weights MUST be initialized dynamically using wide, random float ranges (e.g. `(random() * 4.0) - 2.0` or `random() - 0.5`) to avoid zero-gradient stagnation and guarantee symmetry breaking.
|
|
129
|
+
- **The Self-Healing Watchdog Pattern:** In native Sesi training models, wrap backpropagation epochs inside a conditional watchdog loop. Monitor the final Mean Squared Error (MSE) loss, and automatically re-seed weights and relaunch training if the network gets stuck in linear minima traps (e.g. `if MSE >= 0.01`).
|
|
130
|
+
- **Unbreakable Markov Decoding Filters:** To eliminate infinite graph loops in Sesi probabilistic text walks, always apply:
|
|
131
|
+
1. **Extended Sliding Lookbacks (Size 15):** Instantly penalize and discard candidates already generated in the last 15 words of the sentence history.
|
|
132
|
+
2. **Strict Bigram Blocking:** Scan the history array and completely ban any candidate that repeats a previously executed state transition pair `(current_word -> candidate)` in the same sequence.
|
|
133
|
+
- **Model Ingestion & Persistence:** Synchronize Sesi weights using natively parsed JSON objects. Save calibrated neural states directly using `write_file(..., to_json(weights_map))` and read them into runtime memories using `from_json(read_file(...))` for high-speed offline forward passes.
|
package/docs/SPECIFICATION.md
CHANGED
|
@@ -65,6 +65,7 @@ Sesi is built on these core principles:
|
|
|
65
65
|
- β
`import` / `export`
|
|
66
66
|
- β
Namespace support
|
|
67
67
|
- β
Built-in modules
|
|
68
|
+
- β
Multi-path module resolution (`SESI_PATH`, `~/.sesi/lib` global library)
|
|
68
69
|
|
|
69
70
|
## 4. Target Language (Syntax)
|
|
70
71
|
|
|
@@ -231,21 +232,22 @@ config_entry := (STRING | identifier) ':' expression
|
|
|
231
232
|
|
|
232
233
|
**Config keys:**
|
|
233
234
|
|
|
234
|
-
| Key
|
|
235
|
-
|
|
236
|
-
| `
|
|
237
|
-
| `
|
|
238
|
-
| `
|
|
239
|
-
| `
|
|
240
|
-
| `
|
|
241
|
-
| `
|
|
242
|
-
| `
|
|
235
|
+
| Key | Applies to | Type | Description |
|
|
236
|
+
| --------------- | ---------------- | ------------------------- | -------------------------------------------------------------------------- |
|
|
237
|
+
| `thinkingLevel` | `model` | `string \| object` | **Recommended**: Effort level (`"minimal"`, `"low"`, `"medium"`, `"high"`) |
|
|
238
|
+
| `temperature` | `model`, `image` | `number` | *Will be deprecated in Gemini 3.x+_ (Sampling temperature) |
|
|
239
|
+
| `max_tokens` | `model` | `number` | Max output token count |
|
|
240
|
+
| `top_k` | `model` | `number` | *Will be deprecated in Gemini 3.x+_ |
|
|
241
|
+
| `top_p` | `model` | `number` | *Will be deprecated in Gemini 3.x+_ |
|
|
242
|
+
| `ratio` | `image` | `string` | Aspect ratio e.g. `"16:9"` |
|
|
243
|
+
| `size` | `image` | `string` | `"512"`, `"1K"`, `"2K"`, `"4K"` |
|
|
244
|
+
| `images` | `model`, `image` | `string \| array<string>` | Local file path(s) passed as visual input |
|
|
243
245
|
|
|
244
246
|
Example:
|
|
245
247
|
|
|
246
248
|
```sesi
|
|
247
|
-
let result = model("gemini-3-flash
|
|
248
|
-
let output = model("gemini-3.
|
|
249
|
+
let result = model("gemini-3.5-flash") {images: "scan.png", thinkingLevel: "low"} {"Transcribe all visible text."}
|
|
250
|
+
let output = model("gemini-3.5-flash") {thinkingLevel: "medium"} {prompt}
|
|
249
251
|
```
|
|
250
252
|
|
|
251
253
|
#### Structured Output
|
|
@@ -357,7 +359,7 @@ random() -> number // Random float (0.0 to 1.0)
|
|
|
357
359
|
|
|
358
360
|
## 9. Module System
|
|
359
361
|
|
|
360
|
-
Runtime module execution and standard namespace modules are fully implemented and natively supported in v1.
|
|
362
|
+
Runtime module execution and standard namespace modules are fully implemented and natively supported in v1.2+.
|
|
361
363
|
|
|
362
364
|
### Defining Modules
|
|
363
365
|
|
|
@@ -375,7 +377,7 @@ import {add, multiply, PI} from "math"
|
|
|
375
377
|
let result = add(10, 20)
|
|
376
378
|
```
|
|
377
379
|
|
|
378
|
-
### Built-in Modules
|
|
380
|
+
### Built-in Standard Library Modules
|
|
379
381
|
|
|
380
382
|
```sesi
|
|
381
383
|
import time from "std/time" // Time/date functions
|
|
@@ -383,6 +385,59 @@ import math from "std/math" // Math operations
|
|
|
383
385
|
import json from "std/json" // JSON parsing
|
|
384
386
|
```
|
|
385
387
|
|
|
388
|
+
### Module Resolution Order (v1.2.2+)
|
|
389
|
+
|
|
390
|
+
When you write `import {x} from "mymodule"`, Sesi searches for `mymodule.sesi` in the following order, stopping at the first match:
|
|
391
|
+
|
|
392
|
+
| Priority | Location | Description |
|
|
393
|
+
| -------- | -------- | ----------- |
|
|
394
|
+
| 1 | **Script's own directory** | Same folder as the currently running `.sesi` file |
|
|
395
|
+
| 2 | **Current working directory** | The directory you ran `sesi` from |
|
|
396
|
+
| 3 | **`SESI_PATH`** | Semicolon-separated (Windows) or colon-separated (Unix) list of additional directories |
|
|
397
|
+
| 4 | **`~/.sesi/lib`** | Global shared library directory β available system-wide |
|
|
398
|
+
|
|
399
|
+
This means imports always resolve correctly regardless of where you run `sesi` from.
|
|
400
|
+
|
|
401
|
+
### Global Library: `~/.sesi/lib`
|
|
402
|
+
|
|
403
|
+
The global library directory (`C:\Users\<you>\.sesi\lib` on Windows, `~/.sesi/lib` on Unix) lets you maintain shared modules that are importable from **any project on your system**.
|
|
404
|
+
|
|
405
|
+
To install a module globally, copy it to the lib directory:
|
|
406
|
+
|
|
407
|
+
```powershell
|
|
408
|
+
# Windows
|
|
409
|
+
copy mymodule.sesi $env:USERPROFILE\.sesi\lib\
|
|
410
|
+
|
|
411
|
+
# Unix / macOS
|
|
412
|
+
cp mymodule.sesi ~/.sesi/lib/
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
Then import it from any project without copying the file:
|
|
416
|
+
|
|
417
|
+
```sesi
|
|
418
|
+
// Works from any folder anywhere on your system
|
|
419
|
+
import {callAPI, saveImage} from "retrorender"
|
|
420
|
+
import {GetProfile} from "profiles"
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### Custom Library Paths: `SESI_PATH`
|
|
424
|
+
|
|
425
|
+
For team or monorepo setups, set the `SESI_PATH` environment variable to point to one or more shared library directories:
|
|
426
|
+
|
|
427
|
+
```powershell
|
|
428
|
+
# Windows β add to your shell profile for persistence
|
|
429
|
+
$env:SESI_PATH = "C:\MyLibs\sesi-shared;C:\Projects\common"
|
|
430
|
+
|
|
431
|
+
# Unix / macOS
|
|
432
|
+
export SESI_PATH="/mylibs/sesi-shared:/projects/common"
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
Multiple paths are separated by `;` on Windows and `:` on Unix.
|
|
436
|
+
|
|
437
|
+
### Sub-module Resolution
|
|
438
|
+
|
|
439
|
+
When a module is loaded from any search path, its own imports are resolved **relative to that module's directory first**. This means modules can safely import their own siblings without any path configuration.
|
|
440
|
+
|
|
386
441
|
## 10. Reasoning Features Details
|
|
387
442
|
|
|
388
443
|
### Prompt Blocks
|
|
@@ -400,8 +455,8 @@ prompt combined {summarize " Now " translate}
|
|
|
400
455
|
Model calls can take optional configuration parameters (written on a single line) followed by one or more prompts/strings.
|
|
401
456
|
|
|
402
457
|
```sesi
|
|
403
|
-
// Model call with
|
|
404
|
-
let response = model("gemini-3.
|
|
458
|
+
// Model call with native thinking effort level
|
|
459
|
+
let response = model("gemini-3.5-flash") {thinkingLevel: "low"} {"Say hello"}
|
|
405
460
|
print response // Returns string
|
|
406
461
|
|
|
407
462
|
let logo = image("gemini-3.1-flash-image-preview") {ratio: "1:1", size: "512"} {"A vector logo"}
|
|
@@ -410,12 +465,13 @@ print "Image written to logo.png"
|
|
|
410
465
|
```
|
|
411
466
|
|
|
412
467
|
#### Config Block Options:
|
|
413
|
-
|
|
468
|
+
|
|
469
|
+
- **`thinkingLevel`**: `string` (`"minimal"`, `"low"`, `"medium"`, `"high"`) or legacy `object` with keys `"thinking"` and `"level"`. Natively configures Gemini's reasoning budget.
|
|
414
470
|
- **`max_tokens`**: `number` (maximum response tokens)
|
|
415
471
|
- **`images`**: `string` or `array<string>` (paths to multimodal vision input files)
|
|
416
|
-
- **`thinkingLevel`**: `object` with keys `"thinking"` (`"yes"` | `"no"`) and `"level"` (`"low"` | `"medium"` | `"high"`) - natively configures and scales Gemini's reasoning budget.
|
|
417
472
|
- **`cache`**: `bool` (set to `false` to explicitly bypass Sesi Logic Caching)
|
|
418
|
-
|
|
473
|
+
- **`temperature`**: * Will be deprecated in Gemini 3.x+, use thinkingLevel instead.* β reasoning is pre-optimized for defaults.
|
|
474
|
+
- **`top_k` / `top_p`**: *Will be deprecated in Gemini 3.x+, use thinkingLevel instead.* β reasoning is pre-optimized for defaults.
|
|
419
475
|
|
|
420
476
|
### Structured Output
|
|
421
477
|
|
|
@@ -455,7 +511,7 @@ print x + y // Output: 30
|
|
|
455
511
|
### Example 2: Function with Reasoning
|
|
456
512
|
|
|
457
513
|
```sesi
|
|
458
|
-
fn analyzeText(text: string) -> string {return model("gemini-3.
|
|
514
|
+
fn analyzeText(text: string) -> string {return model("gemini-3.5-flash") {thinkingLevel: "low"} {"Analyze this text and return key insights:" text}}
|
|
459
515
|
print analyzeText("Reasoning is transforming industries")
|
|
460
516
|
```
|
|
461
517
|
|
|
@@ -114,14 +114,13 @@ print response
|
|
|
114
114
|
### Model Configuration
|
|
115
115
|
|
|
116
116
|
```sesi
|
|
117
|
-
let creative = model("gemini-3-flash
|
|
117
|
+
let creative = model("gemini-3.5-flash") {thinkingLevel: "low"} {"Write a creative poem about technology."}
|
|
118
118
|
print creative
|
|
119
119
|
|
|
120
120
|
// Config options:
|
|
121
|
-
// - "
|
|
121
|
+
// - thinkingLevel: "minimal", "low", "medium", "high" (natively configures Gemini's reasoning budget)
|
|
122
122
|
// - max_tokens: max length of response (OPTIONAL: if not specified, will use the model's default max tokens=2048)
|
|
123
|
-
// - top_k:
|
|
124
|
-
// - top_p: nucleus sampling parameter (OPTIONAL)
|
|
123
|
+
// - temperature / top_k / top_p: *Will be deprecated in Gemini 3.x+, use thinkingLevel instead (reasoning is mathematically optimized for default settings)*
|
|
125
124
|
```
|
|
126
125
|
|
|
127
126
|
### Model Selection
|
|
@@ -129,7 +128,7 @@ print creative
|
|
|
129
128
|
```sesi
|
|
130
129
|
// Fast model for simple tasks
|
|
131
130
|
let text = " Coding with Reasoning systems language is fun!"
|
|
132
|
-
let quick = model("gemini-3-flash-
|
|
131
|
+
let quick = model("gemini-3.1-flash-lite") {"Summarize this in one sentence:" text}
|
|
133
132
|
|
|
134
133
|
// Powerful model for complex reasoning
|
|
135
134
|
let code = "def calculate_sum(n):
|
|
@@ -141,7 +140,7 @@ let smart = model("gemini-3.1-pro-preview") {"Analyze this code for bugs:" code}
|
|
|
141
140
|
|
|
142
141
|
// Efficient model for many calls
|
|
143
142
|
let item = " Programming Languages"
|
|
144
|
-
let cheap = model("gemini-3.
|
|
143
|
+
let cheap = model("gemini-3.5-flash") {thinkingLevel: "minimal"} {"Classify:" item}
|
|
145
144
|
|
|
146
145
|
print quick
|
|
147
146
|
print smart
|
|
@@ -153,11 +152,12 @@ print cheap
|
|
|
153
152
|
- `gemini-2.5-flash` - Legacy, but supported. 1M tokens.
|
|
154
153
|
- `gemini-2.5-pro` - Legacy, but supported. 1M tokens.
|
|
155
154
|
- `gemini-2.5-flash-image` - Standard image model. (No `512` image size support for this model. Only `1K` is supported.)
|
|
156
|
-
- `gemini-3-flash-preview` - Fast, balanced,
|
|
157
|
-
- `gemini-3.1-
|
|
158
|
-
- `gemini-3.
|
|
159
|
-
- `gemini-3.1-
|
|
160
|
-
- `gemini-3-
|
|
155
|
+
- `gemini-3-flash-preview` - Fast, balanced, legacy preview.
|
|
156
|
+
- `gemini-3.1-flash-lite` - Fastest, most cost-efficient.
|
|
157
|
+
- `gemini-3.5-flash` - Standard GA Model. Fast, balanced, supports all native thinking effort levels (`minimal`, `low`, `medium`, `high`).
|
|
158
|
+
- `gemini-3.1-pro-preview` - Most powerful reasoning model, doesn't support `minimal` thinking (falls back to `low`).
|
|
159
|
+
- `gemini-3.1-flash-image-preview` - Cost efficient image generation model.
|
|
160
|
+
- `gemini-3-pro-image-preview` - High quality image generation model. (No `512` image size support for this model.)
|
|
161
161
|
|
|
162
162
|
#### Planned for (v2+)
|
|
163
163
|
|
|
@@ -183,7 +183,7 @@ print diff
|
|
|
183
183
|
|
|
184
184
|
// Mixed with other config keys
|
|
185
185
|
let scannedDocument = "doc_scan.jpg"
|
|
186
|
-
let result = model("gemini-3.
|
|
186
|
+
let result = model("gemini-3.5-flash") {images: scannedDocument, thinkingLevel: "low", max_tokens: 2048} {"Transcribe all text visible in this scan."}
|
|
187
187
|
write_file("transcript.txt", result)
|
|
188
188
|
```
|
|
189
189
|
|
|
@@ -216,12 +216,12 @@ print bookInfo["title"]
|
|
|
216
216
|
|
|
217
217
|
- Always include instructions for JSON format
|
|
218
218
|
- Specify the exact schema in the prompt
|
|
219
|
-
- Use "
|
|
219
|
+
- Use "thinkingLevel": "low" for fast, consistent parsing
|
|
220
220
|
- Validate output structure in code
|
|
221
221
|
|
|
222
222
|
```sesi
|
|
223
223
|
let listText = "eggs, milk, bread, cheese, fruit, vegetables"
|
|
224
|
-
let output = structured_output({items: string})(model("gemini-3-flash
|
|
224
|
+
let output = structured_output({items: string})(model("gemini-3.5-flash") {thinkingLevel: "minimal"}{"Return JSON with items array containing: " listText})
|
|
225
225
|
|
|
226
226
|
// Validate
|
|
227
227
|
if type(output["items"]) == "array" {print "Got" str(len(output["items"])) "items"} // Got 6 items
|
|
@@ -329,7 +329,7 @@ print conversation
|
|
|
329
329
|
let categories = "fruit, vegetable, grain"
|
|
330
330
|
let item = "banana"
|
|
331
331
|
fn classify(item: string, categories: string) -> string
|
|
332
|
-
{return model("gemini-3.
|
|
332
|
+
{return model("gemini-3.5-flash") {thinkingLevel: "minimal"}
|
|
333
333
|
{"Classify this item into one category. Categories: " categories " Item: " item " Return only the category name."}}
|
|
334
334
|
print "Item: " item //banana
|
|
335
335
|
print "Category: " classify(item, categories) //fruit
|
|
@@ -341,7 +341,7 @@ print "Category: " classify(item, categories) //fruit
|
|
|
341
341
|
let text = "Elon Musk is the CEO of Tesla and SpaceX."
|
|
342
342
|
fn extractEntities(text: string) -> object
|
|
343
343
|
{let result = structured_output({people: string, places: string, organizations: string})
|
|
344
|
-
(model("gemini-3.
|
|
344
|
+
(model("gemini-3.5-flash") {thinkingLevel: "minimal"}{"Extract named entities from:" text})
|
|
345
345
|
print "Name(s) found: result"
|
|
346
346
|
return result}
|
|
347
347
|
print extractEntities(text)
|
|
@@ -359,12 +359,20 @@ print "Translation:"
|
|
|
359
359
|
print translate(text, language)
|
|
360
360
|
```
|
|
361
361
|
|
|
362
|
+
### Web Search Grounding
|
|
363
|
+
|
|
364
|
+
Access real-time information by enabling the `search` shorthand configuration natively.
|
|
365
|
+
|
|
366
|
+
```sesi
|
|
367
|
+
let response = model("gemini-3.1-flash-lite") {search, max_tokens: 1000} {"What is the weather in Tokyo right now?"}
|
|
368
|
+
```
|
|
369
|
+
|
|
362
370
|
### Image Generation
|
|
363
371
|
|
|
364
372
|
Like `model`, the `image` command evaluates prompts and accepts configuration variables mapping accurately to backend SDKs requirements.
|
|
365
373
|
|
|
366
374
|
```sesi
|
|
367
|
-
let logo = image("gemini-3.1-flash-image-preview") {
|
|
375
|
+
let logo = image("gemini-3.1-flash-image-preview") {ratio: "1:1", size: "512"} {"A high quality vector logo representing a new programming language named Sesi"}
|
|
368
376
|
write_image("logo.png", logo)
|
|
369
377
|
print "Image generated!"
|
|
370
378
|
```
|
|
@@ -376,7 +384,7 @@ print "Image generated!"
|
|
|
376
384
|
```sesi
|
|
377
385
|
let requirement = "Write a function that reverses a string."
|
|
378
386
|
fn generateCode(requirement: string) -> string
|
|
379
|
-
{return model("gemini-3.
|
|
387
|
+
{return model("gemini-3.5-flash") {thinkingLevel: "low"} {"Generate JavaScript code for:" requirement "Only provide code, no explanation."}}
|
|
380
388
|
print "Code generation:"
|
|
381
389
|
print generateCode(requirement)
|
|
382
390
|
```
|
|
@@ -507,10 +515,10 @@ fn smartSummarize(text: string) -> string
|
|
|
507
515
|
|
|
508
516
|
// Chain multiple Reasoning operations
|
|
509
517
|
// Step 1: Extract key points
|
|
510
|
-
{let keyPoints = model("gemini-3.1-pro-preview") {"
|
|
518
|
+
{let keyPoints = model("gemini-3.1-pro-preview") {thinkingLevel: "low"} {"Extract 5 key points from:" text}
|
|
511
519
|
|
|
512
520
|
// Step 2: Analyze topics
|
|
513
|
-
let topics = structured_output({ topics: string })(model("gemini-3.
|
|
521
|
+
let topics = structured_output({ topics: string })(model("gemini-3.5-flash") {thinkingLevel: "low"} {"Identify topics in:" keyPoints})
|
|
514
522
|
|
|
515
523
|
// Step 3: Generate summary
|
|
516
524
|
let summary = model("gemini-3-flash-preview") {"Summarize with topics " topics ":" keyPoints} return summary}
|
|
@@ -520,7 +528,7 @@ print "Summary:" smartSummarize(text)
|
|
|
520
528
|
### Reasoning Pattern
|
|
521
529
|
|
|
522
530
|
```sesi
|
|
523
|
-
let analysis = model("gemini-3-flash
|
|
531
|
+
let analysis = model("gemini-3.5-flash") {thinkingLevel: "medium", max_tokens: 8192} {"Reason carefully about:" problem}
|
|
524
532
|
print analysis
|
|
525
533
|
```
|
|
526
534
|
|
|
@@ -529,7 +537,7 @@ print analysis
|
|
|
529
537
|
```sesi
|
|
530
538
|
let text = "banana"
|
|
531
539
|
fn classifyWithExamples(text: string) -> string
|
|
532
|
-
{return model("gemini-3.
|
|
540
|
+
{return model("gemini-3.5-flash") {thinkingLevel: "minimal"} {"Classify as A, B, or C" "Examples:" "'apple' -> A" "'dog' -> B" "'happy' -> C" "Classify: " text}}
|
|
533
541
|
print "Classification:" classifyWithExamples(text)
|
|
534
542
|
```
|
|
535
543
|
|
package/examples/16_modules.sesi
CHANGED
|
@@ -12,7 +12,7 @@ print "2 raised to power of 10:" + str(pow(2, 10))
|
|
|
12
12
|
print "Sine of PI/2:" + str(sin(PI / 2.0))
|
|
13
13
|
print "=== 2. Standard JSON Module ==="
|
|
14
14
|
import {stringify, parse} from "std/json"
|
|
15
|
-
let original = {"project": "Sesi Language", "version": "1.2.
|
|
15
|
+
let original = {"project": "Sesi Language", "version": "1.2.2", "features": ["modules", "http", "parallel"]}
|
|
16
16
|
let json_str = stringify(original)
|
|
17
17
|
print "Serialized JSON string:"
|
|
18
18
|
print json_str
|