@mate-academy/llm-gateway 7.9.0 → 7.10.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/dist/LLMGateway.d.ts +2 -2
- package/dist/LLMGateway.js.map +1 -1
- package/dist/LLMGateway.typedefs.d.ts +2 -2
- package/dist/utilities/llmTracing/llmTracing.constants.d.ts +5 -4
- package/dist/utilities/llmTracing/llmTracing.constants.js +6 -5
- package/dist/utilities/llmTracing/llmTracing.constants.js.map +1 -1
- package/dist/utilities/llmTracing/llmTracing.typedefs.d.ts +6 -6
- package/dist/utilities/llmTracing/noopLLMTracing.d.ts +2 -2
- package/dist/utilities/llmTracing/noopLLMTracing.js.map +1 -1
- package/package.json +1 -1
package/dist/LLMGateway.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type LLMProviders, type LLMPurposes, type LLMServiceByPurpose, type LLMServiceOptions } from './LLMService.typedefs';
|
|
2
2
|
import { type LLMGatewayOptions } from './LLMGateway.typedefs';
|
|
3
3
|
import { type LLMReporterInterface } from './utilities/reporter';
|
|
4
|
-
import { type
|
|
4
|
+
import { type LLMFallbackMetricDimensions, type LLMGatewayTracer, type LLMTraceContext } from './utilities/llmTracing';
|
|
5
5
|
/**
|
|
6
6
|
* An explicitly constructed gateway: every service it hands out is wired to the
|
|
7
7
|
* tracer this instance was built with. `LLMServiceFactory` stays available for
|
|
@@ -25,6 +25,6 @@ export declare class LLMGateway {
|
|
|
25
25
|
* long-running API calls it from its shutdown hook only.
|
|
26
26
|
*/
|
|
27
27
|
flush(): Promise<void>;
|
|
28
|
-
emitFallbackServed(dimensions:
|
|
28
|
+
emitFallbackServed(dimensions: LLMFallbackMetricDimensions): void;
|
|
29
29
|
private traced;
|
|
30
30
|
}
|
package/dist/LLMGateway.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LLMGateway.js","sourceRoot":"","sources":["../src/LLMGateway.ts"],"names":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GG;IACH,KAAK;QACH,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC;IAED,kBAAkB,CAAC,UAAuC;QACxD,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAEO,MAAM,CAAmC,OAAgB;QAC/D,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEhC,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA/ED,gCA+EC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type LLMFallbackMetricEmitter, type LLMGatewayTracer } from './utilities/llmTracing';
|
|
2
2
|
export interface LLMGatewayOptions {
|
|
3
3
|
tracer?: LLMGatewayTracer;
|
|
4
|
-
fallbackMetricEmitter?:
|
|
4
|
+
fallbackMetricEmitter?: LLMFallbackMetricEmitter;
|
|
5
5
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CloudWatch namespace + metric name for the fallback-serving alarm.
|
|
3
|
-
* is provisioned against these exact values, so they are a
|
|
2
|
+
* CloudWatch namespace + metric name for the prompt-fallback-serving alarm.
|
|
3
|
+
* The alarm is provisioned against these exact string values, so they are a
|
|
4
|
+
* published contract — renaming a value requires re-pointing the alarm first.
|
|
4
5
|
*/
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const LLM_GATEWAY_METRIC_NAMESPACE = "LLMGateway";
|
|
7
|
+
export declare const PROMPT_FALLBACK_SERVED_METRIC = "LangfuseFallbackServed";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PROMPT_FALLBACK_SERVED_METRIC = exports.LLM_GATEWAY_METRIC_NAMESPACE = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* CloudWatch namespace + metric name for the fallback-serving alarm.
|
|
6
|
-
* is provisioned against these exact values, so they are a
|
|
5
|
+
* CloudWatch namespace + metric name for the prompt-fallback-serving alarm.
|
|
6
|
+
* The alarm is provisioned against these exact string values, so they are a
|
|
7
|
+
* published contract — renaming a value requires re-pointing the alarm first.
|
|
7
8
|
*/
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
9
|
+
exports.LLM_GATEWAY_METRIC_NAMESPACE = 'LLMGateway';
|
|
10
|
+
exports.PROMPT_FALLBACK_SERVED_METRIC = 'LangfuseFallbackServed';
|
|
10
11
|
//# sourceMappingURL=llmTracing.constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llmTracing.constants.js","sourceRoot":"","sources":["../../../src/utilities/llmTracing/llmTracing.constants.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"llmTracing.constants.js","sourceRoot":"","sources":["../../../src/utilities/llmTracing/llmTracing.constants.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,4BAA4B,GAAG,YAAY,CAAC;AAE5C,QAAA,6BAA6B,GAAG,wBAAwB,CAAC"}
|
|
@@ -14,8 +14,8 @@ export interface LLMTraceContext {
|
|
|
14
14
|
/**
|
|
15
15
|
* Structural reference to the managed prompt a generation was produced from.
|
|
16
16
|
* SDK-free by design: the gateway only carries `name`/`version`/`isFallback`,
|
|
17
|
-
* and
|
|
18
|
-
*
|
|
17
|
+
* and the tracer implementation turns it into a prompt link (a fallback
|
|
18
|
+
* prompt intentionally produces no link).
|
|
19
19
|
*/
|
|
20
20
|
export interface LLMTracedPrompt {
|
|
21
21
|
name: string;
|
|
@@ -45,7 +45,7 @@ export interface LLMGenerationTrace {
|
|
|
45
45
|
metadata?: LLMTraceMetadata;
|
|
46
46
|
/**
|
|
47
47
|
* The managed prompt this generation used. Threaded through so the tracer can
|
|
48
|
-
* link the observation to its prompt version
|
|
48
|
+
* link the observation to its prompt version.
|
|
49
49
|
*/
|
|
50
50
|
prompt?: LLMTracedPrompt;
|
|
51
51
|
/** Epoch milliseconds captured immediately before the provider call. */
|
|
@@ -66,7 +66,7 @@ export interface LLMGenerationTraceRecord extends LLMGenerationTrace {
|
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* The tracing surface the gateway depends on. Any implementation (the no-op,
|
|
69
|
-
* or `@mate-academy/llm-tracer`
|
|
69
|
+
* or a real tracer from `@mate-academy/llm-tracer`) satisfies it, so
|
|
70
70
|
* consumers hold a single type regardless of whether tracing is configured.
|
|
71
71
|
*/
|
|
72
72
|
export interface LLMGatewayTracer {
|
|
@@ -87,7 +87,7 @@ export interface LLMGatewayTracer {
|
|
|
87
87
|
*/
|
|
88
88
|
shutdown?(): Promise<void>;
|
|
89
89
|
}
|
|
90
|
-
export interface
|
|
90
|
+
export interface LLMFallbackMetricDimensions {
|
|
91
91
|
feature?: string;
|
|
92
92
|
promptName?: string;
|
|
93
93
|
reason?: string;
|
|
@@ -97,4 +97,4 @@ export interface LangfuseFallbackMetricDimensions {
|
|
|
97
97
|
* implementation when they build the gateway; the default is a no-op so the
|
|
98
98
|
* gateway carries no AWS dependency and tracing stays fire-and-forget.
|
|
99
99
|
*/
|
|
100
|
-
export type
|
|
100
|
+
export type LLMFallbackMetricEmitter = (dimensions: LLMFallbackMetricDimensions) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type LLMFallbackMetricEmitter, type LLMGatewayTracer } from '../../utilities/llmTracing/llmTracing.typedefs';
|
|
2
2
|
export declare const noopLLMGatewayTracer: LLMGatewayTracer;
|
|
3
|
-
export declare const noopFallbackMetricEmitter:
|
|
3
|
+
export declare const noopFallbackMetricEmitter: LLMFallbackMetricEmitter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noopLLMTracing.js","sourceRoot":"","sources":["../../../src/utilities/llmTracing/noopLLMTracing.ts"],"names":[],"mappings":";;;AAMA,MAAM,oBAAoB;IACf,SAAS,GAAG,KAAK,CAAC;IAE3B,KAAK,CAAC,SAAS,CACb,KAAa,EACb,QAAyB,EACzB,EAAyB;QAEzB,OAAO,EAAE,EAAE,CAAC;IACd,CAAC;IAED,gBAAgB;QACd,sBAAsB;IACxB,CAAC;IAED,KAAK,CAAC,mBAAmB,CACvB,KAAa,EACb,MAAe,EACf,EAAyB;QAEzB,OAAO,EAAE,EAAE,CAAC;IACd,CAAC;IAED,iBAAiB;QACf,sBAAsB;IACxB,CAAC;IAED,KAAK,CAAC,KAAK;QACT,sBAAsB;IACxB,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,sBAAsB;IACxB,CAAC;CACF;AAEY,QAAA,oBAAoB,GAAqB,IAAI,oBAAoB,EAAE,CAAC;AAE1E,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"noopLLMTracing.js","sourceRoot":"","sources":["../../../src/utilities/llmTracing/noopLLMTracing.ts"],"names":[],"mappings":";;;AAMA,MAAM,oBAAoB;IACf,SAAS,GAAG,KAAK,CAAC;IAE3B,KAAK,CAAC,SAAS,CACb,KAAa,EACb,QAAyB,EACzB,EAAyB;QAEzB,OAAO,EAAE,EAAE,CAAC;IACd,CAAC;IAED,gBAAgB;QACd,sBAAsB;IACxB,CAAC;IAED,KAAK,CAAC,mBAAmB,CACvB,KAAa,EACb,MAAe,EACf,EAAyB;QAEzB,OAAO,EAAE,EAAE,CAAC;IACd,CAAC;IAED,iBAAiB;QACf,sBAAsB;IACxB,CAAC;IAED,KAAK,CAAC,KAAK;QACT,sBAAsB;IACxB,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,sBAAsB;IACxB,CAAC;CACF;AAEY,QAAA,oBAAoB,GAAqB,IAAI,oBAAoB,EAAE,CAAC;AAE1E,MAAM,yBAAyB,GAA6B,GAAG,EAAE;IACtE,oCAAoC;AACtC,CAAC,CAAC;AAFW,QAAA,yBAAyB,6BAEpC"}
|