gptzero
v0.0.1-development
Published
A GPTZero client library for javascript
Downloads
4
Maintainers
Readme
gptzero
A GPTZero client library for javascript
Install
npm install gptzero
Usage
import { createClient } from 'gptzero-js';
// Create a client to all the GPTZero API
const gptzero = createClient('<YOUR API KEY>')
// Get output for a single string document
gptzero.predictText("Teachers worried about students turning in essays written by a popular artificial intelligence chatbot now have a new tool of their own. Edward Tian, a 22-year-old senior at Princeton University, has built an app to detect whether text is written by ChatGPT, the viral chatbot that's sparked fears over its potential for unethical uses in academia. Tian, a computer science major who is minoring in journalism, spent part of his winter break creating GPTZero, which he said can 'quickly and efficiently' decipher whether a human or ChatGPT authored an essay.");
// Get batched output for files (must be doc, docx, pdf, or txt)
gptzero.predictFiles(["/path/to/file"])
// Output from predictText:
{
"documents": [
{
"average_generated_prob": 0,
"completely_generated_prob": 0.004087193460490459,
"overall_burstiness": 33.560890197753906,
"paragraphs": [
{
"completely_generated_prob": 0.004087193460490459,
"num_sentences": 3,
"start_sentence_index": 0
}
],
"sentences": [
{
"generated_prob": 0,
"perplexity": 70,
"sentence": "Teachers worried about students turning in essays written by a popular artificial intelligence chatbot now have a new tool of their own."
},
{
"generated_prob": 0,
"perplexity": 52,
"sentence": "Edward Tian, a 22-year-old senior at Princeton University, has built an app to detect whether text is written by ChatGPT, the viral chatbot that's sparked fears over its potential for unethical uses in academia."
},
{
"generated_prob": 0,
"perplexity": 117,
"sentence": "Tian, a computer science major who is minoring in journalism, spent part of his winter break creating GPTZero, which he said can 'quickly and efficiently' decipher whether a human or ChatGPT authored an essay."
}
]
}
]
}
API
For documentation on the output object, see https://gptzero.me/docs
Acknowledgements
Big thanks to https://github.com/ryansonshine/typescript-npm-package-template, on which we built this package.