Skip to content

Commit 36b36f4

Browse files
committed
di reference: fix generation of multline default values + objectParameters
1 parent a3780e7 commit 36b36f4

8 files changed

Lines changed: 60 additions & 24 deletions

docs/build/reference/customtask/cmem_plugin_llm-ExecuteInstructions.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ The entity path where the instruction result will be provided.
215215
A list of messages comprising the conversation compatible with OpenAI chat completion API message object.
216216

217217
- Datatype: `code-json`
218-
- Default Value: `[
218+
- Default Value:
219+
``` json
220+
[
219221
{
220222
"role": "developer",
221223
"content": "You are a helpful assistant."
@@ -224,7 +226,8 @@ A list of messages comprising the conversation compatible with OpenAI chat compl
224226
"role": "user",
225227
"content": "{{ instruction_prompt }}"
226228
}
227-
]`
229+
]
230+
```
228231

229232

230233

@@ -260,13 +263,16 @@ Specifying the format that the model must output.
260263
The Pydantic schema definition with a mandatory class named `StructuredOutput(BaseModel)`.
261264

262265
- Datatype: `code-python`
263-
- Default Value: `from pydantic import BaseModel
266+
- Default Value:
267+
``` python
268+
from pydantic import BaseModel
264269

265270
class StructuredOutput(BaseModel):
266271
title: str
267272
abstract: str
268273
keywords: list[str]
269-
`
274+
275+
```
270276

271277

272278

docs/build/reference/customtask/cmem_plugin_parameters-ParametersPlugin.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ limit: 5
4848
Your parameter configuration in YAML Syntax. One 'parameter: value' pair per line. url: http://example.org method: GET query: | SELECT ?s WHERE {{ ?s ?p ?o }} execute_once: True limit: 5
4949

5050
- Datatype: `code-yaml`
51-
- Default Value: `url: http://example.org
51+
- Default Value:
52+
``` yaml
53+
url: http://example.org
5254
method: GET
5355
query: |
5456
SELECT ?s
@@ -57,7 +59,8 @@ query: |
5759
}}
5860
execute_once: True
5961
limit: 5
60-
`
62+
63+
```
6164
6265
6366

docs/build/reference/customtask/cmem_plugin_pdf_extract-pdf_extract-PdfExtract.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ Specifies how text is extracted from a PDF page. Options include "raw", "layout"
195195
Custom table extraction strategy in YAML format.
196196

