@axiom-lattice/protocols 4.10.0 → 4.11.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiom-lattice/protocols",
3
- "version": "4.10.0",
3
+ "version": "4.11.0",
4
4
  "description": "Unified protocol type definitions for Axiom Lattice framework",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -54,6 +54,13 @@ export interface OutboundStreamChunk {
54
54
  text: string;
55
55
  /** 是否结束(最后一次刷新必须为 `true`)。 */
56
56
  done: boolean;
57
+ /**
58
+ * 结束原因;仅对 `done: true` 有意义。未提供视为正常完成。
59
+ *
60
+ * 适配器可据此决定是否发送运行中途产生的附加内容(例如企业微信卡片):
61
+ * 失败/中断/超时的轮次不应把半成品当成正常结果展示。
62
+ */
63
+ reason?: "completed" | "failed" | "interrupted" | "timeout";
57
64
  }
58
65
 
59
66
  export interface DispatchResult {
@@ -34,6 +34,21 @@ export type ModelProviderApiStyle = "chat-completions" | "responses";
34
34
  */
35
35
  export type ModelProviderLlmProvider = LLMConfig["provider"];
36
36
 
37
+ /**
38
+ * What a model can do.
39
+ *
40
+ * Lives on the **model** row, not the provider: one provider is a set of
41
+ * credentials plus one base URL, and a single DashScope-compatible endpoint
42
+ * serves chat, embedding and speech at once. Putting this on the provider would
43
+ * force a tenant to create three providers pointing at the same address with
44
+ * the same secret.
45
+ *
46
+ * `"asr"` is speech-to-text; the runtime is the `stt` lattice, not
47
+ * `models`. The kinds are deliberately independent: each has its own lattice
48
+ * manager, its own loader guard, and its own client type.
49
+ */
50
+ export type ModelKind = "chat" | "embedding" | "asr";
51
+
37
52
  /**
38
53
  * Build the tenant-scoped model key.
39
54
  *
@@ -360,6 +375,14 @@ export interface ProviderModelInput extends DiscoveredModel {
360
375
  * or carry `modelKwargs` the server needs, without duplicating the provider.
361
376
  */
362
377
  extra?: Record<string, unknown>;
378
+ /**
379
+ * What this model does.
380
+ *
381
+ * Omitted means "keep the stored kind"; a brand-new row defaults to
382
+ * `"chat"`. Discovery cannot tell the kinds apart from `/v1/models`, so the
383
+ * admin sets it.
384
+ */
385
+ kind?: ModelKind;
363
386
  /**
364
387
  * Whether this is the tenant's default model.
365
388
  *
@@ -390,6 +413,12 @@ export interface ModelSelection {
390
413
  * lose the config it already had.
391
414
  */
392
415
  extra?: Record<string, unknown>;
416
+ /**
417
+ * What this model does.
418
+ *
419
+ * Omitted means "leave the stored kind alone", the same rule as `extra`.
420
+ */
421
+ kind?: ModelKind;
393
422
  /**
394
423
  * Whether this is the tenant's default model.
395
424
  *
@@ -424,6 +453,13 @@ export interface ModelProviderModelEntry {
424
453
  */
425
454
  modelId: string;
426
455
 
456
+ /**
457
+ * What this model does — chat, embedding or speech-to-text.
458
+ *
459
+ * Rows created before this column existed are all `"chat"`.
460
+ */
461
+ kind: ModelKind;
462
+
427
463
  /**
428
464
  * Optional human-readable name from the upstream
429
465
  */
@@ -576,6 +612,12 @@ export interface TenantModelPublicEntry {
576
612
  */
577
613
  modelKey: string;
578
614
 
615
+ /**
616
+ * What this model does. Pickers filter on it: a chat selector must not offer
617
+ * an embedding model, and the collection picker must not offer a chat model.
618
+ */
619
+ kind: ModelKind;
620
+
579
621
  /**
580
622
  * Optional human-readable name
581
623
  */
@@ -703,6 +745,21 @@ export interface ModelProviderProbeRequest {
703
745
  * Wire protocol to speak. Defaults to `openai-compatible`.
704
746
  */
705
747
  protocol?: ModelProviderWireProtocol;
748
+
749
+ /**
750
+ * What kind of model to probe.
751
+ *
752
+ * A model-list probe proves the address and the credential, not that a model
753
+ * can actually run. For embeddings the meaningful check is one inference
754
+ * request, which is why the caller names the model and the kind.
755
+ */
756
+ kind?: ModelKind;
757
+
758
+ /**
759
+ * Model id to probe. Required when `kind` is `"embedding"`: the probe sends
760
+ * one tiny input to that model and reports the resulting vector's dimension.
761
+ */
762
+ modelId?: string;
706
763
  }
707
764
 
708
765
  /**
@@ -736,6 +793,14 @@ export interface ModelProviderProbeResult {
736
793
  * errors rather than as an unreachable probe.
737
794
  */
738
795
  error?: ModelProviderUpstreamErrorCode;
796
+
797
+ /**
798
+ * Dimension of the vector an embedding probe got back.
799
+ *
800
+ * Absent for a model-list probe, and for an upstream that answered but
801
+ * returned no usable vector.
802
+ */
803
+ dimensions?: number;
739
804
  }
740
805
 
741
806
  /**
@@ -17,6 +17,15 @@ export interface VectorStoreCreateParams {
17
17
  tableName: string;
18
18
  /** Embedding model key to use for embedding operations */
19
19
  embeddingKey: string;
20
+ /**
21
+ * Tenant whose embedding model the key belongs to.
22
+ *
23
+ * Tenant model keys are `${providerId}/${modelId}` and resolve per tenant, so
24
+ * a provider cannot look one up without knowing whose it is. Omitted means the
25
+ * deployment namespace (`"default"`), which is where boot-time registrations
26
+ * live.
27
+ */
28
+ tenantId?: string;
20
29
  /** Provider-specific configuration */
21
30
  config?: Record<string, unknown>;
22
31
  }