@almadar/llm 2.36.0 → 2.37.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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/contracts.ts +32 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/llm",
3
- "version": "2.36.0",
3
+ "version": "2.37.0",
4
4
  "description": "Multi-provider LLM client with rate limiting, token tracking, structured outputs, and continuation handling",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -46,10 +46,10 @@
46
46
  "@almadar/logger": "^1.10.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "@almadar/core": "^10.34.0"
49
+ "@almadar/core": "^10.35.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@almadar/core": "^10.34.0",
52
+ "@almadar/core": "^10.35.0",
53
53
  "@almadar/eslint-plugin": "^2.15.0",
54
54
  "@types/node": "^22.0.0",
55
55
  "@typescript-eslint/parser": "8.56.0",
package/src/contracts.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * @packageDocumentation
9
9
  */
10
10
 
11
- import type { ServiceContract, ServiceParams } from "@almadar/core";
11
+ import type { ServiceContract, ServiceParams, ServiceParamsValue } from "@almadar/core";
12
12
 
13
13
  /**
14
14
  * JSON Schema definition for structured extraction.
@@ -105,3 +105,34 @@ export type LLMServiceActions = {
105
105
  * that dispatches to the correct action handler.
106
106
  */
107
107
  export type LLMServiceContract = ServiceContract<LLMServiceActions>;
108
+
109
+ /**
110
+ * All call-service actions exposed by the ML service — model inference on a
111
+ * trained or off-the-shelf checkpoint. Reached via a deployed serving
112
+ * orbital (see `@almadar/integrations`' `ml` integration).
113
+ */
114
+ export type MLServiceActions = {
115
+ /** Run inference against a deployed model checkpoint. */
116
+ infer: {
117
+ params: {
118
+ /** `hf:<id>` for off-the-shelf weights, or a masar checkpoint id. */
119
+ model: string;
120
+ /** JSON-safe model input (tensor-shaped payload from `contract/entity-to-tensor`). */
121
+ input: ServiceParamsValue;
122
+ };
123
+ result: {
124
+ /** JSON-safe model output, before contract clamp/validation by the caller. */
125
+ output: ServiceParamsValue;
126
+ confidence: number;
127
+ /** Contract violations reported by the model service, if any (see `contract/violations`). */
128
+ violations: ServiceParamsValue[];
129
+ };
130
+ };
131
+ };
132
+
133
+ /**
134
+ * The full service contract for the ML service.
135
+ * Implementations must provide an `execute(action, params)` method
136
+ * that dispatches to the correct action handler.
137
+ */
138
+ export type MLServiceContract = ServiceContract<MLServiceActions>;