@misterscan/sesi 1.2.3 → 1.3.0
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 +101 -35
- package/bin/sesi.js +163 -38
- package/dist/builtins.d.ts.map +1 -1
- package/dist/builtins.js +196 -4
- package/dist/builtins.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -5
- package/dist/index.js.map +1 -1
- package/dist/interpreter.d.ts +11 -2
- package/dist/interpreter.d.ts.map +1 -1
- package/dist/interpreter.js +181 -88
- package/dist/interpreter.js.map +1 -1
- package/dist/lexer.d.ts.map +1 -1
- package/dist/lexer.js +8 -4
- package/dist/lexer.js.map +1 -1
- package/dist/parser.d.ts +1 -0
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +18 -8
- package/dist/parser.js.map +1 -1
- package/dist/types.d.ts +13 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +33 -1
- package/dist/types.js.map +1 -1
- package/docs/ARCHITECTURE.md +22 -9
- package/docs/BUILTINS.md +111 -13
- package/docs/COMPARISON.md +7 -9
- package/docs/{DISTRIBUTED_SYSTEMS.md → CONCURRENCY.md} +11 -11
- package/docs/IMAGE_GENERATION.md +13 -14
- package/docs/IMPLEMENTATION_SUMMARY.md +141 -84
- package/docs/QUICKSTART.md +81 -28
- package/docs/README.md +140 -34
- package/docs/{SYSTEMS_REASONING.md → REASONING.md} +100 -110
- package/docs/ROADMAP.md +42 -43
- package/docs/SKILLS.md +56 -28
- package/docs/SPECIFICATION.md +25 -18
- package/docs/sesi_ai_chronicles.md +96 -209
- package/examples/07_prompts.sesi +1 -1
- package/examples/08_model_call.sesi +1 -1
- package/examples/09_structured_output.sesi +1 -1
- package/examples/10_code_generation.sesi +1 -1
- package/examples/13_data_pipeline.sesi +1 -1
- package/examples/14_folder_explainer.sesi +2 -2
- package/examples/15_image_generation.sesi +1 -1
- package/examples/16_modules.sesi +27 -27
- package/examples/20_model_aliases.sesi +22 -0
- package/examples/21_custom_tools.sesi +27 -0
- package/examples/22_reasoning_plus_custom_tools.sesi +19 -0
- package/main/orchestrator.sesi +2 -2
- package/main/sesi_db_chatbot.sesi +6 -2
- package/main/tests/test_grounding.sesi +2 -0
- package/package.json +2 -2
package/dist/types.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Core type definitions and AST nodes for Sesi
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ContinueException = exports.BreakException = exports.ReturnValue = exports.Environment = void 0;
|
|
4
|
+
exports.SesiRuntimeError = exports.ContinueException = exports.BreakException = exports.ReturnValue = exports.Environment = void 0;
|
|
5
5
|
// Environment for variable scoping
|
|
6
6
|
class Environment {
|
|
7
7
|
constructor(parent = null) {
|
|
@@ -60,4 +60,36 @@ class ContinueException extends Error {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
exports.ContinueException = ContinueException;
|
|
63
|
+
class SesiRuntimeError extends Error {
|
|
64
|
+
constructor(errorType, message, data = null, line, column, output, stackTrace = []) {
|
|
65
|
+
super(message);
|
|
66
|
+
this.name = 'SesiRuntimeError';
|
|
67
|
+
this.errorType = errorType;
|
|
68
|
+
this.data = data;
|
|
69
|
+
this.line = line;
|
|
70
|
+
this.column = column;
|
|
71
|
+
this.output = output;
|
|
72
|
+
this.stackTrace = stackTrace;
|
|
73
|
+
}
|
|
74
|
+
toRuntimeObject() {
|
|
75
|
+
const obj = Object.create(null);
|
|
76
|
+
obj.type = this.errorType;
|
|
77
|
+
obj.message = this.message;
|
|
78
|
+
obj.data = this.data;
|
|
79
|
+
if (this.line !== undefined) {
|
|
80
|
+
obj.line = this.line;
|
|
81
|
+
}
|
|
82
|
+
if (this.column !== undefined) {
|
|
83
|
+
obj.column = this.column;
|
|
84
|
+
}
|
|
85
|
+
if (this.output !== undefined) {
|
|
86
|
+
obj.output = this.output;
|
|
87
|
+
}
|
|
88
|
+
if (this.stackTrace.length > 0) {
|
|
89
|
+
obj.stack_trace = this.stackTrace;
|
|
90
|
+
}
|
|
91
|
+
return obj;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.SesiRuntimeError = SesiRuntimeError;
|
|
63
95
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,+CAA+C;;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
**Sesi** is a
|
|
5
|
+
**Sesi** is a concise and highly legible programming language. It uses a clean tree-walking interpreter model built in TypeScript. The architecture is optimized for simplicity and eliminating the need for `async/await` syntax or heavy module imports. By acting as a minimal orchestration layer, Sesi allows developers to write clean, straightforward logic that natively handles background processes and API or Reasoning calls without SDK overhead.
|
|
6
6
|
|
|
7
7
|
## Component Stack
|
|
8
8
|
|
|
@@ -198,7 +198,7 @@ false → false
|
|
|
198
198
|
- Construct prompt from string concatenation
|
|
199
199
|
- Make async API call to Gemini
|
|
200
200
|
|
|
201
|
-
- Wait for response (blocking in v1)
|
|
201
|
+
- Wait for response (blocking in v1.x)
|
|
202
202
|
- Validate finish reason and non-empty text
|
|
203
203
|
- Return text response to program or throw
|
|
204
204
|
|
|
@@ -213,7 +213,7 @@ false → false
|
|
|
213
213
|
ModelCallExpression (AST)
|
|
214
214
|
│
|
|
215
215
|
├─ Evaluate prompt expression
|
|
216
|
-
├─ Extract configuration (
|
|
216
|
+
├─ Extract configuration (`thinkingLevel`, `max_tokens`, `cache`, etc.)
|
|
217
217
|
├─ Call AIRuntime.callModel()
|
|
218
218
|
│ │
|
|
219
219
|
│ ├─ Create Gemini interaction request
|
|
@@ -303,6 +303,7 @@ eslint.config.mjs # ESLint configuration
|
|
|
303
303
|
dist/ # Compiled TypeScript output
|
|
304
304
|
example.js # Helper script to run basic examples
|
|
305
305
|
example-ai.js # Helper script to run Reasoning examples
|
|
306
|
+
examples.sesi # Central execution suite for examples
|
|
306
307
|
package.json # Dependencies & scripts
|
|
307
308
|
tsconfig.json # TypeScript configuration
|
|
308
309
|
QUICKSTART.md # Quick start guide
|
|
@@ -346,7 +347,10 @@ examples/
|
|
|
346
347
|
├── 16_modules.sesi # Modules & std library namespaces
|
|
347
348
|
├── 17_http_client.sesi # HTTP GET/POST client
|
|
348
349
|
├── 18_parallel_requests.sesi # Parallel requests concurrency
|
|
349
|
-
|
|
350
|
+
├── 19_search_web.sesi # Web search
|
|
351
|
+
├── 20_model_aliases.sesi # Custom model naming via aliases
|
|
352
|
+
├── 21_custom_tools.sesi # Runtime custom tool definitions
|
|
353
|
+
└── 22_reasoning_plus_custom_tools.sesi # Compose reasoning with custom tools
|
|
350
354
|
|
|
351
355
|
docs/
|
|
352
356
|
├── SPECIFICATION.md # Language spec
|
|
@@ -354,12 +358,21 @@ docs/
|
|
|
354
358
|
├── BUILTINS.md # Built-in reference
|
|
355
359
|
├── IMAGE_GENERATION.md # Image generation guide
|
|
356
360
|
├── COMPARISON.md # Language comparison showcase
|
|
357
|
-
├──
|
|
358
|
-
├──
|
|
359
|
-
|
|
361
|
+
├── CONCURRENCY.md # Concurrency & coordination guide
|
|
362
|
+
├── REASONING.md # Reasoning and simple logic guide
|
|
363
|
+
├── ROADMAP.md # Future plans
|
|
364
|
+
└── sesi_ai_chronicles.md # AI project history & notes
|
|
360
365
|
|
|
361
366
|
tests/
|
|
362
|
-
|
|
367
|
+
├── basic.test.ts # Core parsing & evaluation tests
|
|
368
|
+
├── cache.test.ts # Execution caching tests
|
|
369
|
+
├── http.test.ts # Web request builtins testing
|
|
370
|
+
├── module.test.ts # Imports & module loading tests
|
|
371
|
+
├── parallel.test.ts # Concurrent execution tests
|
|
372
|
+
├── security.test.ts # Sandbox & guardrail tests
|
|
373
|
+
├── test-gemini.ts # Base model integration test
|
|
374
|
+
├── test-gemini2.ts # Extended model integration test
|
|
375
|
+
└── workflow.test.ts # Complex sequence workflows tests
|
|
363
376
|
```
|
|
364
377
|
|
|
365
378
|
## Workspace Context File
|
|
@@ -429,6 +442,6 @@ Sesi's architecture prioritizes **clarity and simplicity** over performance. The
|
|
|
429
442
|
- Easy debugging
|
|
430
443
|
- Simple extensions
|
|
431
444
|
- Clear control flow
|
|
432
|
-
- Smooth Reasoning
|
|
445
|
+
- Smooth Reasoning integration
|
|
433
446
|
|
|
434
447
|
As the language matures, optimizations can be added without changing the API.
|
package/docs/BUILTINS.md
CHANGED
|
@@ -383,14 +383,12 @@ print "Elapsed time:" time() - start "ms"
|
|
|
383
383
|
Concurrently execute multiple Sesi function closures or builtins in parallel and return their results as an array.
|
|
384
384
|
|
|
385
385
|
```sesi
|
|
386
|
-
fn job1()
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
return "b"
|
|
393
|
-
}
|
|
386
|
+
fn job1()
|
|
387
|
+
{sleep(100)
|
|
388
|
+
return "a"}
|
|
389
|
+
fn job2()
|
|
390
|
+
{sleep(100)
|
|
391
|
+
return "b"}
|
|
394
392
|
let results = multi_req([job1, job2])
|
|
395
393
|
print results // ["a", "b"]
|
|
396
394
|
```
|
|
@@ -399,6 +397,106 @@ print results // ["a", "b"]
|
|
|
399
397
|
|
|
400
398
|
---
|
|
401
399
|
|
|
400
|
+
### workflow(steps, input = "") -> object
|
|
401
|
+
|
|
402
|
+
Run a multi-step reasoning workflow where each step can reference prior outputs.
|
|
403
|
+
|
|
404
|
+
Default behavior is automatic and requires no special syntax:
|
|
405
|
+
|
|
406
|
+
- Step 1 gets the workflow input appended to its prompt
|
|
407
|
+
- Step 2+ gets the previous step output appended to its prompt
|
|
408
|
+
|
|
409
|
+
Each step is an object with at minimum a `"prompt"` string. Optional keys include:
|
|
410
|
+
|
|
411
|
+
- `"model"` (default: `"gemini-3.1-flash-lite"`)
|
|
412
|
+
- `"temperature"`, `"max_tokens"`, `"top_k"`, `"top_p"`
|
|
413
|
+
- `"thinkingLevel"`, `"cache"`, `"search"`
|
|
414
|
+
|
|
415
|
+
```sesi
|
|
416
|
+
let steps = [{"prompt": "Summarize:"}, {"prompt": "Critique:"}, {"prompt": "Finalize:"}]
|
|
417
|
+
let result = workflow(steps, "Design a landing page brief")
|
|
418
|
+
print result["final"]
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
**Returns**: `object` with keys `"input"`, `"steps"` (array of step outputs), and `"final"`.
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
### set_alias(alias, model) -> bool
|
|
426
|
+
|
|
427
|
+
Register a custom local name for a model string. Aliases are resolved automatically by `model()`, `image()`, and `workflow()`.
|
|
428
|
+
|
|
429
|
+
```sesi
|
|
430
|
+
set_alias("fast", "gemini-3.1-flash-lite")
|
|
431
|
+
let answer = model("fast") {"Summarize this paragraph."}
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
**Returns**: `bool` (`true` when the alias is registered)
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
### define_tool(name, fn, description = "") -> bool
|
|
439
|
+
|
|
440
|
+
Register a custom tool name that can be called through `tool_call(name)(...)`.
|
|
441
|
+
|
|
442
|
+
```sesi
|
|
443
|
+
fn summarize(text)
|
|
444
|
+
{return "Summary: " + text}
|
|
445
|
+
|
|
446
|
+
define_tool("summarizer", summarize, "Summarizes text")
|
|
447
|
+
let result = tool_call(summarizer)("Hello")
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
**Returns**: `bool` (`true` when the tool is registered)
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
### list_tools() -> array
|
|
455
|
+
|
|
456
|
+
List custom tool names registered by `define_tool`.
|
|
457
|
+
|
|
458
|
+
```sesi
|
|
459
|
+
let tools = list_tools()
|
|
460
|
+
print tools
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
**Returns**: `array<string>`
|
|
464
|
+
|
|
465
|
+
---
|
|
466
|
+
|
|
467
|
+
### error_type(type, message, data = null) -> object
|
|
468
|
+
|
|
469
|
+
Create a custom typed error object you can throw with `raise_error`.
|
|
470
|
+
|
|
471
|
+
```sesi
|
|
472
|
+
let err = error_type("ValidationError", "Missing email", {"field": "email"})
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
**Returns**: `object` with keys `"type"`, `"message"`, and `"data"`.
|
|
476
|
+
|
|
477
|
+
---
|
|
478
|
+
|
|
479
|
+
### raise_error(type_or_error, message = "", data = null) -> never
|
|
480
|
+
|
|
481
|
+
Throw a custom typed error that can be handled in `try/catch`.
|
|
482
|
+
|
|
483
|
+
```sesi
|
|
484
|
+
try {
|
|
485
|
+
raise_error("RateLimit", "Too many requests", {"retryIn": 30})
|
|
486
|
+
} catch (e) {print "type:" e["type"] "message:" e["message"]}
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
You can also pass an `error_type(...)` object directly:
|
|
490
|
+
|
|
491
|
+
```sesi
|
|
492
|
+
let err = error_type("ValidationError", "Invalid payload", {"field": "email"})
|
|
493
|
+
raise_error(err)
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
**Returns**: never (always throws)
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
402
500
|
### random() -> number
|
|
403
501
|
|
|
404
502
|
Returns a random floating-point number between 0 (inclusive) and 1 (exclusive).
|
|
@@ -431,7 +529,7 @@ print sigmoid // 0.6224593312018546
|
|
|
431
529
|
|
|
432
530
|
## Math-like Functions (v2 planned)
|
|
433
531
|
|
|
434
|
-
These are not yet implemented in v1
|
|
532
|
+
These are not yet implemented in v1+ but will be added:
|
|
435
533
|
|
|
436
534
|
```sesi
|
|
437
535
|
// Planned for v2:
|
|
@@ -593,7 +691,7 @@ keys(obj) contains "a" // Future: not yet supported
|
|
|
593
691
|
|
|
594
692
|
---
|
|
595
693
|
|
|
596
|
-
## Standard Library Modules (Supported natively in v1.
|
|
694
|
+
## Standard Library Modules (Supported natively in v1.3+)
|
|
597
695
|
|
|
598
696
|
### std/math
|
|
599
697
|
|
|
@@ -621,7 +719,7 @@ import { parse, stringify } from "std/json"
|
|
|
621
719
|
|
|
622
720
|
---
|
|
623
721
|
|
|
624
|
-
## Module Resolution (v1.
|
|
722
|
+
## Module Resolution (v1.3+)
|
|
625
723
|
|
|
626
724
|
Sesi resolves local module imports by searching directories in priority order:
|
|
627
725
|
|
|
@@ -710,8 +808,8 @@ Tip: add a folder to SESI_PATH, or place shared modules in ~/.sesi/lib
|
|
|
710
808
|
- [Quick Start](QUICKSTART.md)
|
|
711
809
|
- [Compare to other languages](COMPARISON.md)
|
|
712
810
|
- [Specification](SPECIFICATION.md)
|
|
713
|
-
- [
|
|
811
|
+
- [Reasoning Guide](REASONING.md)
|
|
714
812
|
- [Image Generation](IMAGE_GENERATION.md)
|
|
715
813
|
- [Roadmap](ROADMAP.md)
|
|
716
|
-
- [
|
|
814
|
+
- [Concurrency Systems](CONCURRENCY.md)
|
|
717
815
|
- [Examples](../examples/)
|
package/docs/COMPARISON.md
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
# The Sesi Advantage:
|
|
1
|
+
# The Sesi Advantage: Removing Boilerplate
|
|
2
2
|
|
|
3
|
-
Integrating
|
|
3
|
+
Integrating API calls or reasoning blocks into traditional applications today is painful. Standard programming languages treat API calls or reasoning blocks as an external service requiring SDKs, manual prompt string concatenation, complex schema definitions, and fragile JSON parsing.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
This document demonstrates exactly how much boilerplate and complexity Sesi eliminates compared to traditional languages like TypeScript, Python, and Go.
|
|
5
|
+
This document demonstrates how much boilerplate Sesi eliminates.
|
|
8
6
|
|
|
9
7
|
---
|
|
10
8
|
|
|
11
9
|
## 📊 The Cost of Boilerplate: A Data Comparison
|
|
12
10
|
|
|
13
|
-
When building
|
|
11
|
+
When building simple API extraction pipelines, traditional languages spend more than half their code managing SDKs.
|
|
14
12
|
|
|
15
13
|
```mermaid
|
|
16
14
|
xychart-beta
|
|
@@ -248,7 +246,7 @@ In Go, statically typed strictness combined with AI responses creates massive st
|
|
|
248
246
|
|
|
249
247
|
---
|
|
250
248
|
|
|
251
|
-
## Showcase 3: Distributed Orchestration
|
|
249
|
+
## Showcase 3: Distributed Orchestration Processes
|
|
252
250
|
|
|
253
251
|
This example demonstrates a complex distributed task: Spawning a background researcher, polling for completion with fault tolerance, and synthesizing results with AI.
|
|
254
252
|
|
|
@@ -330,5 +328,5 @@ Sesi isn't just syntactic sugar. By embedding the AI runtime directly into the p
|
|
|
330
328
|
- [Image Generation](IMAGE_GENERATION.md)
|
|
331
329
|
- [Built-in Functions](BUILTINS.md)
|
|
332
330
|
- [Architecture](ARCHITECTURE.md)
|
|
333
|
-
- [Reasoning Features](
|
|
334
|
-
- [
|
|
331
|
+
- [Reasoning Features](REASONING.md)
|
|
332
|
+
- [Concurrent Processes](CONCURRENCY.md)
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Concurrency with Sesi
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This document details how Sesi handles process concurrency and file locks.
|
|
4
4
|
|
|
5
|
-
## The "Bank
|
|
5
|
+
## The "Bank" Case Study
|
|
6
6
|
|
|
7
|
-
In this experiment, Sesi was used to solve
|
|
7
|
+
In this experiment, Sesi was used to solve file contention.
|
|
8
8
|
|
|
9
9
|
### The Challenge
|
|
10
10
|
|
|
11
|
-
Five independent Sesi
|
|
11
|
+
Five independent Sesi instances (3 Deposits, 2 Withdrawals) were launched simultaneously. All instances needed to update a single `balance.txt` file without causing data loss through race conditions.
|
|
12
12
|
|
|
13
|
-
### The
|
|
13
|
+
### The Solution (Mutex / File Locking)
|
|
14
14
|
|
|
15
|
-
Sesi solves this using
|
|
15
|
+
Sesi solves this using file locking via `try/catch` and file I/O builtins.
|
|
16
16
|
|
|
17
17
|
#### 1. Unique Identity
|
|
18
18
|
|
|
19
|
-
Each
|
|
19
|
+
Each instance generates a unique ID using Sesi's native `time()` and `random()` builtins.
|
|
20
20
|
|
|
21
21
|
```sesi
|
|
22
22
|
let id = "Agent_" + str(time()) + "_" + str(random())
|
|
@@ -40,7 +40,7 @@ while locked {
|
|
|
40
40
|
|
|
41
41
|
#### 3. Critical Section Resilience
|
|
42
42
|
|
|
43
|
-
Using `try/catch`, Sesi
|
|
43
|
+
Using `try/catch`, Sesi scripts gracefully handle filesystem contention.
|
|
44
44
|
|
|
45
45
|
```sesi
|
|
46
46
|
try {
|
|
@@ -53,10 +53,10 @@ try {
|
|
|
53
53
|
|
|
54
54
|
## Concurrency via `spawn()`
|
|
55
55
|
|
|
56
|
-
Sesi v1.1 introduced the `spawn()` builtin, allowing a single **Master Orchestrator** to launch
|
|
56
|
+
Sesi v1.1 introduced the `spawn()` builtin, allowing a single **Master Orchestrator** to launch concurrent proccesses of sesi scripts from one main file.
|
|
57
57
|
|
|
58
58
|
```sesi
|
|
59
|
-
// Master: Launching 5
|
|
59
|
+
// Master: Launching 5 Concurrent Processes...
|
|
60
60
|
spawn("main/atm_deposit.sesi")
|
|
61
61
|
spawn("main/atm_withdraw.sesi")
|
|
62
62
|
spawn("main/atm_deposit.sesi")
|
package/docs/IMAGE_GENERATION.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# Image Generation in Sesi
|
|
2
2
|
|
|
3
|
-
Sesi provides a native, language-level primitive for
|
|
3
|
+
Sesi provides a native, language-level primitive for image generation and manipulation, including image-to-image tasks like style transfer, upscaling, and editing. This primitive is designed to interoperate seamlessly with Sesi's file system builtins, allowing you to generate and persist images with minimal boilerplate.
|
|
4
4
|
|
|
5
5
|
## The `image` Primitive
|
|
6
6
|
|
|
7
|
-
To generate an image, use the `image` keyword followed by the model name, an optional configuration block, and a prompt block.
|
|
7
|
+
To generate or manipulate an image, use the `image` keyword followed by the model name, an optional configuration block, and a prompt block.
|
|
8
8
|
|
|
9
9
|
### Syntax
|
|
10
10
|
|
|
11
11
|
The syntax parallels standard `model` calls:
|
|
12
12
|
|
|
13
13
|
```
|
|
14
|
-
image("model-name") {
|
|
14
|
+
image("model-name") {configKey: "configValue"} {"Prompt text"}
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
### Basic Example
|
|
@@ -23,7 +23,7 @@ Here is a simple example demonstrating how to generate a single image and save i
|
|
|
23
23
|
prompt request {"A simple minimalist company logo for a bakery"}
|
|
24
24
|
|
|
25
25
|
// 2. Call the image generation primitive
|
|
26
|
-
let imageData = image("gemini-3.1-flash-image-preview") {
|
|
26
|
+
let imageData = image("gemini-3.1-flash-image-preview") {ratio: "1:1", size: "1K"} {request}
|
|
27
27
|
|
|
28
28
|
// 3. Write the payload to disk
|
|
29
29
|
try
|
|
@@ -52,7 +52,7 @@ for product in products
|
|
|
52
52
|
prompt request {"A clean studio presentation photograph of a " product " on a solid white background."}
|
|
53
53
|
prompt filename { outputDir product ".png" }
|
|
54
54
|
try
|
|
55
|
-
{let imageData = image("gemini-3.1-flash-image-preview") {
|
|
55
|
+
{let imageData = image("gemini-3.1-flash-image-preview") {ratio: "1:1", size: "1K"} {request}
|
|
56
56
|
|
|
57
57
|
// Attempt local file write
|
|
58
58
|
let success = write_image(filename, imageData)
|
|
@@ -69,9 +69,9 @@ print "Asset generation complete."
|
|
|
69
69
|
|
|
70
70
|
When configuring the `image` call (specifically for models like `gemini-3.1-flash-image-preview`), the configuration block maps directly to backend SDK capabilities:
|
|
71
71
|
|
|
72
|
-
- `
|
|
73
|
-
- `
|
|
74
|
-
- `
|
|
72
|
+
- `ratio`: The aspect ratio of the image (e.g., `"1:1"`, `"16:9"`, `"9:16"`).
|
|
73
|
+
- `size`: Dimensional sizing constraints (Must be `"512"`, `"1K"`, `"2K"`, or `"4K"`).
|
|
74
|
+
- `temperature`: *Will be deprecated in Gemini 3.x+, use thinkingLevel instead.* — controls variance.
|
|
75
75
|
|
|
76
76
|
## File I/O Integration: `write_image`
|
|
77
77
|
|
|
@@ -139,11 +139,10 @@ print "Render saved."
|
|
|
139
139
|
let dir = "frames/"
|
|
140
140
|
let files = list_dir(dir)
|
|
141
141
|
|
|
142
|
-
for f in files
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
142
|
+
for f in files
|
|
143
|
+
{prompt p {dir f}
|
|
144
|
+
let desc = model("gemini-3.1-flash-lite") {images: p} {"Describe this frame in one sentence."}
|
|
145
|
+
print f desc}
|
|
147
146
|
```
|
|
148
147
|
|
|
149
148
|
### Config Reference
|
|
@@ -154,4 +153,4 @@ When used inside `model()` or `image()` config blocks, `images` is resolved at r
|
|
|
154
153
|
|-----|---------------|-------|
|
|
155
154
|
| `images` | `string` or `array<string>` | One or more local file paths. Resolved relative to `process.cwd()`. |
|
|
156
155
|
|
|
157
|
-
> **Note:** Multimodal input requires a vision-capable model (e.g. `gemini-3-flash-preview`, `gemini-3.1-flash-lite`, `gemini-3.1-pro-preview`). Image-generation models that accept reference images are listed in their respective model documentation.
|
|
156
|
+
> **Note:** Multimodal input requires a vision-capable model (e.g. `gemini-3-flash-preview`, `gemini-3.1-flash-lite`, `gemini-3.1-pro-preview`, `gemini-3.5-flash`). Image-generation models that accept reference images are listed in their respective model documentation.
|