@arizeai/phoenix-client
Version:
A client for the Phoenix API
43 lines • 1.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.addSpanNote = addSpanNote;
const client_1 = require("../client");
/**
* Add a note to a span.
*
* Notes are a special type of annotation that allow multiple entries per span
* (unlike regular annotations which are unique by name and identifier).
* Each note gets a unique timestamp-based identifier.
*
* @param params - The parameters to add a span note
* @returns The ID of the created note annotation
*
* @example
* ```ts
* const result = await addSpanNote({
* spanNote: {
* spanId: "123abc",
* note: "This span looks suspicious, needs review"
* }
* });
* ```
*/
async function addSpanNote({ client: _client, spanNote, }) {
const client = _client !== null && _client !== void 0 ? _client : (0, client_1.createClient)();
const { data, error } = await client.POST("/v1/span_notes", {
body: {
data: {
span_id: spanNote.spanId.trim(),
note: spanNote.note,
},
},
});
if (error) {
throw new Error(`Failed to add span note: ${error}`);
}
if (!(data === null || data === void 0 ? void 0 : data.data)) {
throw new Error("Failed to add span note: no data returned");
}
return data.data;
}
//# sourceMappingURL=addSpanNote.js.map