@anysiteio/agent-skills 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,274 @@
1
+ # LLM Analysis Reference
2
+
3
+ ## Setup
4
+
5
+ ```bash
6
+ anysite llm setup
7
+ ```
8
+
9
+ Interactive configuration: selects provider (`openai` or `anthropic`), API key environment variable, default model, and optionally tests the connection. Writes to `~/.anysite/config.yaml` under the `llm:` key.
10
+
11
+ ### Configuration Format
12
+
13
+ ```yaml
14
+ llm:
15
+ default_provider: openai
16
+ providers:
17
+ openai:
18
+ provider: openai
19
+ api_key_env: OPENAI_API_KEY
20
+ default_model: gpt-4.1-mini
21
+ anthropic:
22
+ provider: anthropic
23
+ api_key_env: ANTHROPIC_API_KEY
24
+ default_model: claude-sonnet-4-5-20250514
25
+ cache_enabled: true
26
+ default_temperature: 0.0
27
+ default_max_tokens: 4096
28
+ rate_limit: "50/m"
29
+ ```
30
+
31
+ ### Provider Support
32
+
33
+ | Provider | SDK | Structured Output | Default Model |
34
+ |----------|-----|-------------------|---------------|
35
+ | OpenAI | `openai` (AsyncOpenAI) | JSON Schema via `response_format` | `gpt-4.1-mini` |
36
+ | Anthropic | `anthropic` (AsyncAnthropic) | System-prompt with JSON schema instruction | `claude-sonnet-4-5-20250514` |
37
+
38
+ ## Commands
39
+
40
+ ### `anysite llm summarize`
41
+
42
+ Summarize each record in a dataset source.
43
+
44
+ ```bash
45
+ anysite llm summarize <dataset.yaml> --source <source_id> [OPTIONS]
46
+ ```
47
+
48
+ | Option | Description |
49
+ |--------|-------------|
50
+ | `--source, -s` | Source to summarize (required) |
51
+ | `--max-length` | Max words in summary (default: 100) |
52
+ | `--output-column` | Column name for summary (default: `summary`) |
53
+ | `--prompt` | Custom prompt override |
54
+ | `--prompt-file` | Read prompt from file |
55
+ | `--dry-run` | Show prompt without calling LLM |
56
+
57
+ ### `anysite llm classify`
58
+
59
+ Classify records into categories.
60
+
61
+ ```bash
62
+ anysite llm classify <dataset.yaml> --source <source_id> [OPTIONS]
63
+ ```
64
+
65
+ | Option | Description |
66
+ |--------|-------------|
67
+ | `--source, -s` | Source to classify (required) |
68
+ | `--categories, -c` | Comma-separated categories (auto-detects if omitted) |
69
+ | `--multi` | Allow multiple categories per record |
70
+ | `--output-column` | Column name for category (default: `category`) |
71
+ | `--prompt` | Custom prompt override |
72
+ | `--prompt-file` | Read prompt from file |
73
+ | `--dry-run` | Show prompt without calling LLM |
74
+
75
+ When `--categories` is omitted, the classifier auto-detects 3-7 categories from the first 20 records.
76
+
77
+ ### `anysite llm enrich`
78
+
79
+ Enrich records with LLM-extracted attributes.
80
+
81
+ ```bash
82
+ anysite llm enrich <dataset.yaml> --source <source_id> --add <spec> [OPTIONS]
83
+ ```
84
+
85
+ | Option | Description |
86
+ |--------|-------------|
87
+ | `--source, -s` | Source to enrich (required) |
88
+ | `--add` | Field spec: `name:type_or_values` (repeatable, at least one required) |
89
+ | `--prompt` | Custom prompt override |
90
+ | `--prompt-file` | Read prompt from file |
91
+ | `--dry-run` | Show prompt without calling LLM |
92
+
93
+ **Field spec formats:**
94
+
95
+ | Format | Example | Description |
96
+ |--------|---------|-------------|
97
+ | Enum | `sentiment:positive/negative/neutral` | Constrained to listed values |
98
+ | Type | `language:string` | Free-form string |
99
+ | Range | `quality_score:1-10` | Integer value |
100
+ | Boolean | `is_technical:boolean` | True/false |
101
+ | Number | `relevance:number` | Floating point |
102
+
103
+ ### `anysite llm generate`
104
+
105
+ Generate text for each record using a custom prompt.
106
+
107
+ ```bash
108
+ anysite llm generate <dataset.yaml> --source <source_id> --prompt <template> [OPTIONS]
109
+ ```
110
+
111
+ | Option | Description |
112
+ |--------|-------------|
113
+ | `--source, -s` | Source to process (required) |
114
+ | `--prompt` | Prompt with `{field}` placeholders (required unless `--prompt-file`) |
115
+ | `--prompt-file` | Read prompt from file |
116
+ | `--output-column` | Column name for generated text (default: `text`) |
117
+ | `--dry-run` | Show prompt without calling LLM |
118
+
119
+ The prompt template supports `{field_name}` placeholders that are replaced with record values. Example: `"Write a bio for {name} who works as {headline}"`.
120
+
121
+ Default temperature is 0.7 (higher than other commands).
122
+
123
+ ### `anysite llm match`
124
+
125
+ Match records between two dataset sources.
126
+
127
+ ```bash
128
+ anysite llm match <dataset.yaml> --source-a <id> --source-b <id> [OPTIONS]
129
+ ```
130
+
131
+ | Option | Description |
132
+ |--------|-------------|
133
+ | `--source-a` | First source (required) |
134
+ | `--source-b` | Second source (required) |
135
+ | `--fields-a` | Fields from source A to include |
136
+ | `--fields-b` | Fields from source B to include |
137
+ | `--top-k` | Max matches per source-a record (default: 3) |
138
+ | `--threshold` | Min match score 0.0-1.0 (default: 0.5) |
139
+ | `--prompt` | Custom prompt override |
140
+ | `--prompt-file` | Read prompt from file |
141
+ | `--dry-run` | Show prompt without calling LLM |
142
+
143
+ Processes each source-a record against batches of 10 source-b records. Returns matches with score and reason.
144
+
145
+ ### `anysite llm deduplicate`
146
+
147
+ Find semantic duplicates in a dataset source.
148
+
149
+ ```bash
150
+ anysite llm deduplicate <dataset.yaml> --source <source_id> [OPTIONS]
151
+ ```
152
+
153
+ | Option | Description |
154
+ |--------|-------------|
155
+ | `--source, -s` | Source to deduplicate (required) |
156
+ | `--key, -k` | Field for blocking (grouping similar records) (default: `name`) |
157
+ | `--threshold` | Min confidence for duplicate (default: 0.8) |
158
+ | `--prompt` | Custom prompt override |
159
+ | `--prompt-file` | Read prompt from file |
160
+ | `--dry-run` | Show prompt without calling LLM |
161
+
162
+ Uses a blocking pass (first 3 chars of key field) to group candidate duplicates before LLM evaluation.
163
+
164
+ ### `anysite llm cache-stats`
165
+
166
+ Show LLM cache statistics (entry count, total input/output tokens).
167
+
168
+ ```bash
169
+ anysite llm cache-stats
170
+ anysite llm cache-stats --json # Machine-readable JSON output
171
+ ```
172
+
173
+ ### `anysite llm cache-clear`
174
+
175
+ Clear all cached LLM responses.
176
+
177
+ ```bash
178
+ anysite llm cache-clear
179
+ anysite llm cache-clear --json # Machine-readable JSON output
180
+ ```
181
+
182
+ ## Common Options
183
+
184
+ These options are shared across `summarize`, `classify`, `enrich`, `generate`, `match`, and `deduplicate`:
185
+
186
+ | Option | Description | Default |
187
+ |--------|-------------|---------|
188
+ | `--provider` | LLM provider name | From config |
189
+ | `--model` | Model ID override | From config |
190
+ | `--parallel, -j` | Concurrent LLM calls | 5 |
191
+ | `--rate-limit` | Rate limit (e.g., `"50/m"`, `"10/s"`) | From config |
192
+ | `--temperature` | LLM temperature | 0.0 (0.7 for generate) |
193
+ | `--max-tokens` | Max response tokens | 4096 |
194
+ | `--no-cache` | Skip cache lookup | false |
195
+ | `--format, -f` | Output format: json/jsonl/csv/table | json |
196
+ | `--output, -o` | Write results to file | stdout |
197
+ | `--fields` | Record fields to include in LLM prompt | All fields |
198
+ | `--quiet, -q` | Suppress progress/stats output | false |
199
+ | `--dry-run` | Show prompt without calling LLM | false |
200
+ | `--prompt` | Custom prompt template | Built-in |
201
+ | `--prompt-file` | Read prompt from file | - |
202
+
203
+ ## Prompt System
204
+
205
+ ### Built-in Prompts
206
+
207
+ | Key | Used by | Description |
208
+ |-----|---------|-------------|
209
+ | `summarize` | `summarize` | Summarize record in N words |
210
+ | `classify` | `classify` | Classify records into categories |
211
+ | `classify_auto_detect` | `classify` (no categories) | Auto-detect categories from sample |
212
+ | `match` | `match` | Rank candidates by relevance |
213
+ | `deduplicate` | `deduplicate` | Identify semantic duplicates |
214
+ | `enrich` | `enrich` | Extract specified attributes |
215
+
216
+ ### Custom Prompts
217
+
218
+ Use `--prompt` for inline templates or `--prompt-file` to read from a file.
219
+
220
+ Template variables:
221
+ - `{record}` — formatted record (all non-underscore fields)
222
+ - `{records}` — formatted batch of records with indices
223
+ - `{field_name}` — individual record field value
224
+ - Command-specific variables: `{max_length}`, `{categories}`, `{field_descriptions}`, `{source_a_name}`, `{source_b_name}`, etc.
225
+
226
+ ### Field Filtering
227
+
228
+ `--fields "name,headline,location"` restricts which record fields are sent to the LLM. Supports dot-notation for nested fields (e.g., `urn.value`).
229
+
230
+ ## Cache System
231
+
232
+ SQLite database at `~/.anysite/llm_cache.db` with WAL mode. Cache keys are SHA256 hashes of `{provider}:{system_prompt+user_prompt}:{input_data}`.
233
+
234
+ Disable per-command with `--no-cache`. Disable globally by setting `cache_enabled: false` in config.
235
+
236
+ ## Examples
237
+
238
+ ```bash
239
+ # Classify LinkedIn posts by sentiment
240
+ anysite llm classify dataset.yaml --source posts \
241
+ --categories "positive,negative,neutral" \
242
+ --fields "text,title" --format table --output sentiment.csv
243
+
244
+ # Summarize company profiles
245
+ anysite llm summarize dataset.yaml --source companies \
246
+ --fields "name,description,industry" --max-length 50 --format table
247
+
248
+ # Enrich profiles with multiple attributes
249
+ anysite llm enrich dataset.yaml --source profiles \
250
+ --add "seniority:junior/mid/senior/executive" \
251
+ --add "department:string" \
252
+ --add "is_technical:boolean" \
253
+ --format csv --output enriched.csv
254
+
255
+ # Generate personalized messages
256
+ anysite llm generate dataset.yaml --source profiles \
257
+ --prompt "Write a cold outreach message for {name}, {headline} at {company}" \
258
+ --temperature 0.7 --model gpt-4.1
259
+
260
+ # Match people to companies
261
+ anysite llm match dataset.yaml --source-a profiles --source-b companies \
262
+ --fields-a "name,headline,skills" --fields-b "name,industry,description" \
263
+ --top-k 3 --threshold 0.6
264
+
265
+ # Find duplicate profiles
266
+ anysite llm deduplicate dataset.yaml --source profiles \
267
+ --key name --threshold 0.8 --fields "name,headline,location"
268
+
269
+ # Preview prompt without calling LLM
270
+ anysite llm classify dataset.yaml --source posts --dry-run
271
+
272
+ # Use a custom prompt from file
273
+ anysite llm generate dataset.yaml --source profiles --prompt-file my_prompt.txt
274
+ ```