Skip to content

Commit b0767a0

Browse files
committed
docs: describe new settings structure and streaming
1 parent c51af55 commit b0767a0

File tree

3 files changed

+48
-7
lines changed

3 files changed

+48
-7
lines changed

Writerside/m.tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
</toc-element>
1414
<toc-element topic="Usage.md"/>
1515
<toc-element topic="Cost.md"/>
16-
</instance-profile>
16+
</instance-profile>

Writerside/topics/Configuration_Overview.md

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,39 @@ If you have text, textarea, image or image+ Template Variables you wish to use w
1313
- **text inputs** – modAI uses the base prompt and model and directly inputs the content into the field
1414
- **textarea inputs** – handled the same as text inputs
1515
- **richtext inputs** – handled the same as a textarea input, but you must manually copy/paste the output into the textarea
16-
- **image inputs** – modAI uses the default image model and sizes and creates the imaegs in the `assets/ai` directory
16+
- **image inputs** – modAI uses the default image model and sizes and creates the images in the `assets/ai` directory
1717
- **image+ TVs** – handled the same as image inputs, with the addition of being able to use the Vision model for creating alt tag captions from generated images
1818

1919

2020
### Configuring Field Prompts
2121

22-
Customize the base prompts and configurations in the `global`, `image`, `resources` and `vision` areas in the system settings as needed. The `modai.global.base.prompt` prepends the base to ever other text or textarea prompt, but it does not for image or vision model prompts.
22+
Customize the base prompts and configurations in the `global`, `image`, `resources` and `vision` areas in the system settings as needed. The `modai.global.text.base_prompt` prepends the base to ever other text or textarea prompt, but it does not for image or vision model prompts.
2323

2424
## Settings Format
2525

26-
Settings use the following naming convention: `modai.{res||tv}.{field/tv-name}.{setting}` where `{res||tv}` denotes a default MODX Revolution field or a custom Template Variable (TV) and `field/tv-name` is its actual name (e.g., pagetitle, longtitle, fancy-image-tv, etc.).
26+
Settings use the following naming convention: `{namespace}.{field}.{type}.{setting}`.
27+
- Where `namespace` by default is `modai`, but other extras can pass their own to override default settings from their extra.
28+
- Field in the core modAI can be `res.pagetitle`, `res.longtitle`, `res.introtext`, `res.description`, `res.content` and `tv.tv_name` (for any text/image/image+ TV), but Extras can pass whatever make sense for them (for example TinyMCE RTE will pass `ta` for the content RTE instance). The field can also be `global` which is a fallback for any setting.
29+
- Type can be one of `text`/`image`/`vision` to denote this setting will get only applied to AI interaction from the specific category
30+
- Setting is a target setting name like `model`, `temperature`, `quality`
31+
32+
All settings drill down from the most specific to the global one, few examples (resolves top to bottom):
33+
```
34+
modai.res.content.text.model
35+
modai.global.text.model
36+
```
37+
38+
```
39+
modai.tv.poster.image.model
40+
modai.global.image.model
41+
```
42+
43+
```
44+
tinymcerte.modai.ta.text.model
45+
tinymcerte.modai.global.text.model
46+
modai.ta.text.model
47+
modai.global.text.model
48+
```
2749

2850
The `setting` for text or textarea inputs can contain several options below which will override the default settings from the `global` area:
2951

@@ -36,18 +58,33 @@ Image and Image+ fields do not prepend their prompts with the base prompt. Image
3658
- **model** – defaults to `dall-e-3`
3759
- **quality** – defaults to `standard`
3860
- **size** – defaults to `1792x1024`
61+
- **style** – defaults to `vivid`
3962

40-
Image+ fields can use Vision models to describe an imgage for the alt content found in the `vision` area:
63+
Image+ fields can use Vision models to describe an image for the alt content found in the `vision` area:
4164

4265
- **vision.model** – defaults to `gpt-4o-mini`
4366

67+
### Custom Options
68+
If needed, cutom options can be supplied to the AI service by either using the `global` variant of the setting for specific type, for example `modai.global.text.custom_options` and setting it to a JSON object with desired properties, or by using a setting for a specific field like `modai.res.content.text.custom_options`.
69+
4470
### Overriding Global Defaults
4571

4672
Each field that you attach modAI to can have settings overrides. This means that you can mix and match which models are used for specific fields, allowing you to optimize for cost or quality depending on your application. For example to use Claude Haiku to generate a (very) creative summary for the `[[*introtext]]` field, you would update/create the following settings:
4773

4874
- `modai.api.claude.key``{your API key}`
49-
- `modai.res.introtext.model``claude-3-5-haiku-20241022`
50-
- `modai.res.introtext.temperature``0.9`
75+
- `modai.res.introtext.text.model``claude-3-5-haiku-20241022`
76+
- `modai.res.introtext.text.temperature``0.9`
77+
78+
## Streaming
79+
80+
If you'd like to stream the AI response into the UI (see the incrementally generated response), you can do so by enabling `modai.global.text.stream` and/or `modai.global.vision.stream` (as always, you can enable this also for only specific fields).
81+
82+
<warning id="warn-streaming">
83+
Currently streaming only works when the request is executed on client ("modai.api.execute_on_server" is set to "false").
84+
</warning>
85+
86+
87+
5188

5289
<seealso>
5390
<category ref="related">

Writerside/topics/Supported-Providers.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ To change a prompt to use Google Gemini, set its corresponding model setting, e.
3434

3535
## Claude (Anthropic)
3636

37+
<warning id="claude-server-only">
38+
At this moment Claude can only work serverside. Setting either "modai.api.execute_on_server" or "modai.api.claude.execute_on_server" to "true".
39+
</warning>
40+
3741
Claude currently only supports text generation. Add a valide API key to the `modai.api.claude.key` to use Claude.
3842

3943
- **text generation** - https://docs.anthropic.com/en/docs/about-claude/models

0 commit comments

Comments
 (0)