Prerequisites

How to Install

yarn add @filtro/sdk

Basic Usage

Basic and modular usage, integrated in Nodejs application

import filtro from "@filtro/sdk";

const { mask, clear } = filtro({
  baseURL: "https://api.filtro.ai/v1",
});

async function run() {
  const { masked_string, mapping } = await mask(
    "Hi my name is Gianmarco Rengucci \
    I am a software engineer at Apple, here in Milan. \
    Whats up?"
  );

  // Send to OpenAI safely
  const chat = new ChatOpenAI({ temperature: 0 });
  const response = await chat.call([new HumanChatMessage(masked_string)]);

  const clear_string = await clear(response, mapping);
}

run();

OpenAI API

Our repository includes open-source adapters for OpenAI endpoints, enabling you to switch to our endpoints in your existing codebase without any modifications. This ensures compatibility with function signatures, allowing for a seamless transition with no code changes required.

Examples

Explore more examples