Skip to main content

Open AI classifier for indicating AI-written text

Project description

Openai Detector

Open AI classifier for indicating AI-written text

openai-detector is released under the Apache 2.0 license. http://makeapullrequest.com Community colab

Installation

pip3 install git+https://github.com/promptslab/openai-detector.git

Usage

from detector import OpenaiDetector

sentence     = """All children, except one, grow up. They soon know that they will grow up, and the way Wendy knew was this. One day when she was two years old she was playing in a garden, and she plucked another flower and ran with it to her mother. I suppose she must have looked rather delightful, for Mrs. Darling put her hand to her heart and cried, “Oh, why can’t you remain like this for ever!” This was all that passed between them on the subject, but henceforth Wendy knew that she must grow up. You always know after you are two. Two is the beginning of the end. Of course they lived at 14, and until Wendy came her mother was the chief one. She was a lovely lady, with a romantic mind and such a sweet mocking mouth. Her romantic mind was like the tiny boxes, one within the other, that come from the puzzling East, however many you discover there is always one more; and her sweet mocking mouth had one kiss on it that Wendy could never get, though there it was, perfectly conspicuous in the right-hand corner. The way Mr. Darling won her was this: the many gentlemen who had been boys when she was a girl discovered simultaneously that they loved her, and they all ran to her house to propose to her except Mr. Darling, who took a cab and nipped in first, and so he got her. He got all of her, except the innermost box and the kiss. He never knew about the box, and in time he gave up trying for the kiss. Wendy thought Napoleon could have got it, but I can picture him trying, and then going off in a passion, slamming the door. Mr. Darling used to boast to Wendy that her mother not only loved him but respected him. He was one of those deep ones who know about stocks and shares. Of course no one really knows, but he quite seemed to know, and he often said stocks were up and shares were down in a way that would have made any woman respect him."""
bearer_token = 'Bearer sess-abcd1234..'

od = OpenaiDetector(bearer_token)
response = od.detect(sentence)
print(response)                          
                          
### Output

{"output"          : "The classifier considers the text to be very unlikely AI-generated.",
"Confidence score" : 96.15870427207666}

Run on colab

colab

Community

If you are interested in Prompt-Engineering, LLMs, ChatGPT and other latest research discussions, please consider joining PromptsLab

Join us on Discord

Steps to get Bearer token from chrome

  • Go to https://platform.openai.com/ai-text-classifier
  • Hit F12 to access the Developer tools
  • Select the Network Tab
  • Select nearly any POST Operation (paste text into detection box and click on submit)
  • Find your current Bearer token in the Request Headers

Here is an example

TO-DO

  • Add all classes labels (total 5 classes from openai) ✅
  • add verifier to check if the sentence is 1000 characters long
  • automatically detect token from user_name, password

Web Version

https://openai.com/blog/new-ai-classifier-for-indicating-ai-written-text/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openai-detector-0.1.2.tar.gz (8.5 kB view details)

Uploaded Source

File details

Details for the file openai-detector-0.1.2.tar.gz.

File metadata

  • Download URL: openai-detector-0.1.2.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for openai-detector-0.1.2.tar.gz
Algorithm Hash digest
SHA256 55f5667c7ac9b249b40fc1fda66ab28787ac0a229c8eb3b6bbb25877186d3226
MD5 4462f86755d411ad7aa6e1060f42b777
BLAKE2b-256 8eab5414d016c41cf8f26aac1f96e289ef5e114e31c5d44d3ed96250d47ae827

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page