@@ -828,7 +828,8 @@ Ollama. Credentials and model selection are determined by environment variables
828
828
with ` options ` taking precedence.
829
829
830
830
For Ollama, set the ` OLLAMA ` environment variable to ` true ` , ensure Ollama is
831
- running, and set ` AI_MODEL ` to your desired model name.
831
+ running, and set ` AI_MODEL ` to your desired model name. You can also pass your
832
+ instance of Ollama to the ` ollama ` option.
832
833
833
834
To manage rate limits, use ` batchSize ` to process multiple rows per request and
834
835
` rateLimitPerMinute ` to introduce delays between requests. For higher rate
@@ -851,7 +852,7 @@ This method does not support tables containing geometries.
851
852
##### Signature
852
853
853
854
``` typescript
854
- async aiRowByRow (column : string , newColumn : string , prompt : string , options ?: { batchSize?: number ; concurrent ?: number ; cache ?: boolean ; test ?: (dataPoint : unknown ) => any ; retry ?: number ; model ?: string ; apiKey ?: string ; vertex ?: boolean ; project ?: string ; location ?: string ; ollama ?: boolean ; verbose ?: boolean ; rateLimitPerMinute ?: number ; clean ?: (response : unknown ) => any }): Promise < void > ;
855
+ async aiRowByRow (column : string , newColumn : string , prompt : string , options ?: { batchSize?: number ; concurrent ?: number ; cache ?: boolean ; test ?: (dataPoint : unknown ) => any ; retry ?: number ; model ?: string ; apiKey ?: string ; vertex ?: boolean ; project ?: string ; location ?: string ; ollama ?: boolean | Ollama ; verbose ?: boolean ; rateLimitPerMinute ?: number ; clean ?: (response : unknown ) => any }): Promise < void > ;
855
856
```
856
857
857
858
##### Parameters
@@ -887,7 +888,8 @@ async aiRowByRow(column: string, newColumn: string, prompt: string, options?: {
887
888
- ** ` options.location ` ** : - The Google Cloud location for Vertex AI. Defaults to
888
889
the ` AI_LOCATION ` environment variable.
889
890
- ** ` options.ollama ` ** : - If ` true ` , uses Ollama. Defaults to the ` OLLAMA `
890
- environment variable.
891
+ environment variable. If you want your Ollama instance to be used, you can
892
+ pass it here too.
891
893
- ** ` options.verbose ` ** : - If ` true ` , logs additional debugging information,
892
894
including the full prompt sent to the AI. Defaults to ` false ` .
893
895
- ** ` options.clean ` ** : - A function to clean the AI's response before testing,
@@ -948,7 +950,8 @@ Ollama. Credentials and model selection are determined by environment variables
948
950
` options ` , with ` options ` taking precedence.
949
951
950
952
For Ollama, set the ` OLLAMA ` environment variable to ` true ` , ensure Ollama is
951
- running, and set ` AI_EMBEDDINGS_MODEL ` to your desired model name.
953
+ running, and set ` AI_EMBEDDINGS_MODEL ` to your desired model name. You can also
954
+ pass your instance of Ollama to the ` ollama ` option.
952
955
953
956
To manage rate limits, use ` rateLimitPerMinute ` to introduce delays between
954
957
requests. For higher rate limits (business/professional accounts), ` concurrent `
@@ -968,7 +971,7 @@ This method does not support tables containing geometries.
968
971
##### Signature
969
972
970
973
``` typescript
971
- async aiEmbeddings (column : string , newColumn : string , options ?: { createIndex?: boolean ; concurrent ?: number ; cache ?: boolean ; model ?: string ; apiKey ?: string ; vertex ?: boolean ; project ?: string ; location ?: string ; ollama ?: boolean ; verbose ?: boolean ; rateLimitPerMinute ?: number }): Promise < void > ;
974
+ async aiEmbeddings (column : string , newColumn : string , options ?: { createIndex?: boolean ; concurrent ?: number ; cache ?: boolean ; model ?: string ; apiKey ?: string ; vertex ?: boolean ; project ?: string ; location ?: string ; ollama ?: boolean | Ollama ; verbose ?: boolean ; rateLimitPerMinute ?: number }): Promise < void > ;
972
975
```
973
976
974
977
##### Parameters
@@ -1000,7 +1003,8 @@ async aiEmbeddings(column: string, newColumn: string, options?: { createIndex?:
1000
1003
- ** ` options.location ` ** : - The Google Cloud location for Vertex AI. Defaults to
1001
1004
the ` AI_LOCATION ` environment variable.
1002
1005
- ** ` options.ollama ` ** : - If ` true ` , uses Ollama. Defaults to the ` OLLAMA `
1003
- environment variable.
1006
+ environment variable. If you want your Ollama instance to be used, you can
1007
+ pass it here too.
1004
1008
- ** ` options.verbose ` ** : - If ` true ` , logs additional debugging information.
1005
1009
Defaults to ` false ` .
1006
1010
@@ -1044,7 +1048,8 @@ by environment variables (`AI_KEY`, `AI_PROJECT`, `AI_LOCATION`,
1044
1048
precedence.
1045
1049
1046
1050
For Ollama, set the ` OLLAMA ` environment variable to ` true ` , ensure Ollama is
1047
- running, and set ` AI_EMBEDDINGS_MODEL ` to your desired model name.
1051
+ running, and set ` AI_EMBEDDINGS_MODEL ` to your desired model name. You can also
1052
+ pass your instance of Ollama to the ` ollama ` option.
1048
1053
1049
1054
The ` cache ` option enables local caching of the specified text's embedding in
1050
1055
` .journalism-cache ` (from the ` getEmbedding ` function in the
@@ -1058,7 +1063,7 @@ up processing. If the index already exists, it will not be recreated.
1058
1063
##### Signature
1059
1064
1060
1065
``` typescript
1061
- async aiVectorSimilarity (text : string , column : string , nbResults : number , options ?: { createIndex?: boolean ; outputTable ?: string ; cache ?: boolean ; model ?: string ; apiKey ?: string ; vertex ?: boolean ; project ?: string ; location ?: string ; ollama ?: boolean ; verbose ?: boolean }): Promise < SimpleTable > ;
1066
+ async aiVectorSimilarity (text : string , column : string , nbResults : number , options ?: { createIndex?: boolean ; outputTable ?: string ; cache ?: boolean ; model ?: string ; apiKey ?: string ; vertex ?: boolean ; project ?: string ; location ?: string ; ollama ?: boolean | Ollama ; verbose ?: boolean }): Promise < SimpleTable > ;
1062
1067
```
1063
1068
1064
1069
##### Parameters
@@ -1088,7 +1093,8 @@ async aiVectorSimilarity(text: string, column: string, nbResults: number, option
1088
1093
- ** ` options.location ` ** : - The Google Cloud location for Vertex AI. Defaults to
1089
1094
the ` AI_LOCATION ` environment variable.
1090
1095
- ** ` options.ollama ` ** : - If ` true ` , uses Ollama. Defaults to the ` OLLAMA `
1091
- environment variable.
1096
+ environment variable. If you want your Ollama instance to be used, you can
1097
+ pass it here too.
1092
1098
- ** ` options.verbose ` ** : - If ` true ` , logs additional debugging information.
1093
1099
Defaults to ` false ` .
1094
1100
@@ -1140,7 +1146,8 @@ Ollama. Credentials and model selection are determined by environment variables
1140
1146
with ` options ` taking precedence.
1141
1147
1142
1148
For Ollama, set the ` OLLAMA ` environment variable to ` true ` , ensure Ollama is
1143
- running, and set ` AI_MODEL ` to your desired model name.
1149
+ running, and set ` AI_MODEL ` to your desired model name. You can also pass your
1150
+ instance of Ollama to the ` ollama ` option.
1144
1151
1145
1152
Temperature is set to 0 to aim for reproducible results. For future consistency,
1146
1153
it's recommended to copy the generated query and execute it manually using
@@ -1154,7 +1161,7 @@ and time. Remember to add `.journalism-cache` to your `.gitignore`.
1154
1161
##### Signature
1155
1162
1156
1163
``` typescript
1157
- async aiQuery (prompt : string , options ?: { cache?: boolean ; model ?: string ; apiKey ?: string ; vertex ?: boolean ; project ?: string ; location ?: string ; verbose ?: boolean }): Promise < void > ;
1164
+ async aiQuery (prompt : string , options ?: { cache?: boolean ; model ?: string ; apiKey ?: string ; vertex ?: boolean ; project ?: string ; location ?: string ; ollama ?: boolean | Ollama ; verbose ?: boolean }): Promise < void > ;
1158
1165
```
1159
1166
1160
1167
##### Parameters
@@ -1174,6 +1181,9 @@ async aiQuery(prompt: string, options?: { cache?: boolean; model?: string; apiKe
1174
1181
to the ` AI_PROJECT ` environment variable.
1175
1182
- ** ` options.location ` ** : - The Google Cloud location for Vertex AI. Defaults to
1176
1183
the ` AI_LOCATION ` environment variable.
1184
+ - ** ` options.ollama ` ** : - If ` true ` , uses Ollama. Defaults to the ` OLLAMA `
1185
+ environment variable. If you want your Ollama instance to be used, you can
1186
+ pass it here too.
1177
1187
- ** ` options.verbose ` ** : - If ` true ` , logs additional debugging information,
1178
1188
including the full prompt sent to the AI. Defaults to ` false ` .
1179
1189
@@ -5923,6 +5933,12 @@ await table.logTable({ conditions: `status === 'active'` });
5923
5933
Generates and logs a line chart to the console. The data should be sorted by the
5924
5934
x-axis values for accurate representation.
5925
5935
5936
+ ** Data Type Requirements:**
5937
+
5938
+ - ** X-axis values** : Must be ` number ` or ` Date ` objects.
5939
+ - ** Y-axis values** : Must be ` number ` values.
5940
+ - All values must be non-null and defined.
5941
+
5926
5942
##### Signature
5927
5943
5928
5944
``` typescript
@@ -5931,13 +5947,17 @@ async logLineChart(x: string, y: string, options?: { formatX?: (d: unknown) => a
5931
5947
5932
5948
##### Parameters
5933
5949
5934
- - ** ` x ` ** : - The name of the column to be used for the x-axis.
5935
- - ** ` y ` ** : - The name of the column to be used for the y-axis.
5950
+ - ** ` x ` ** : - The name of the column to be used for the x-axis. Values must be
5951
+ numbers or Date objects.
5952
+ - ** ` y ` ** : - The name of the column to be used for the y-axis. Values must be
5953
+ numbers.
5936
5954
- ** ` options ` ** : - An optional object with configuration options:
5937
- - ** ` options.formatX ` ** : - A function to format the x-axis tick labels. Defaults
5938
- to converting the label to a string.
5939
- - ** ` options.formatY ` ** : - A function to format the y-axis tick labels. Defaults
5940
- to converting the label to a string.
5955
+ - ** ` options.formatX ` ** : - A function to format the x-axis values for display.
5956
+ It receives the raw x-value as input and should return a string. If the first
5957
+ data point's x value is a Date, it defaults to formatting the date as
5958
+ "YYYY-MM-DD".
5959
+ - ** ` options.formatY ` ** : - A function to format the y-axis values for display.
5960
+ It receives the raw y-value as input and should return a string.
5941
5961
- ** ` options.smallMultiples ` ** : - The name of a column to create small multiples
5942
5962
(also known as facets or trellis charts). Each unique value in this column
5943
5963
will generate a separate chart.
@@ -5993,6 +6013,12 @@ await table.logLineChart("date", "value", {
5993
6013
Generates and logs a dot chart to the console. The data should be sorted by the
5994
6014
x-axis values for accurate representation.
5995
6015
6016
+ ** Data Type Requirements:**
6017
+
6018
+ - ** X-axis values** : Must be ` number ` or ` Date ` objects.
6019
+ - ** Y-axis values** : Must be ` number ` values.
6020
+ - All values must be non-null and defined.
6021
+
5996
6022
##### Signature
5997
6023
5998
6024
``` typescript
@@ -6001,13 +6027,17 @@ async logDotChart(x: string, y: string, options?: { formatX?: (d: unknown) => an
6001
6027
6002
6028
##### Parameters
6003
6029
6004
- - ** ` x ` ** : - The name of the column to be used for the x-axis.
6005
- - ** ` y ` ** : - The name of the column to be used for the y-axis.
6030
+ - ** ` x ` ** : - The name of the column to be used for the x-axis. Values must be
6031
+ numbers or Date objects.
6032
+ - ** ` y ` ** : - The name of the column to be used for the y-axis. Values must be
6033
+ numbers.
6006
6034
- ** ` options ` ** : - An optional object with configuration options:
6007
- - ** ` options.formatX ` ** : - A function to format the x-axis tick labels. Defaults
6008
- to converting the label to a string.
6009
- - ** ` options.formatY ` ** : - A function to format the y-axis tick labels. Defaults
6010
- to converting the label to a string.
6035
+ - ** ` options.formatX ` ** : - A function to format the x-axis values for display.
6036
+ It receives the raw x-value as input and should return a string. If the first
6037
+ data point's x value is a Date, it defaults to formatting the date as
6038
+ "YYYY-MM-DD".
6039
+ - ** ` options.formatY ` ** : - A function to format the y-axis values for display.
6040
+ It receives the raw y-value as input and should return a string.
6011
6041
- ** ` options.smallMultiples ` ** : - The name of a column to create small multiples
6012
6042
(also known as facets). Each unique value in this column will generate a
6013
6043
separate chart.
0 commit comments