Yes, there are Python libraries and tools designed to detect if text was generated by large language models (LLMs) or written by humans. Some notable options include:
GPTZero: Specifically built to detect AI-generated text from models like GPT, commonly used in educational settings.
OpenAI's Text Classifier: OpenAI offers a classifier for distinguishing between human and GPT-generated text. It can be accessed via the API, though the tool is not always highly accurate.
DetectGPT: A research tool developed to detect GPT-3 text. This model-based approach analyzes text perplexity and distinctiveness.
Hugging Face Transformers: Using pre-trained transformers to evaluate text perplexity can help identify AI-generated patterns, though it's not dedicated to detection.
AI Text Classifier: Several third-party tools and APIs use statistical methods to determine the likelihood that text was machine-generated.