diff --git a/docs/classes/Client.html b/docs/classes/Client.html index 6a26db3..068f0bf 100644 --- a/docs/classes/Client.html +++ b/docs/classes/Client.html @@ -103,7 +103,7 @@
Protected
RawDoPost performs a raw POST call.
endpoint represents endpoint to call and does not include the transport or domain.
body represents an input object.
RawDoSSEPost performs a raw POST call with SSE support.
ReplacePII replaces personal information such as names, SSNs, and +
ReplacePII replaces personal information such as names, SSNs, and emails in a given text.
replaceMethod represents the method to use for replacing personal information.
import * as pg from 'predictionguard';const client = new pg.Client('https://api.predictionguard.com', process.env.PGKEY);async function Toxicity() { const text = `Every flight I have is late and I am very angry. I want to hurt someone.`; var [result, err] = await client.Toxicity(text); if (err != null) { console.log('ERROR:' + err.error); return; } console.log('RESULT:' + result.checks[0].score);}Toxicity(); Copy
import * as pg from 'predictionguard';const client = new pg.Client('https://api.predictionguard.com', process.env.PGKEY);async function Toxicity() { const text = `Every flight I have is late and I am very angry. I want to hurt someone.`; var [result, err] = await client.Toxicity(text); if (err != null) { console.log('ERROR:' + err.error); return; } console.log('RESULT:' + result.checks[0].score);}Toxicity();
Translate converts text from one language to another.
text represents the text to be translated.
sourceLang represents the source language of the text.
targetLang represents the target language of the text.
Use third-party translation +engines such as OpenAI, DeepL, and Google. Defaults to false.
import * as pg from 'predictionguard';const client = new pg.Client('https://api.predictionguard.com', process.env.PGKEY);async function Translate() { const sourceLang = pg.Languages.English; const targetLang = pg.Languages.Spanish; const text = `The rain in Spain stays mainly in the plain`; var [result, err] = await client.Translate(text, sourceLang, targetLang); if (err != null) { console.log('ERROR:' + err.error); return; } console.log('RESULT:' + result.best_translation);}Translate(); +Exampleimport * as pg from 'predictionguard';const client = new pg.Client('https://api.predictionguard.com', process.env.PGKEY);async function Translate() { const text = `The rain in Spain stays mainly in the plain`; const sourceLang = pg.Languages.English; const targetLang = pg.Languages.Spanish; const useThirdPartyEngine = false; var [result, err] = await client.Translate(text, sourceLang, targetLang, useThirdPartyEngine); if (err != null) { console.log('ERROR:' + err.error); return; } console.log('RESULT:' + result.best_translation);}Translate(); Copy -
import * as pg from 'predictionguard';const client = new pg.Client('https://api.predictionguard.com', process.env.PGKEY);async function Translate() { const text = `The rain in Spain stays mainly in the plain`; const sourceLang = pg.Languages.English; const targetLang = pg.Languages.Spanish; const useThirdPartyEngine = false; var [result, err] = await client.Translate(text, sourceLang, targetLang, useThirdPartyEngine); if (err != null) { console.log('ERROR:' + err.error); return; } console.log('RESULT:' + result.best_translation);}Translate(); Copy
import * as pg from 'predictionguard';const client = new pg.Client('https://api.predictionguard.com', process.env.PGKEY);async function Translate() { const text = `The rain in Spain stays mainly in the plain`; const sourceLang = pg.Languages.English; const targetLang = pg.Languages.Spanish; const useThirdPartyEngine = false; var [result, err] = await client.Translate(text, sourceLang, targetLang, useThirdPartyEngine); if (err != null) { console.log('ERROR:' + err.error); return; } console.log('RESULT:' + result.best_translation);}Translate();
RawDoPost performs a raw POST call.
+Protected
RawRawDoPost performs a raw POST call.
Parameters
endpoint represents endpoint to call and does not include the transport or domain.
body represents an input object.
@@ -111,7 +111,7 @@Protected
RawRawDoSSEPost performs a raw POST call with SSE support.
+Protected
RawRawDoSSEPost performs a raw POST call with SSE support.
Parameters
endpoint represents endpoint to call and does not include the transport or domain.
body represents an input object.
@@ -120,7 +120,7 @@Parameters
Returns void
Returns Promise<null | Error>
ReplacePII
ReplacePII replaces personal information such as names, SSNs, and +
ReplacePII
ReplacePII replaces personal information such as names, SSNs, and emails in a given text.
Parameters
replaceMethod represents the method to use for replacing personal information.
@@ -141,16 +141,18 @@Example
-Translate
Translate converts text from one language to another.
+Translate
Translate converts text from one language to another.
Parameters
text represents the text to be translated.
sourceLang represents the source language of the text.
targetLang represents the target language of the text.
+Use third-party translation +engines such as OpenAI, DeepL, and Google. Defaults to false.
Returns Promise<[Translate, null | Error]>
Example
Settings
Member Visibility
Theme
On This Page