@agentsmarket/pipeline-runtime 0.1.0 → 0.1.1
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.
- package/dist/adapters/minimax.js +3 -2
- package/dist/adapters/openrouter.js +8 -1
- package/dist/stages.d.ts +7 -0
- package/dist/stages.js +7 -0
- package/dist/types.d.ts +17 -0
- package/package.json +1 -1
package/dist/adapters/minimax.js
CHANGED
|
@@ -37,13 +37,14 @@ export class MiniMaxProvider {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
async generateText(prompt, opts = {}) {
|
|
40
|
-
const model = opts.complexity === 'complex' ? this.complexModel : this.simpleModel;
|
|
40
|
+
const model = opts.model ?? (opts.complexity === 'complex' ? this.complexModel : this.simpleModel);
|
|
41
41
|
const response = await this.client.messages.create({
|
|
42
42
|
model,
|
|
43
43
|
max_tokens: opts.maxTokens ?? 2048,
|
|
44
44
|
temperature: opts.temperature ?? 0.7,
|
|
45
|
+
...(opts.topP !== undefined ? { top_p: opts.topP } : {}),
|
|
45
46
|
system: opts.system,
|
|
46
|
-
stop_sequences: opts.stopSequences,
|
|
47
|
+
...(opts.stopSequences ? { stop_sequences: opts.stopSequences } : {}),
|
|
47
48
|
messages: [{ role: 'user', content: prompt }],
|
|
48
49
|
});
|
|
49
50
|
const text = response.content
|
|
@@ -45,11 +45,18 @@ export class OpenRouterProvider {
|
|
|
45
45
|
model,
|
|
46
46
|
max_tokens: opts.maxTokens ?? 2048,
|
|
47
47
|
temperature: opts.temperature ?? 0.7,
|
|
48
|
+
...(opts.topP !== undefined ? { top_p: opts.topP } : {}),
|
|
49
|
+
...(opts.seed !== undefined ? { seed: opts.seed } : {}),
|
|
50
|
+
...(opts.reasoningEffort !== undefined ? { reasoning_effort: opts.reasoningEffort } : {}),
|
|
51
|
+
...(opts.responseFormat !== undefined
|
|
52
|
+
? { response_format: { type: opts.responseFormat } }
|
|
53
|
+
: {}),
|
|
48
54
|
messages: [
|
|
49
55
|
...(opts.system ? [{ role: 'system', content: opts.system }] : []),
|
|
50
56
|
{ role: 'user', content: prompt },
|
|
51
57
|
],
|
|
52
|
-
stop: opts.stopSequences,
|
|
58
|
+
...(opts.stopSequences ? { stop: opts.stopSequences } : {}),
|
|
59
|
+
...(opts.providerParams ?? {}),
|
|
53
60
|
});
|
|
54
61
|
const text = response.choices[0]?.message?.content ?? '';
|
|
55
62
|
const usage = {
|
package/dist/stages.d.ts
CHANGED
|
@@ -72,6 +72,13 @@ export interface StageExecutorDeps {
|
|
|
72
72
|
* R6.4+R6.6 will make the registry path the default.
|
|
73
73
|
*/
|
|
74
74
|
registry?: LLMProviderRegistry;
|
|
75
|
+
/**
|
|
76
|
+
* Optional. When true, the executor ignores per-stage `provider:`
|
|
77
|
+
* declarations and uses the top-level `provider` (typically the
|
|
78
|
+
* CLI MockProvider) for every LLM stage. Lets `--mock` work for
|
|
79
|
+
* pipelines that declare `provider: minimax` etc. (F12).
|
|
80
|
+
*/
|
|
81
|
+
forceMock?: boolean;
|
|
75
82
|
pricing: PricingResolver;
|
|
76
83
|
modelResolver: ModelResolver;
|
|
77
84
|
fetchSkill: (skillId: string) => Promise<SkillLike | null>;
|
package/dist/stages.js
CHANGED
|
@@ -185,6 +185,12 @@ export class StageBadConfigError extends Error {
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
function resolveStageProvider(deps, stage, model) {
|
|
188
|
+
// F12: --mock must override explicit per-stage `provider:` declarations,
|
|
189
|
+
// otherwise canonical seeded pipelines (which all declare
|
|
190
|
+
// `provider: minimax`) would hit the real API and 429 instead of the
|
|
191
|
+
// deterministic mock. forceMock wins over registry resolution.
|
|
192
|
+
if (deps.forceMock)
|
|
193
|
+
return deps.provider;
|
|
188
194
|
if (!stage.provider)
|
|
189
195
|
return deps.provider;
|
|
190
196
|
if (!deps.registry) {
|
|
@@ -396,6 +402,7 @@ export async function executeStage(stage, pipeline, ctx, deps) {
|
|
|
396
402
|
system: resolvedSystem,
|
|
397
403
|
complexity: stage.model?.includes('M3') || stage.model?.includes('opus') ? 'complex' : 'simple',
|
|
398
404
|
maxTokens: 4096,
|
|
405
|
+
fields: stage.fields,
|
|
399
406
|
}), stage.retry, retryCtx);
|
|
400
407
|
const result = ran.value;
|
|
401
408
|
const costMicroUsdc = await deps.pricing.resolveCostMicroUsdc(model, result.usage);
|
package/dist/types.d.ts
CHANGED
|
@@ -21,6 +21,23 @@ export interface GenerateOptions {
|
|
|
21
21
|
stopSequences?: string[];
|
|
22
22
|
/** Provider-specific model id (e.g. "anthropic/claude-3.5-sonnet" for OpenRouter). */
|
|
23
23
|
model?: string;
|
|
24
|
+
/** Nucleus sampling 0-1. Optional. Mutually exclusive with `temperature` per provider. */
|
|
25
|
+
topP?: number;
|
|
26
|
+
/** Seed for reproducibility. Supported by OpenRouter (OpenAI-style models). */
|
|
27
|
+
seed?: number;
|
|
28
|
+
/** Reasoning effort for reasoning models (o1, o3-mini, etc.). OpenRouter-only. */
|
|
29
|
+
reasoningEffort?: 'low' | 'medium' | 'high';
|
|
30
|
+
/** Response format constraint. 'json_object' forces valid JSON output. OpenRouter-only. */
|
|
31
|
+
responseFormat?: 'text' | 'json_object';
|
|
32
|
+
/** Provider-specific escape hatch. Spread into the provider request last. */
|
|
33
|
+
providerParams?: Record<string, unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* Required JSON keys when `output_format: structured_json`. Consumed by
|
|
36
|
+
* MockProvider to build a JSON-shaped response that satisfies
|
|
37
|
+
* validateOutputFormat without real LLM calls. Other providers ignore
|
|
38
|
+
* this — they emit JSON based on the real model's output.
|
|
39
|
+
*/
|
|
40
|
+
fields?: string[];
|
|
24
41
|
}
|
|
25
42
|
export interface TokenUsage {
|
|
26
43
|
inputTokens: number;
|
package/package.json
CHANGED