197197
- Datatype: `multiline string`
198-
- Default Value: `# edge_min_length: 3
198+
- Default Value:
199+
``` text
200+
# edge_min_length: 3
199201
# explicit_horizontal_lines: []
200202
# explicit_vertical_lines: []
201203
# horizontal_strategy: lines
@@ -218,7 +220,8 @@ Custom table extraction strategy in YAML format.
218220
# vertical_ttb: true
219221
# x_tolerance: 2
220222
# y_tolerance: 2
221-
# vertical_strategy: lines`
223+
# vertical_strategy: lines
224+
```
222225

223226

224227

@@ -227,7 +230,9 @@ Custom table extraction strategy in YAML format.
227230
Custom text extraction strategy in YAML format.
228231

229232
- Datatype: `multiline string`
230-
- Default Value: `# extra_attrs: []
233+
- Default Value:
234+
``` text
235+
# extra_attrs: []
231236
# horizontal_ltr: true
232237
# keep_blank_chars: false
233238
# layout: false
@@ -237,7 +242,8 @@ Custom text extraction strategy in YAML format.
237242
# x_density: 7.25
238243
# x_tolerance: 1
239244
# y_density: 13
240-
# y_tolerance: 1`
245+
# y_tolerance: 1
246+
```
241247

242248

243249

docs/build/reference/customtask/cmem_plugin_validation-validate-ValidateGraph.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,13 @@ In this graph, the validation results are materialized. If left empty, results a
8181
The query to select the resources to validate. Use {{context_graph}} as a placeholder for the select context graph for validation.
8282

8383
- Datatype: `code-sparql`
84-
- Default Value: `SELECT DISTINCT ?resource
84+
- Default Value:
85+
``` sparql
86+
SELECT DISTINCT ?resource
8587
FROM <{{context_graph}}>
8688
WHERE { ?resource a ?class . FILTER isIRI(?resource) }
87-
`
89+
90+
```
8891

8992

9093

docs/build/reference/customtask/ucumNormalizationTask.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ An absolute file path for a unit CSV configuration file (for syntax see 'configu
7777
While all SI units and decimal prefixes are supported by default, custom or obsolete units have to be added via this configuration. NOTE: when constructing formulae depending on other units defined in the configuration, make sure to order them dependently. ALSO: Rational numbers are not supported by the UCUM syntax, express them as a fraction (see 'grain' example below).
7878

7979
- Datatype: `multiline string`
80-
- Default Value: `
80+
- Default Value:
81+
``` text
82+
8183
# Example configuration, don't forget to remove the '#' in front of each row.
8284
# CSV COLUMNS:
8385
# * unit name - the human readable name of the unit
@@ -91,7 +93,8 @@ While all SI units and decimal prefixes are supported by default, custom or obso
9193
# Denier , true , den , g/(9.km)
9294
# Grain , true , gr , (45.g)/100
9395
# Pound , true , lb , (45359237.kg)/100000000 , # , lbm
94-
`
96+
97+
```
9598

9699

97100

docs/build/reference/dataset/SnowflakeJdbc.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ The names of the written tables are generated as follows:
5454

5555
Connection parameters
5656

57-
- Datatype: `objectParameter`
58-
- Default Value: `{'parameters': {'database': '', 'privateKeyPassword': '', 'host': '<orgname>-<account_name>.snowflakecomputing.com', 'privateKey': '', 'user': '', 'schema': '', 'port': '443', 'warehouse': '', 'table': '', 'password': '', 'additionalParameters': ''}}`
57+
5958

6059

6160
#### Account URL hostname
@@ -151,8 +150,7 @@ Table name. Can be empty if the read-strategy is not set to read the full table.
151150

152151
Parameters related to reading from the database.
153152

154-
- Datatype: `objectParameter`
155-
- Default Value: `{'parameters': {'queryStrategy': 'access-complete-table', 'restriction': '', 'groupBy': '', 'orderBy': '', 'sourceQuery': '', 'limit': '10'}}`
153+
156154

157155

158156
#### Source query
@@ -208,8 +206,7 @@ An SQL WHERE clause to filter the records to be retrieved.
208206

209207
Parameters related to writing to the database.
210208

211-
- Datatype: `objectParameter`
212-
- Default Value: `{'parameters': {'writeStrategy': 'default', 'multipleValuesStrategy': 'concatenateValuesStrategy'}}`
209+
213210

214211

215212
#### Write strategy
@@ -233,8 +230,7 @@ How multiple values per entity property are written.
233230

234231
Query execution parameters.
235232

236-
- Datatype: `objectParameter`
237-
- Default Value: `{'parameters': {'retries': '0', 'pause': '2000'}}`
233+
238234

239235

240236
#### Retries

tools/templates/parameter.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22

33
{{property.description}}
44

5-
- Datatype: `{{property.parameterType}}`
6-
- Default Value: `{{property.value if property.value != "" else "None"}}`
5+
{% if property.parameterType != "objectParameter" -%}- Datatype: `{{property.parameterType}}`
6+
{% if property.value and '\n' in property.value -%}- Default Value:
7+
``` {{ property.get_pygments_code() }}
8+
{{ property.value }}
9+
```
10+
{%- else %}- Default Value: `{{property.value if property.value != "" else "None"}}`
11+
{%- endif %}{%- endif %}
712

813
{% for sub_property in property.properties.values() %}
914
#### {{sub_property.title}}

tools/update_di_reference.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@ class PropertyDescription(BaseModel):
4747
visibleInDialog: bool
4848
properties: dict[str, dict] = {}
4949

50+
def get_pygments_code(self) -> str:
51+
"""Get a markdown pygments code based on the parameterType
52+
53+
https://pygments.org/docs/lexers/
54+
"""
55+
codes = {
56+
"code-json": "json",
57+
"code-python": "python",
58+
"code-yaml": "yaml",
59+
"code-sql": "sql",
60+
"code-sparql": "sparql",
61+
}
62+
return codes.get(self.parameterType, "text")
63+
5064

5165
class PluginDescription(BaseModel):
5266
"""Plugin description."""

0 commit comments

Comments
 (0)