@arizeai/phoenix-client 3.0.0 → 3.2.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/README.md +22 -1
- package/dist/esm/__generated__/api/v1.d.ts +188 -50
- package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
- package/dist/esm/experiments/instrumention.d.ts +6 -1
- package/dist/esm/experiments/instrumention.d.ts.map +1 -1
- package/dist/esm/experiments/instrumention.js +15 -15
- package/dist/esm/experiments/instrumention.js.map +1 -1
- package/dist/esm/experiments/runExperiment.d.ts +12 -2
- package/dist/esm/experiments/runExperiment.d.ts.map +1 -1
- package/dist/esm/experiments/runExperiment.js +5 -2
- package/dist/esm/experiments/runExperiment.js.map +1 -1
- package/dist/esm/schemas/llm/converters.js +4 -4
- package/dist/esm/schemas/llm/converters.js.map +1 -1
- package/dist/esm/spans/addDocumentAnnotation.d.ts +45 -0
- package/dist/esm/spans/addDocumentAnnotation.d.ts.map +1 -0
- package/dist/esm/spans/addDocumentAnnotation.js +45 -0
- package/dist/esm/spans/addDocumentAnnotation.js.map +1 -0
- package/dist/esm/spans/addSpanAnnotation.d.ts +8 -2
- package/dist/esm/spans/addSpanAnnotation.d.ts.map +1 -1
- package/dist/esm/spans/addSpanAnnotation.js +5 -5
- package/dist/esm/spans/addSpanAnnotation.js.map +1 -1
- package/dist/esm/spans/index.d.ts +2 -0
- package/dist/esm/spans/index.d.ts.map +1 -1
- package/dist/esm/spans/index.js +2 -0
- package/dist/esm/spans/index.js.map +1 -1
- package/dist/esm/spans/logDocumentAnnotations.d.ts +58 -0
- package/dist/esm/spans/logDocumentAnnotations.d.ts.map +1 -0
- package/dist/esm/spans/logDocumentAnnotations.js +55 -0
- package/dist/esm/spans/logDocumentAnnotations.js.map +1 -0
- package/dist/esm/spans/logSpanAnnotations.d.ts +7 -1
- package/dist/esm/spans/logSpanAnnotations.d.ts.map +1 -1
- package/dist/esm/spans/logSpanAnnotations.js +5 -5
- package/dist/esm/spans/logSpanAnnotations.js.map +1 -1
- package/dist/esm/spans/types.d.ts +48 -0
- package/dist/esm/spans/types.d.ts.map +1 -1
- package/dist/esm/spans/types.js +41 -8
- package/dist/esm/spans/types.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/utils/formatPromptMessages.d.ts.map +1 -1
- package/dist/esm/utils/getPromptBySelector.d.ts.map +1 -1
- package/dist/src/__generated__/api/v1.d.ts +188 -50
- package/dist/src/__generated__/api/v1.d.ts.map +1 -1
- package/dist/src/experiments/instrumention.d.ts +6 -1
- package/dist/src/experiments/instrumention.d.ts.map +1 -1
- package/dist/src/experiments/instrumention.js +13 -13
- package/dist/src/experiments/instrumention.js.map +1 -1
- package/dist/src/experiments/runExperiment.d.ts +12 -2
- package/dist/src/experiments/runExperiment.d.ts.map +1 -1
- package/dist/src/experiments/runExperiment.js +5 -2
- package/dist/src/experiments/runExperiment.js.map +1 -1
- package/dist/src/schemas/llm/converters.js +4 -4
- package/dist/src/schemas/llm/converters.js.map +1 -1
- package/dist/src/spans/addDocumentAnnotation.d.ts +45 -0
- package/dist/src/spans/addDocumentAnnotation.d.ts.map +1 -0
- package/dist/src/spans/addDocumentAnnotation.js +49 -0
- package/dist/src/spans/addDocumentAnnotation.js.map +1 -0
- package/dist/src/spans/addSpanAnnotation.d.ts +8 -2
- package/dist/src/spans/addSpanAnnotation.d.ts.map +1 -1
- package/dist/src/spans/addSpanAnnotation.js +6 -6
- package/dist/src/spans/addSpanAnnotation.js.map +1 -1
- package/dist/src/spans/index.d.ts +2 -0
- package/dist/src/spans/index.d.ts.map +1 -1
- package/dist/src/spans/index.js +2 -0
- package/dist/src/spans/index.js.map +1 -1
- package/dist/src/spans/logDocumentAnnotations.d.ts +58 -0
- package/dist/src/spans/logDocumentAnnotations.d.ts.map +1 -0
- package/dist/src/spans/logDocumentAnnotations.js +58 -0
- package/dist/src/spans/logDocumentAnnotations.js.map +1 -0
- package/dist/src/spans/logSpanAnnotations.d.ts +7 -1
- package/dist/src/spans/logSpanAnnotations.d.ts.map +1 -1
- package/dist/src/spans/logSpanAnnotations.js +5 -6
- package/dist/src/spans/logSpanAnnotations.js.map +1 -1
- package/dist/src/spans/types.d.ts +48 -0
- package/dist/src/spans/types.d.ts.map +1 -1
- package/dist/src/spans/types.js +45 -10
- package/dist/src/spans/types.js.map +1 -1
- package/dist/src/utils/formatPromptMessages.d.ts.map +1 -1
- package/dist/src/utils/getPromptBySelector.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/__generated__/api/v1.d.ts +1240 -1238
- package/src/__generated__/api/v1.ts +188 -50
- package/src/experiments/instrumention.ts +27 -14
- package/src/experiments/runExperiment.ts +15 -0
- package/src/schemas/llm/converters.ts +4 -4
- package/src/spans/addDocumentAnnotation.ts +66 -0
- package/src/spans/addSpanAnnotation.ts +12 -6
- package/src/spans/index.ts +2 -0
- package/src/spans/logDocumentAnnotations.ts +79 -0
- package/src/spans/logSpanAnnotations.ts +11 -5
- package/src/spans/types.ts +112 -8
package/dist/src/spans/types.js
CHANGED
|
@@ -1,22 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toSpanAnnotationData = toSpanAnnotationData;
|
|
4
|
+
exports.toDocumentAnnotationData = toDocumentAnnotationData;
|
|
5
|
+
/**
|
|
6
|
+
* Build and validate annotation result fields
|
|
7
|
+
*/
|
|
8
|
+
function buildAnnotationResult(annotation, annotationType) {
|
|
9
|
+
const result = {};
|
|
10
|
+
// Build result with trimming for string fields
|
|
11
|
+
if (annotation.label !== undefined) {
|
|
12
|
+
result.label = annotation.label.trim() || null;
|
|
13
|
+
}
|
|
14
|
+
if (annotation.score !== undefined) {
|
|
15
|
+
result.score = annotation.score;
|
|
16
|
+
}
|
|
17
|
+
if (annotation.explanation !== undefined) {
|
|
18
|
+
result.explanation = annotation.explanation.trim() || null;
|
|
19
|
+
}
|
|
20
|
+
// Validate that at least one result field is provided
|
|
21
|
+
const hasValidResult = result.label || result.score !== undefined || result.explanation;
|
|
22
|
+
if (!hasValidResult) {
|
|
23
|
+
throw new Error(`At least one of label, score, or explanation must be provided for ${annotationType} annotation`);
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
4
27
|
/**
|
|
5
28
|
* Convert a SpanAnnotation to the API format
|
|
6
29
|
*/
|
|
7
30
|
function toSpanAnnotationData(annotation) {
|
|
8
|
-
var _a, _b, _c, _d
|
|
31
|
+
var _a, _b, _c, _d;
|
|
32
|
+
const result = buildAnnotationResult(annotation, "span");
|
|
33
|
+
return {
|
|
34
|
+
span_id: annotation.spanId.trim(),
|
|
35
|
+
name: annotation.name.trim(),
|
|
36
|
+
annotator_kind: (_a = annotation.annotatorKind) !== null && _a !== void 0 ? _a : "HUMAN",
|
|
37
|
+
result,
|
|
38
|
+
metadata: (_b = annotation.metadata) !== null && _b !== void 0 ? _b : null,
|
|
39
|
+
identifier: (_d = (_c = annotation.identifier) === null || _c === void 0 ? void 0 : _c.trim()) !== null && _d !== void 0 ? _d : "",
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Convert a DocumentAnnotation to the API format
|
|
44
|
+
*/
|
|
45
|
+
function toDocumentAnnotationData(annotation) {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
const result = buildAnnotationResult(annotation, "document");
|
|
9
48
|
return {
|
|
10
|
-
span_id: annotation.spanId,
|
|
11
|
-
|
|
49
|
+
span_id: annotation.spanId.trim(),
|
|
50
|
+
document_position: annotation.documentPosition,
|
|
51
|
+
name: annotation.name.trim(),
|
|
12
52
|
annotator_kind: (_a = annotation.annotatorKind) !== null && _a !== void 0 ? _a : "HUMAN",
|
|
13
|
-
result
|
|
14
|
-
|
|
15
|
-
score: (_c = annotation.score) !== null && _c !== void 0 ? _c : null,
|
|
16
|
-
explanation: null,
|
|
17
|
-
},
|
|
18
|
-
metadata: (_d = annotation.metadata) !== null && _d !== void 0 ? _d : null,
|
|
19
|
-
identifier: (_e = annotation.identifier) !== null && _e !== void 0 ? _e : "",
|
|
53
|
+
result,
|
|
54
|
+
metadata: (_b = annotation.metadata) !== null && _b !== void 0 ? _b : null,
|
|
20
55
|
};
|
|
21
56
|
}
|
|
22
57
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/spans/types.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/spans/types.ts"],"names":[],"mappings":";;AAoIA,oDAaC;AAKD,4DAaC;AArED;;GAEG;AACH,SAAS,qBAAqB,CAC5B,UAGC,EACD,cAAmC;IAEnC,MAAM,MAAM,GAAqB,EAAE,CAAC;IAEpC,+CAA+C;IAC/C,IAAI,UAAU,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;IACjD,CAAC;IACD,IAAI,UAAU,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;IAClC,CAAC;IACD,IAAI,UAAU,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACzC,MAAM,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;IAC7D,CAAC;IAED,sDAAsD;IACtD,MAAM,cAAc,GAClB,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,WAAW,CAAC;IACnE,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,qEAAqE,cAAc,aAAa,CACjG,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AACh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AiB,EAAE,EACnC,SAAS,GAAE,SAAc;;;;;;;
|
|
1
|
+
{"version":3,"file":"formatPromptMessages.d.ts","sourceRoot":"","sources":["../../../src/utils/formatPromptMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAO3E;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,oBAAoB,EAC5B,cAAc,EAAE,iBAAiB,EAAE,EACnC,SAAS,GAAE,SAAc;;;;;;;mBA4Dmy7E,uDAAsB;;;;;;;;;IAlBn17E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPromptBySelector.d.ts","sourceRoot":"","sources":["../../../src/utils/getPromptBySelector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,QAAQ,GAAG;IACjD;;OAEG;IACH,MAAM,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,MAAM,EAAE,OAAO,EACf,MAAM,GACP,EAAE,yBAAyB;;
|
|
1
|
+
{"version":3,"file":"getPromptBySelector.d.ts","sourceRoot":"","sources":["../../../src/utils/getPromptBySelector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,QAAQ,GAAG;IACjD;;OAEG;IACH,MAAM,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,MAAM,EAAE,OAAO,EACf,MAAM,GACP,EAAE,yBAAyB;;oBAkD86jE,uDAAsB;;cAAkI,uDAAsB,yBAAwB,uDAAsB;mBAAoD,uDAAsB;qBAAoD,uDAAsB;2BAAqG,uDAAsB,uCAAsC,uDAAsB,4CAA2C,uDAAsB,0CAAyC,uDAAsB,uCAAsC,uDAAsB,yCAAwC,uDAAsB,oCAAmC,uDAAsB,uCAAsC,uDAAsB;YAAsD,uDAAsB;sBAAwF,uDAAsB;;UADzhmE"}
|