You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: services/app/src/lib/components/tables/(sub)/guides/llm.md
+56-22Lines changed: 56 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
### Basic Concept
1
+
#####Basic Concept
2
2
3
-
The **LLM Column** in a **Generative Table** lets you synthesize outputs using a Large Language Model (LLM). You define a prompt (and optionally Retrieval Augmented Generation (RAG) settings), and the LLM generates the value for the column / cell.
3
+
The **LLM Column** in a Generative Table lets you synthesize outputs using a Large Language Model (LLM). You define a prompt (and optionally Retrieval Augmented Generation (RAG) settings), and the LLM generates the value for the column / cell.
4
4
5
5
The LLM Column will:
6
6
@@ -17,7 +17,7 @@ You control how the LLM behaves through:
17
17
18
18
---
19
19
20
-
### Referencing Upstream Columns in Prompts
20
+
#####Referencing Upstream Columns in Prompts
21
21
22
22
The **Prompt** can reference values from upstream columns (columns to the left) using the syntax:
23
23
@@ -33,26 +33,15 @@ For a row where the `Input` column contains value `Good morning`, the actual pro
33
33
34
34
> Translate "Good morning" into Italian:
35
35
36
-
Tips
36
+
To insert a reference, click on the corresponding columns above the Prompt input area. Alternatively, you can manually insert `${Column Name}` into the Prompt.
37
37
38
-
- To insert a reference, click on the corresponding columns above the Prompt input area
39
-
- Alternatively, you can manually insert `${Column Name}` into the Prompt
40
-
- You can reference multiple columns in the same prompt, as long as the names match your column names exactly (case-sensitive).
41
-
- Repeated references will be not be de-duplicated. For example:
> Translate "<spanclass="column-variable input-col">Input</span>" into Italian:
38
+
You can reference multiple columns in the same prompt, as long as the names match your column names exactly (case-sensitive).
46
39
47
-
will result in
48
-
49
-
> Good morning
50
-
>
51
-
> Translate "Good morning" into Italian:
40
+
See more prompting tips below.
52
41
53
42
---
54
43
55
-
### Retrieval Augmented Generation (RAG)
44
+
#####Retrieval Augmented Generation (RAG)
56
45
57
46
You can optionally use RAG to ground the LLM’s output in external knowledge stored in a Knowledge Table.
58
47
@@ -78,10 +67,55 @@ When RAG is enabled, the LLM Column will:
78
67
- After reranking, the top‑`k` references are selected and injected into the prompt sent to the LLM.
79
68
80
69
5. Optionally generate inline citations
81
-
- You can enable inline citations in **pandoc style**:
82
-
```text
83
-
[@ref0; @ref1; @ref2]
84
-
```
70
+
- You can enable inline citations in **pandoc style**: `[@ref0; @ref1; @ref2]`
85
71
- When enabled, the generated text can include these citation markers to indicate which references support which statements.
86
72
87
73
The final prompts sent to the LLM is your System Prompt and Prompt, plus any injected references (and, if configured, citation context), all guided by the settings you choose (k, citations, reranking).
74
+
75
+
---
76
+
77
+
##### Multi‑turn Chat
78
+
79
+
When Multi‑turn Chat is enabled, each generation can use data from previous rows as conversation history, rather than only the current row. By default, rows are ordered from latest to oldest, and the LLM sees all rows from the current one downward as its context.
80
+
81
+
For example:
82
+
83
+
1. Create a table with an input column `Query` and a multi‑turn LLM column `Output`.
84
+
2. Add a row where `Query` is `What is 2+2?`. The LLM will respond with `4`.
85
+
3. Add another row where `Query` is `Add 3`. Because multi‑turn chat is enabled, the LLM will understand this as continuing the previous exchange and return `7` as the result.
86
+
87
+
---
88
+
89
+
##### Prompting Tips
90
+
91
+
<!-- prettier-ignore-start -->
92
+
93
+
- When referencing other columns, it is recommended to separate them using XML tags or Markdown headings. For example:
Copy file name to clipboardExpand all lines: services/app/src/lib/components/tables/(sub)/guides/python.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
### Basic Concept
1
+
#####Basic Concept
2
2
3
-
The **Python Column** in a **Generative Table** lets you generate or transform cell values using custom Python code, so you can build image, audio, and general-purpose transformations directly in your table.
3
+
The **Python Column** in a Generative Table lets you generate or transform cell values using custom Python code, so you can build image, audio, and general-purpose transformations directly in your table.
4
4
5
5
All upstream columns (columns to the left) are passed to your code as a dictionary named `row` in the global context.
6
6
@@ -31,7 +31,7 @@ Consider using `try/except` blocks and writing fallback value when needed.
31
31
32
32
---
33
33
34
-
### Preinstalled Libraries
34
+
#####Preinstalled Libraries
35
35
36
36
The following libraries are available:
37
37
@@ -57,7 +57,7 @@ The following libraries are available:
57
57
58
58
---
59
59
60
-
### Working with Images
60
+
#####Working with Images
61
61
62
62
When an upstream column contains an image, its value in `row` is **raw binary data** (`bytes`).
63
63
@@ -66,7 +66,7 @@ To output an image, make sure:
66
66
- The Python Column has data type `image`.
67
67
- The output image is one of: `.jpeg`, `.jpg`, `.png`, `.gif`, `.webp`.
68
68
69
-
#### Usage Pattern
69
+
Usage pattern:
70
70
71
71
1. Read image bytes from `row`.
72
72
2. Perform your image operations (for example, using a library such as Pillow / `PIL`).
@@ -96,7 +96,7 @@ with Image.open(io.BytesIO(image_bytes)) as img:
96
96
97
97
---
98
98
99
-
### Working with Audios
99
+
#####Working with Audios
100
100
101
101
When an upstream column contains audio, its value in `row` is also **raw binary data** (`bytes`).
102
102
@@ -105,7 +105,7 @@ To output an audio, make sure:
105
105
- The Python Column has data type `audio`.
106
106
- The output audio is one of: `.mp3`, `.wav`.
107
107
108
-
#### Usage Pattern
108
+
Usage pattern:
109
109
110
110
1. Read audio bytes from `row`.
111
111
2. Perform your audio processing (for example, using a library such as `soundfile`).
0 commit comments