
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@focus-reactive/content-ai-sdk
Advanced tools
An easy way to enchance your project with ready to use GPT functions
yarn add @focus-reactive/content-ai-sdk
// 1. Import the configration function
import { initSDK } from "@focus-reactive/content-ai-sdk";
// 2. Initialize the SDK with the OpenAI token
initSDK({ openAiToken: OPEN_AI_TOKEN });
We implemented several features that you can use in your projects to work with localisations.
translate
Parameters
interface TranslateOptions {
targetLanguage: string;
content: string;
currentLanguage?: string;
promptModifier?: string;
}
targetLanguage
string - Result languagecontent
string - Text content that should be translated to the target language.currentLanguage
string - Current language of the content. If not provided, the language will be detected automatically.promptModifier
string - Can be used to modify prompt.Usage
// 1. Import the function
import { translate } from "@focus-reactive/content-ai-sdk";
// 2. Call the function
const deContent = await translate({
content: "Hey! Now I can manage german content",
targetLanguage: "german",
});
translateJSON
This function is created to translate JSON objects to a different language without changing it's structure.
Parameters
interface TranslateOptions {
targetLanguage: string;
content: object;
promptModifier?: string;
currentLanguage?: string;
}
targetLanguage
- Result languagecontent
- Text content that should be translated to the target language (JSON).promptModifier
- Can be used to modify prompt. In some cases you may need to not translate some values or exlude some fields.currentLanguage
- Current language of the content. If not provided, the language will be detected automatically.Usage
// 1. Import the function
import { translateJSON } from "@focus-reactive/content-ai-sdk";
// 2. Call the function
const deContent = await translateJSON({
content: JSON.stringify({
title: "Batman 2",
description: "Superhero movie",
}),
targetLanguage: "german",
promptModifier:
"Do not translate technical fields, they starts with a _ symbol. Translate only values with more than 1 word.",
});
summariseContent
This function is created to be able to create a sammury of a content. Works with string and JSON objects.
Parameters
interface SummariseContentProps {
content: unknown;
contentTitle: string;
promptModifier?: string;
}
contentTitle
- Content title. This is a required field that sets the logical context for the provided content.content
JSON | string - Text content that will be summarised. (JSON | string)promptModifier
- Can be used to modify prompt.Usage
// 1. Import the function
import { summariseContent } from "@focus-reactive/content-ai-sdk";
// 2. Call the function
const summary = await summariseContent({
contentTitle: "Batman movie overview.",
content: JSON.stringify({
title: "Batman",
description: "Superhero movie",
}),
promptModifier: "Make sure that the summary is not longer than 3 sentences.",
});
applyTags
This function is created to logically tag content. Returns tags on order of relevance.
Parameters
interface Tag {
id: string | number;
title: string;
description?: string;
}
interface AppplyTagsProps {
content: unknown;
contentTitle: string;
promptModifier?: string;
resultAmount?: number;
tags: Tag[];
}
contentTitle
- Content title. Sets the logical context for the provided content.content
- Text contentf for tagging. (JSON | string)promptModifier
- Can be used to modify prompt.resultAmount
- Amount of tags that should be returned.tags
- Array of tags that should be used for tagging.Usage
// 1. Import the function
import { applyTags } from "@focus-reactive/content-ai-sdk";
// 2. Call the function
const tags = await applyTags({
contentTitle: "Batman movie overview.",
content: JSON.stringify({
title: "Batman",
description: "Superhero movie",
}),
tags: [] as Tag[],
resultAmount: 5,
promptModifier: "Make sure that the summary is not longer than 3 sentences.",
});
FAQs
An easy way to enchance your project with ready to use GPT functions
The npm package @focus-reactive/content-ai-sdk receives a total of 20 weekly downloads. As such, @focus-reactive/content-ai-sdk popularity was classified as not popular.
We found that @focus-reactive/content-ai-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.