Skip to content

Latest commit

 

History

History
158 lines (111 loc) · 11.1 KB

File metadata and controls

158 lines (111 loc) · 11.1 KB

Annotations

Overview

Available Operations

  • create - Annotate a span
  • delete - Remove an annotation from a span

create

Annotate a span

Example Usage

import { Orq } from "@orq-ai/node";

const orq = new Orq({
  apiKey: process.env["ORQ_API_KEY"] ?? "",
});

async function run() {
  await orq.annotations.create({
    traceId: "<id>",
    spanId: "<id>",
  });


}

run();

Standalone function

The standalone function version of this method:

import { OrqCore } from "@orq-ai/node/core.js";
import { annotationsCreate } from "@orq-ai/node/funcs/annotationsCreate.js";

// Use `OrqCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const orq = new OrqCore({
  apiKey: process.env["ORQ_API_KEY"] ?? "",
});

async function run() {
  const res = await annotationsCreate(orq, {
    traceId: "<id>",
    spanId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    
  } else {
    console.log("annotationsCreate failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.CreateAnnotationRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<void>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

delete

Remove an annotation from a span

Example Usage

import { Orq } from "@orq-ai/node";

const orq = new Orq({
  apiKey: process.env["ORQ_API_KEY"] ?? "",
});

async function run() {
  await orq.annotations.delete({
    traceId: "<id>",
    spanId: "<id>",
  });


}

run();

Standalone function

The standalone function version of this method:

import { OrqCore } from "@orq-ai/node/core.js";
import { annotationsDelete } from "@orq-ai/node/funcs/annotationsDelete.js";

// Use `OrqCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const orq = new OrqCore({
  apiKey: process.env["ORQ_API_KEY"] ?? "",
});

async function run() {
  const res = await annotationsDelete(orq, {
    traceId: "<id>",
    spanId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    
  } else {
    console.log("annotationsDelete failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.DeleteAnnotationRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<void>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*