Skip to content

Commit b3d5c24

Browse files
committed
v5.6.23
1 parent a962a19 commit b3d5c24

File tree

2 files changed

+54
-24
lines changed

2 files changed

+54
-24
lines changed

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nshiab/simple-data-analysis",
3-
"version": "5.6.22",
3+
"version": "5.6.23",
44
"exports": {
55
".": "./src/index.ts"
66
},

llm.md

Lines changed: 53 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,8 @@ Ollama. Credentials and model selection are determined by environment variables
828828
with `options` taking precedence.
829829

830830
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.
832833

833834
To manage rate limits, use `batchSize` to process multiple rows per request and
834835
`rateLimitPerMinute` to introduce delays between requests. For higher rate
@@ -851,7 +852,7 @@ This method does not support tables containing geometries.
851852
##### Signature
852853

853854
```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>;
855856
```
856857

857858
##### Parameters
@@ -887,7 +888,8 @@ async aiRowByRow(column: string, newColumn: string, prompt: string, options?: {
887888
- **`options.location`**: - The Google Cloud location for Vertex AI. Defaults to
888889
the `AI_LOCATION` environment variable.
889890
- **`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.
891893
- **`options.verbose`**: - If `true`, logs additional debugging information,
892894
including the full prompt sent to the AI. Defaults to `false`.
893895
- **`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
948950
`options`, with `options` taking precedence.
949951

950952
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.
952955

953956
To manage rate limits, use `rateLimitPerMinute` to introduce delays between
954957
requests. For higher rate limits (business/professional accounts), `concurrent`
@@ -968,7 +971,7 @@ This method does not support tables containing geometries.
968971
##### Signature
969972

970973
```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>;
972975
```
973976

974977
##### Parameters
@@ -1000,7 +1003,8 @@ async aiEmbeddings(column: string, newColumn: string, options?: { createIndex?:
10001003
- **`options.location`**: - The Google Cloud location for Vertex AI. Defaults to
10011004
the `AI_LOCATION` environment variable.
10021005
- **`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.
10041008
- **`options.verbose`**: - If `true`, logs additional debugging information.
10051009
Defaults to `false`.
10061010

@@ -1044,7 +1048,8 @@ by environment variables (`AI_KEY`, `AI_PROJECT`, `AI_LOCATION`,
10441048
precedence.
10451049

10461050
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.
10481053

10491054
The `cache` option enables local caching of the specified text's embedding in
10501055
`.journalism-cache` (from the `getEmbedding` function in the
@@ -1058,7 +1063,7 @@ up processing. If the index already exists, it will not be recreated.
10581063
##### Signature
10591064

10601065
```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>;
10621067
```
10631068

10641069
##### Parameters
@@ -1088,7 +1093,8 @@ async aiVectorSimilarity(text: string, column: string, nbResults: number, option
10881093
- **`options.location`**: - The Google Cloud location for Vertex AI. Defaults to
10891094
the `AI_LOCATION` environment variable.
10901095
- **`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.
10921098
- **`options.verbose`**: - If `true`, logs additional debugging information.
10931099
Defaults to `false`.
10941100

@@ -1140,7 +1146,8 @@ Ollama. Credentials and model selection are determined by environment variables
11401146
with `options` taking precedence.
11411147

11421148
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.
11441151

11451152
Temperature is set to 0 to aim for reproducible results. For future consistency,
11461153
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`.
11541161
##### Signature
11551162

11561163
```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>;
11581165
```
11591166

11601167
##### Parameters
@@ -1174,6 +1181,9 @@ async aiQuery(prompt: string, options?: { cache?: boolean; model?: string; apiKe
11741181
to the `AI_PROJECT` environment variable.
11751182
- **`options.location`**: - The Google Cloud location for Vertex AI. Defaults to
11761183
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.
11771187
- **`options.verbose`**: - If `true`, logs additional debugging information,
11781188
including the full prompt sent to the AI. Defaults to `false`.
11791189

@@ -5923,6 +5933,12 @@ await table.logTable({ conditions: `status === 'active'` });
59235933
Generates and logs a line chart to the console. The data should be sorted by the
59245934
x-axis values for accurate representation.
59255935

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+
59265942
##### Signature
59275943

59285944
```typescript
@@ -5931,13 +5947,17 @@ async logLineChart(x: string, y: string, options?: { formatX?: (d: unknown) => a
59315947

59325948
##### Parameters
59335949

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.
59365954
- **`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.
59415961
- **`options.smallMultiples`**: - The name of a column to create small multiples
59425962
(also known as facets or trellis charts). Each unique value in this column
59435963
will generate a separate chart.
@@ -5993,6 +6013,12 @@ await table.logLineChart("date", "value", {
59936013
Generates and logs a dot chart to the console. The data should be sorted by the
59946014
x-axis values for accurate representation.
59956015

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+
59966022
##### Signature
59976023

59986024
```typescript
@@ -6001,13 +6027,17 @@ async logDotChart(x: string, y: string, options?: { formatX?: (d: unknown) => an
60016027

60026028
##### Parameters
60036029

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.
60066034
- **`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.
60116041
- **`options.smallMultiples`**: - The name of a column to create small multiples
60126042
(also known as facets). Each unique value in this column will generate a
60136043
separate chart.

0 commit comments

Comments
 (0)