Skip to content

Latest commit

 

History

History
74 lines (69 loc) · 1.34 KB

File metadata and controls

74 lines (69 loc) · 1.34 KB
import { Opper } from "opperai";

const opper = new Opper({
  httpBearer: process.env["OPPER_HTTP_BEARER"] ?? "",
});

async function run() {
  const result = await opper.call({
    name: "add_numbers",
    instructions: "Calculate the sum of two numbers",
    inputSchema: {
      "properties": {
        "x": {
          "title": "X",
          "type": "integer",
        },
        "y": {
          "title": "Y",
          "type": "integer",
        },
      },
      "required": [
        "x",
        "y",
      ],
      "title": "OpperInputExample",
      "type": "object",
    },
    outputSchema: {
      "properties": {
        "sum": {
          "title": "Sum",
          "type": "integer",
        },
      },
      "required": [
        "sum",
      ],
      "title": "OpperOutputExample",
      "type": "object",
    },
    input: {
      "x": 4,
      "y": 5,
    },
    examples: [
      {
        input: {
          "x": 1,
          "y": 3,
        },
        output: {
          "sum": 4,
        },
        comment: "Adds two numbers",
      },
    ],
    parentSpanId: "123e4567-e89b-12d3-a456-426614174000",
    tags: {
      "project": "project_456",
      "user": "company_123",
    },
    configuration: {},
  });

  console.log(result);
}

run();