parseforge 0.2.9__tar.gz → 0.2.12__tar.gz
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.
- {parseforge-0.2.9/parseforge.egg-info → parseforge-0.2.12}/PKG-INFO +65 -22
- {parseforge-0.2.9 → parseforge-0.2.12}/README.md +49 -21
- parseforge-0.2.12/parseforge/__init__.py +1 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/cli/config.py +50 -4
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/cli/main.py +302 -18
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/__init__.py +8 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/__init__.py +8 -0
- parseforge-0.2.12/parseforge/naming/providers/bedrock.py +176 -0
- parseforge-0.2.12/parseforge/naming/providers/gemini.py +160 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/models.yaml +51 -0
- parseforge-0.2.12/parseforge/naming/providers/oci.py +210 -0
- parseforge-0.2.12/parseforge/naming/providers/vertexai.py +191 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/pipeline.py +35 -1
- {parseforge-0.2.9 → parseforge-0.2.12/parseforge.egg-info}/PKG-INFO +65 -22
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge.egg-info/SOURCES.txt +4 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge.egg-info/requires.txt +19 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/pyproject.toml +26 -5
- parseforge-0.2.9/parseforge/__init__.py +0 -1
- {parseforge-0.2.9 → parseforge-0.2.12}/LICENSE +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/MANIFEST.in +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/SPEC.md +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/cli/__init__.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/drift.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/generation.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/integration.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/assemble.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/cache.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/llm.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/prompts.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/prompts.yaml +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/anthropic.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/azure.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/cerebras.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/cohere.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/cost.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/deepseek.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/errors.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/fireworks.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/groq.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/mistral.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/models.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/moonshot.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/openai.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/openrouter.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/perplexity.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/text.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/together.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/providers/xai.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/naming/resolver.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/paths.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/promotion.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/sampling/__init__.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/sampling/backends/__init__.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/sampling/backends/netmiko.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/sampling/core.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge/validation.py +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge.egg-info/dependency_links.txt +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge.egg-info/entry_points.txt +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/parseforge.egg-info/top_level.txt +0 -0
- {parseforge-0.2.9 → parseforge-0.2.12}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: parseforge
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.12
|
|
4
4
|
Summary: LLM-driven pipeline that forges, validates, and promotes TextFSM templates from network CLI output
|
|
5
5
|
Author-email: Tuyen Mathew Duong <tuyen@geekstrident.com>
|
|
6
6
|
Maintainer-email: Tuyen Mathew Duong <tuyen@geekstrident.com>
|
|
@@ -69,6 +69,18 @@ Requires-Dist: textfsm-ai[cohere]>=0.6.1; extra == "cohere"
|
|
|
69
69
|
Provides-Extra: azure
|
|
70
70
|
Requires-Dist: azure-ai-inference>=1.0.0b9; extra == "azure"
|
|
71
71
|
Requires-Dist: textfsm-ai[azure]>=0.6.1; extra == "azure"
|
|
72
|
+
Provides-Extra: gemini
|
|
73
|
+
Requires-Dist: google-genai>=0.2.0; extra == "gemini"
|
|
74
|
+
Requires-Dist: textfsm-ai[gemini]>=0.6.1; extra == "gemini"
|
|
75
|
+
Provides-Extra: vertexai
|
|
76
|
+
Requires-Dist: google-genai>=0.2.0; extra == "vertexai"
|
|
77
|
+
Requires-Dist: textfsm-ai[vertexai]>=0.6.1; extra == "vertexai"
|
|
78
|
+
Provides-Extra: bedrock
|
|
79
|
+
Requires-Dist: boto3==1.42.97; extra == "bedrock"
|
|
80
|
+
Requires-Dist: textfsm-ai[bedrock]>=0.6.1; extra == "bedrock"
|
|
81
|
+
Provides-Extra: oci
|
|
82
|
+
Requires-Dist: oci==2.182.0; extra == "oci"
|
|
83
|
+
Requires-Dist: textfsm-ai[oci]>=0.6.1; extra == "oci"
|
|
72
84
|
Provides-Extra: sampling
|
|
73
85
|
Requires-Dist: netmiko>=4.0; extra == "sampling"
|
|
74
86
|
Provides-Extra: dev
|
|
@@ -82,6 +94,9 @@ Requires-Dist: openai>=1.0.0; extra == "dev"
|
|
|
82
94
|
Requires-Dist: mistralai==1.10.0; extra == "dev"
|
|
83
95
|
Requires-Dist: cohere==5.21.1; extra == "dev"
|
|
84
96
|
Requires-Dist: azure-ai-inference>=1.0.0b9; extra == "dev"
|
|
97
|
+
Requires-Dist: google-genai>=0.2.0; extra == "dev"
|
|
98
|
+
Requires-Dist: boto3==1.42.97; extra == "dev"
|
|
99
|
+
Requires-Dist: oci==2.182.0; extra == "dev"
|
|
85
100
|
Provides-Extra: release
|
|
86
101
|
Requires-Dist: bump2version; extra == "release"
|
|
87
102
|
Requires-Dist: build; extra == "release"
|
|
@@ -124,11 +139,12 @@ command that's pure local processing (`canonical`/`readable`/`recognizers`,
|
|
|
124
139
|
LLM (`name`, `check --provider`, `run`, `generate-template`, `trial`) needs the
|
|
125
140
|
extra for whichever provider it uses: `anthropic`, `openai`, `deepseek`,
|
|
126
141
|
`groq`, `xai`, `together`, `fireworks`, `perplexity`, `openrouter`,
|
|
127
|
-
`moonshot`, `cerebras`, `mistral`, `cohere`,
|
|
128
|
-
to `anthropic` wherever it isn't
|
|
129
|
-
|
|
130
|
-
sampling
|
|
131
|
-
|
|
142
|
+
`moonshot`, `cerebras`, `mistral`, `cohere`, `azure`, `gemini`, `vertexai`,
|
|
143
|
+
`bedrock`, or `oci`. `--provider` defaults to `anthropic` wherever it isn't
|
|
144
|
+
required, so that's the one most setups need. `pip install
|
|
145
|
+
parseforge[sampling]` adds Netmiko for live device sampling; combine
|
|
146
|
+
extras as needed, e.g.
|
|
147
|
+
`pip install parseforge[anthropic,openai,deepseek,groq,xai,together,fireworks,perplexity,openrouter,moonshot,cerebras,mistral,cohere,azure,gemini,vertexai,bedrock,oci,sampling]`.
|
|
132
148
|
|
|
133
149
|
## Development
|
|
134
150
|
|
|
@@ -136,13 +152,14 @@ sampling; combine extras as needed, e.g.
|
|
|
136
152
|
pip install -e ".[dev,sampling]"
|
|
137
153
|
pytest
|
|
138
154
|
```
|
|
139
|
-
`dev` already includes the `anthropic`, `openai`, `mistralai`, `cohere`,
|
|
140
|
-
`azure-ai-inference` SDKs (tests exercise
|
|
141
|
-
`anthropic`, `openai`, `deepseek`, `groq`, `xai`,
|
|
142
|
-
`perplexity`, `openrouter`, `moonshot`, `cerebras`
|
|
143
|
-
packages,
|
|
144
|
-
|
|
145
|
-
|
|
155
|
+
`dev` already includes the `anthropic`, `openai`, `mistralai`, `cohere`,
|
|
156
|
+
`azure-ai-inference`, `google-genai`, `boto3`, and `oci` SDKs (tests exercise
|
|
157
|
+
all eighteen providers — `anthropic`, `openai`, `deepseek`, `groq`, `xai`,
|
|
158
|
+
`together`, `fireworks`, `perplexity`, `openrouter`, `moonshot`, `cerebras`
|
|
159
|
+
share just the first two packages, `mistral`/`cohere`/`azure`/`bedrock`/`oci`
|
|
160
|
+
each need their own SDK, and `gemini`/`vertexai` share `google-genai` — and
|
|
161
|
+
never silently skip) — add the specific `,<provider>` extra explicitly only
|
|
162
|
+
if installing outside of `dev`.
|
|
146
163
|
|
|
147
164
|
Linting/formatting/type-checking/docs run through tox instead of extras — see
|
|
148
165
|
`tox.ini` (`tox -e lint`/`format`/`typecheck`/`docs`), each installing its own
|
|
@@ -167,11 +184,23 @@ and `--api-key` falls back to that provider's own env var (`ANTHROPIC_API_KEY`/
|
|
|
167
184
|
`OPENAI_API_KEY`/`DEEPSEEK_API_KEY`/etc.). A cache hit (a command already seen
|
|
168
185
|
before) never touches the LLM, so no key is needed at all in that case.
|
|
169
186
|
|
|
170
|
-
`--provider azure
|
|
171
|
-
|
|
187
|
+
`--provider azure`/`--provider vertexai`/`--provider bedrock`/`--provider oci`
|
|
188
|
+
are the four exceptions to the usual `--api-key`/`--model` shape. Azure has
|
|
189
|
+
no fixed base_url or model catalog, so it also needs `--endpoint`
|
|
172
190
|
(`AZURE_ENDPOINT`), `--api-version` (`AZURE_API_VERSION`), and `--deployment`
|
|
173
|
-
(`AZURE_DEPLOYMENT`, replacing `--model`).
|
|
174
|
-
|
|
191
|
+
(`AZURE_DEPLOYMENT`, replacing `--model`). Vertex AI has no API key at all —
|
|
192
|
+
it authenticates via GCP's own Application Default Credentials — so
|
|
193
|
+
`--api-key`/`AZURE_API_KEY`-style env vars don't apply; it needs
|
|
194
|
+
`--gcp-project` (`VERTEXAI_PROJECT`) and `--gcp-location` (`VERTEXAI_REGION`)
|
|
195
|
+
instead. Bedrock likewise has no API key at all — it authenticates via AWS's
|
|
196
|
+
own credential chain — and just needs `--region` (`BEDROCK_REGION`, then
|
|
197
|
+
`BEDROCK_DEFAULT_REGION`). OCI also has no API key at all — it signs each
|
|
198
|
+
request cryptographically against local credentials in `~/.oci/config`
|
|
199
|
+
(DEFAULT profile) — and needs both `--region` (`OCI_REGION`, then whatever
|
|
200
|
+
region is already set in `~/.oci/config`) and `--compartment-id`
|
|
201
|
+
(`OCI_COMPARTMENT_ID`, the OCID of the compartment/tenancy to bill and scope
|
|
202
|
+
requests to). Same options exist on `check --provider`, `run`, and
|
|
203
|
+
`generate-template` below.
|
|
175
204
|
|
|
176
205
|
**`check`** — validate a connector or provider before spending time/tokens on a real
|
|
177
206
|
run. With neither `--env` nor explicit connection flags, prints what a connector needs
|
|
@@ -212,14 +241,21 @@ parseforge run --vendor cisco --family catalyst9200 --os ios-xe --version 17.9.1
|
|
|
212
241
|
--model claude-haiku-4-5-20251001 \
|
|
213
242
|
show clock
|
|
214
243
|
```
|
|
215
|
-
`--provider`/`--api-key`/`--model` are for generation
|
|
244
|
+
`--provider`/`--api-key`/`--model` are for generation (`--api-key` isn't
|
|
245
|
+
required for `--provider vertexai`/`--provider bedrock`/`--provider oci`).
|
|
246
|
+
Naming has its own separate
|
|
216
247
|
`--naming-provider`/`--naming-api-key`/`--naming-model`, defaulting independently
|
|
217
248
|
(`--naming-provider` defaults to `anthropic`; the other two fall back to that
|
|
218
249
|
provider's own env var/default model) — set them explicitly if naming needs a
|
|
219
250
|
different provider than generation. `--provider azure`/`--naming-provider azure`
|
|
220
251
|
each get their own `--endpoint`/`--api-version`/`--deployment` (generation) and
|
|
221
|
-
`--naming-endpoint`/`--naming-api-version`/`--naming-deployment` (naming)
|
|
222
|
-
|
|
252
|
+
`--naming-endpoint`/`--naming-api-version`/`--naming-deployment` (naming);
|
|
253
|
+
`--provider vertexai`/`--naming-provider vertexai` similarly get
|
|
254
|
+
`--gcp-project`/`--gcp-location` and `--naming-gcp-project`/
|
|
255
|
+
`--naming-gcp-location`; `--provider bedrock`/`--naming-provider bedrock` get
|
|
256
|
+
`--region` and `--naming-region`; `--provider oci`/`--naming-provider oci` get
|
|
257
|
+
`--region`/`--compartment-id` and `--naming-region`/`--naming-compartment-id`
|
|
258
|
+
— see the `name` section above for what they're for.
|
|
223
259
|
|
|
224
260
|
**`init-trial-config`** — write a placeholder `trial.yaml` to fill in, instead of
|
|
225
261
|
writing one by hand:
|
|
@@ -253,8 +289,15 @@ workers: 1
|
|
|
253
289
|
`provider`/`api_key`/`model` are one shared LLM source used for both naming and
|
|
254
290
|
generation. Use the `run` command's separate `--naming-*`/`--generation-*` flags
|
|
255
291
|
instead if a trial actually needs two different providers. For `provider: azure`,
|
|
256
|
-
also set `endpoint`/`api_version`/`deployment` (`deployment` replaces `model`)
|
|
257
|
-
|
|
292
|
+
also set `endpoint`/`api_version`/`deployment` (`deployment` replaces `model`).
|
|
293
|
+
For `provider: vertexai`, set `project`/`location` instead — `api_key` can be
|
|
294
|
+
omitted entirely (Vertex AI authenticates via GCP's own Application Default
|
|
295
|
+
Credentials). For `provider: bedrock`, set `region` instead — `api_key` can
|
|
296
|
+
likewise be omitted entirely (Bedrock authenticates via AWS's own credential
|
|
297
|
+
chain). For `provider: oci`, set `region`/`compartment_id` instead —
|
|
298
|
+
`api_key` can likewise be omitted entirely (OCI authenticates via local
|
|
299
|
+
request-signing credentials in `~/.oci/config`). See
|
|
300
|
+
`parseforge init-trial-config`'s generated placeholder for the exact keys.
|
|
258
301
|
|
|
259
302
|
**`integration`** — rebuild `integration/` for every case under `trials/` (SPEC §5
|
|
260
303
|
step 8):
|
|
@@ -35,11 +35,12 @@ command that's pure local processing (`canonical`/`readable`/`recognizers`,
|
|
|
35
35
|
LLM (`name`, `check --provider`, `run`, `generate-template`, `trial`) needs the
|
|
36
36
|
extra for whichever provider it uses: `anthropic`, `openai`, `deepseek`,
|
|
37
37
|
`groq`, `xai`, `together`, `fireworks`, `perplexity`, `openrouter`,
|
|
38
|
-
`moonshot`, `cerebras`, `mistral`, `cohere`,
|
|
39
|
-
to `anthropic` wherever it isn't
|
|
40
|
-
|
|
41
|
-
sampling
|
|
42
|
-
|
|
38
|
+
`moonshot`, `cerebras`, `mistral`, `cohere`, `azure`, `gemini`, `vertexai`,
|
|
39
|
+
`bedrock`, or `oci`. `--provider` defaults to `anthropic` wherever it isn't
|
|
40
|
+
required, so that's the one most setups need. `pip install
|
|
41
|
+
parseforge[sampling]` adds Netmiko for live device sampling; combine
|
|
42
|
+
extras as needed, e.g.
|
|
43
|
+
`pip install parseforge[anthropic,openai,deepseek,groq,xai,together,fireworks,perplexity,openrouter,moonshot,cerebras,mistral,cohere,azure,gemini,vertexai,bedrock,oci,sampling]`.
|
|
43
44
|
|
|
44
45
|
## Development
|
|
45
46
|
|
|
@@ -47,13 +48,14 @@ sampling; combine extras as needed, e.g.
|
|
|
47
48
|
pip install -e ".[dev,sampling]"
|
|
48
49
|
pytest
|
|
49
50
|
```
|
|
50
|
-
`dev` already includes the `anthropic`, `openai`, `mistralai`, `cohere`,
|
|
51
|
-
`azure-ai-inference` SDKs (tests exercise
|
|
52
|
-
`anthropic`, `openai`, `deepseek`, `groq`, `xai`,
|
|
53
|
-
`perplexity`, `openrouter`, `moonshot`, `cerebras`
|
|
54
|
-
packages,
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
`dev` already includes the `anthropic`, `openai`, `mistralai`, `cohere`,
|
|
52
|
+
`azure-ai-inference`, `google-genai`, `boto3`, and `oci` SDKs (tests exercise
|
|
53
|
+
all eighteen providers — `anthropic`, `openai`, `deepseek`, `groq`, `xai`,
|
|
54
|
+
`together`, `fireworks`, `perplexity`, `openrouter`, `moonshot`, `cerebras`
|
|
55
|
+
share just the first two packages, `mistral`/`cohere`/`azure`/`bedrock`/`oci`
|
|
56
|
+
each need their own SDK, and `gemini`/`vertexai` share `google-genai` — and
|
|
57
|
+
never silently skip) — add the specific `,<provider>` extra explicitly only
|
|
58
|
+
if installing outside of `dev`.
|
|
57
59
|
|
|
58
60
|
Linting/formatting/type-checking/docs run through tox instead of extras — see
|
|
59
61
|
`tox.ini` (`tox -e lint`/`format`/`typecheck`/`docs`), each installing its own
|
|
@@ -78,11 +80,23 @@ and `--api-key` falls back to that provider's own env var (`ANTHROPIC_API_KEY`/
|
|
|
78
80
|
`OPENAI_API_KEY`/`DEEPSEEK_API_KEY`/etc.). A cache hit (a command already seen
|
|
79
81
|
before) never touches the LLM, so no key is needed at all in that case.
|
|
80
82
|
|
|
81
|
-
`--provider azure
|
|
82
|
-
|
|
83
|
+
`--provider azure`/`--provider vertexai`/`--provider bedrock`/`--provider oci`
|
|
84
|
+
are the four exceptions to the usual `--api-key`/`--model` shape. Azure has
|
|
85
|
+
no fixed base_url or model catalog, so it also needs `--endpoint`
|
|
83
86
|
(`AZURE_ENDPOINT`), `--api-version` (`AZURE_API_VERSION`), and `--deployment`
|
|
84
|
-
(`AZURE_DEPLOYMENT`, replacing `--model`).
|
|
85
|
-
|
|
87
|
+
(`AZURE_DEPLOYMENT`, replacing `--model`). Vertex AI has no API key at all —
|
|
88
|
+
it authenticates via GCP's own Application Default Credentials — so
|
|
89
|
+
`--api-key`/`AZURE_API_KEY`-style env vars don't apply; it needs
|
|
90
|
+
`--gcp-project` (`VERTEXAI_PROJECT`) and `--gcp-location` (`VERTEXAI_REGION`)
|
|
91
|
+
instead. Bedrock likewise has no API key at all — it authenticates via AWS's
|
|
92
|
+
own credential chain — and just needs `--region` (`BEDROCK_REGION`, then
|
|
93
|
+
`BEDROCK_DEFAULT_REGION`). OCI also has no API key at all — it signs each
|
|
94
|
+
request cryptographically against local credentials in `~/.oci/config`
|
|
95
|
+
(DEFAULT profile) — and needs both `--region` (`OCI_REGION`, then whatever
|
|
96
|
+
region is already set in `~/.oci/config`) and `--compartment-id`
|
|
97
|
+
(`OCI_COMPARTMENT_ID`, the OCID of the compartment/tenancy to bill and scope
|
|
98
|
+
requests to). Same options exist on `check --provider`, `run`, and
|
|
99
|
+
`generate-template` below.
|
|
86
100
|
|
|
87
101
|
**`check`** — validate a connector or provider before spending time/tokens on a real
|
|
88
102
|
run. With neither `--env` nor explicit connection flags, prints what a connector needs
|
|
@@ -123,14 +137,21 @@ parseforge run --vendor cisco --family catalyst9200 --os ios-xe --version 17.9.1
|
|
|
123
137
|
--model claude-haiku-4-5-20251001 \
|
|
124
138
|
show clock
|
|
125
139
|
```
|
|
126
|
-
`--provider`/`--api-key`/`--model` are for generation
|
|
140
|
+
`--provider`/`--api-key`/`--model` are for generation (`--api-key` isn't
|
|
141
|
+
required for `--provider vertexai`/`--provider bedrock`/`--provider oci`).
|
|
142
|
+
Naming has its own separate
|
|
127
143
|
`--naming-provider`/`--naming-api-key`/`--naming-model`, defaulting independently
|
|
128
144
|
(`--naming-provider` defaults to `anthropic`; the other two fall back to that
|
|
129
145
|
provider's own env var/default model) — set them explicitly if naming needs a
|
|
130
146
|
different provider than generation. `--provider azure`/`--naming-provider azure`
|
|
131
147
|
each get their own `--endpoint`/`--api-version`/`--deployment` (generation) and
|
|
132
|
-
`--naming-endpoint`/`--naming-api-version`/`--naming-deployment` (naming)
|
|
133
|
-
|
|
148
|
+
`--naming-endpoint`/`--naming-api-version`/`--naming-deployment` (naming);
|
|
149
|
+
`--provider vertexai`/`--naming-provider vertexai` similarly get
|
|
150
|
+
`--gcp-project`/`--gcp-location` and `--naming-gcp-project`/
|
|
151
|
+
`--naming-gcp-location`; `--provider bedrock`/`--naming-provider bedrock` get
|
|
152
|
+
`--region` and `--naming-region`; `--provider oci`/`--naming-provider oci` get
|
|
153
|
+
`--region`/`--compartment-id` and `--naming-region`/`--naming-compartment-id`
|
|
154
|
+
— see the `name` section above for what they're for.
|
|
134
155
|
|
|
135
156
|
**`init-trial-config`** — write a placeholder `trial.yaml` to fill in, instead of
|
|
136
157
|
writing one by hand:
|
|
@@ -164,8 +185,15 @@ workers: 1
|
|
|
164
185
|
`provider`/`api_key`/`model` are one shared LLM source used for both naming and
|
|
165
186
|
generation. Use the `run` command's separate `--naming-*`/`--generation-*` flags
|
|
166
187
|
instead if a trial actually needs two different providers. For `provider: azure`,
|
|
167
|
-
also set `endpoint`/`api_version`/`deployment` (`deployment` replaces `model`)
|
|
168
|
-
|
|
188
|
+
also set `endpoint`/`api_version`/`deployment` (`deployment` replaces `model`).
|
|
189
|
+
For `provider: vertexai`, set `project`/`location` instead — `api_key` can be
|
|
190
|
+
omitted entirely (Vertex AI authenticates via GCP's own Application Default
|
|
191
|
+
Credentials). For `provider: bedrock`, set `region` instead — `api_key` can
|
|
192
|
+
likewise be omitted entirely (Bedrock authenticates via AWS's own credential
|
|
193
|
+
chain). For `provider: oci`, set `region`/`compartment_id` instead —
|
|
194
|
+
`api_key` can likewise be omitted entirely (OCI authenticates via local
|
|
195
|
+
request-signing credentials in `~/.oci/config`). See
|
|
196
|
+
`parseforge init-trial-config`'s generated placeholder for the exact keys.
|
|
169
197
|
|
|
170
198
|
**`integration`** — rebuild `integration/` for every case under `trials/` (SPEC §5
|
|
171
199
|
step 8):
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.12"
|
|
@@ -15,6 +15,16 @@ from typing import Any
|
|
|
15
15
|
import click
|
|
16
16
|
import yaml
|
|
17
17
|
|
|
18
|
+
# Providers that don't take an API key at all — Vertex AI relies on GCP's
|
|
19
|
+
# Application Default Credentials, Bedrock on AWS's own credential chain,
|
|
20
|
+
# and OCI on locally-configured request-signing credentials (see
|
|
21
|
+
# naming/providers/vertexai.py, naming/providers/bedrock.py, and
|
|
22
|
+
# naming/providers/oci.py). api_key is required for every other
|
|
23
|
+
# provider, but never for these; kept as a small named set (rather than
|
|
24
|
+
# scattered `provider not in (...)` checks) so a future provider with
|
|
25
|
+
# the same trait is a one-line addition.
|
|
26
|
+
NO_API_KEY_PROVIDERS = frozenset({"vertexai", "bedrock", "oci"})
|
|
27
|
+
|
|
18
28
|
|
|
19
29
|
@dataclass(frozen=True)
|
|
20
30
|
class TrialConfig:
|
|
@@ -33,10 +43,13 @@ class TrialConfig:
|
|
|
33
43
|
password: str
|
|
34
44
|
device_type: str
|
|
35
45
|
provider: str
|
|
36
|
-
api_key: str
|
|
37
46
|
model: str
|
|
38
47
|
commands: list[str]
|
|
39
48
|
user: str
|
|
49
|
+
# Required unless provider is in NO_API_KEY_PROVIDERS — see
|
|
50
|
+
# load_trial_config()'s explicit check; not in the dataclass's
|
|
51
|
+
# required-field position since it's conditionally optional.
|
|
52
|
+
api_key: str | None = None
|
|
40
53
|
email: str | None = None
|
|
41
54
|
description: str | None = None
|
|
42
55
|
note: str | None = None
|
|
@@ -50,6 +63,21 @@ class TrialConfig:
|
|
|
50
63
|
endpoint: str | None = None
|
|
51
64
|
api_version: str | None = None
|
|
52
65
|
deployment: str | None = None
|
|
66
|
+
# Only meaningful for provider: vertexai — see
|
|
67
|
+
# naming/providers/vertexai.py. Falls back to VERTEXAI_PROJECT/
|
|
68
|
+
# VERTEXAI_REGION if omitted, same as api_key falls back to a
|
|
69
|
+
# provider's own env var.
|
|
70
|
+
project: str | None = None
|
|
71
|
+
location: str | None = None
|
|
72
|
+
# Only meaningful for provider: bedrock — see
|
|
73
|
+
# naming/providers/bedrock.py. Falls back to BEDROCK_REGION, then
|
|
74
|
+
# BEDROCK_DEFAULT_REGION, if omitted.
|
|
75
|
+
region: str | None = None
|
|
76
|
+
# Only meaningful for provider: oci — see naming/providers/oci.py.
|
|
77
|
+
# compartment_id falls back to OCI_COMPARTMENT_ID if omitted; region
|
|
78
|
+
# (shared with the bedrock field above) falls back to OCI_REGION,
|
|
79
|
+
# then whatever region is already set in ~/.oci/config.
|
|
80
|
+
compartment_id: str | None = None
|
|
53
81
|
|
|
54
82
|
|
|
55
83
|
@dataclass(frozen=True)
|
|
@@ -69,6 +97,13 @@ class GenerationRequestConfig:
|
|
|
69
97
|
endpoint: str | None = None
|
|
70
98
|
api_version: str | None = None
|
|
71
99
|
deployment: str | None = None
|
|
100
|
+
# Only meaningful for provider: vertexai — see TrialConfig above.
|
|
101
|
+
project: str | None = None
|
|
102
|
+
location: str | None = None
|
|
103
|
+
# Only meaningful for provider: bedrock — see TrialConfig above.
|
|
104
|
+
region: str | None = None
|
|
105
|
+
# Only meaningful for provider: oci — see TrialConfig above.
|
|
106
|
+
compartment_id: str | None = None
|
|
72
107
|
|
|
73
108
|
|
|
74
109
|
_TRIAL_REQUIRED = (
|
|
@@ -82,7 +117,6 @@ _TRIAL_REQUIRED = (
|
|
|
82
117
|
"password",
|
|
83
118
|
"device_type",
|
|
84
119
|
"provider",
|
|
85
|
-
"api_key",
|
|
86
120
|
"model",
|
|
87
121
|
"commands",
|
|
88
122
|
"user",
|
|
@@ -112,6 +146,10 @@ def load_trial_config(path: Path) -> TrialConfig:
|
|
|
112
146
|
raw = _load_yaml_mapping(path)
|
|
113
147
|
_require_keys(raw, _TRIAL_REQUIRED, path)
|
|
114
148
|
|
|
149
|
+
provider = raw["provider"]
|
|
150
|
+
if provider not in NO_API_KEY_PROVIDERS and not raw.get("api_key"):
|
|
151
|
+
raise click.ClickException(f"{path}: missing required config key(s): api_key")
|
|
152
|
+
|
|
115
153
|
commands = raw["commands"]
|
|
116
154
|
if not isinstance(commands, list) or not all(isinstance(c, str) for c in commands):
|
|
117
155
|
raise click.ClickException(f"{path}: 'commands' must be a list of strings")
|
|
@@ -126,8 +164,8 @@ def load_trial_config(path: Path) -> TrialConfig:
|
|
|
126
164
|
username=raw["username"],
|
|
127
165
|
password=raw["password"],
|
|
128
166
|
device_type=raw["device_type"],
|
|
129
|
-
provider=
|
|
130
|
-
api_key=raw
|
|
167
|
+
provider=provider,
|
|
168
|
+
api_key=raw.get("api_key"),
|
|
131
169
|
model=raw["model"],
|
|
132
170
|
commands=commands,
|
|
133
171
|
user=raw["user"],
|
|
@@ -139,6 +177,10 @@ def load_trial_config(path: Path) -> TrialConfig:
|
|
|
139
177
|
endpoint=raw.get("endpoint"),
|
|
140
178
|
api_version=raw.get("api_version"),
|
|
141
179
|
deployment=raw.get("deployment"),
|
|
180
|
+
project=raw.get("project"),
|
|
181
|
+
location=raw.get("location"),
|
|
182
|
+
region=raw.get("region"),
|
|
183
|
+
compartment_id=raw.get("compartment_id"),
|
|
142
184
|
)
|
|
143
185
|
|
|
144
186
|
|
|
@@ -161,4 +203,8 @@ def load_generation_config(path: Path) -> GenerationRequestConfig:
|
|
|
161
203
|
endpoint=raw.get("endpoint"),
|
|
162
204
|
api_version=raw.get("api_version"),
|
|
163
205
|
deployment=raw.get("deployment"),
|
|
206
|
+
project=raw.get("project"),
|
|
207
|
+
location=raw.get("location"),
|
|
208
|
+
region=raw.get("region"),
|
|
209
|
+
compartment_id=raw.get("compartment_id"),
|
|
164
210
|
)
|