Skip to main content

PurGPT.py, the wrapper for the PurGPT API

Project description

PurGPT.py Documentation

The PurGPT.py Python package provides easy access to the PurGPT API for various natural language processing and AI tasks. This documentation explains the methods and their usage within the PurGPT class.

For full documentation, please visit https://purgpt.xyz


Getting a token

Think you're worthy to start with PurGPT? We sure do! If you agree with us, simply follow the steps below!

Once there, click into the # bots channel

Run the /key command

The PurGPT bot will respond with your key. Do not, under any circumstance, share it with anyone! It's yours :)

Now that you have your token, you can move on!

Initializing the class

ai = purgpt.PurGPT(token, dev = True)

Initialize the PurGPT class with a token and an optional development mode flag.

  • token (str): The API token for authentication!
  • dev (bool, optional): If set to True, the package will return the full JSON response from the request. If False (default), it will return important information or an error.

Methods

Test method: test()

Test the API by recieving a test message. The AI will respond and tell a funny joke if it is online.

  • Returns:
    • (dict or str): If in development mode (dev=True), returns the full JSON response or an error message. Otherwise, returns the AI's response or an error message.

Generate method: generate(prompt, provider="openai", beta=True)

Generate individual text based on a prompt.

  • prompt (str): The text prompt for the AI.
  • provider (str, optional): The provider for text generation (default is "openai").
  • beta (bool, optional): Whether to use the beta version (default is True).

Chat method: chat(messages, provider="openai", beta=True)

Engage in a chat conversation with AI.

  • messages (list): List of message objects for the conversation. (Same formatting as with OpenAI's package!)
  • provider (str, optional): The provider for chat completion (default is "openai").
  • beta (bool, optional): Whether to use the beta version (default is True).

Document Analysis: document_analysis(document_url: str, prompt: str, beta=True)

Analyze documents or images with AI.

  • document_url (str): The URL of the document or image to analyze.
  • prompt (str): A prompt for the analysis.
  • beta (bool, optional): Whether to use the beta version (default is True).

Contend Moderation: moderations(prompt, beta=True)

Perform content moderation on text.

  • prompt (str): The text to be moderated.
  • beta (bool, optional): Whether to use the beta version (default is True).

Image Generation: image(prompt, provider="openai", beta=True)

Generate images based on a text prompt.

  • prompt (str): The text prompt for image generation.
  • provider (str, optional): The provider for image generation (default is "openai").
  • beta (bool, optional): Whether to use the beta version (default is True).

Audio Transcription: transcribe(file_url, beta=True)

Transcribe an audio file from its URL.

  • file_url (str): The URL of the audio file.
  • beta (bool, optional): Whether to use the beta version (default is True).

Audio Translation: translate(file_url, beta=True)

Translate an audio file from its URL.

  • file_url (str): The URL of the audio file.
  • beta (bool, optional): Whether to use the beta version (default is True).

Other: custom(owner, endpoint, body, subdomain)

Use a custom API endpoint.

  • owner (str): The owner/provider of the custom endpoint.
  • endpoint (str): The custom endpoint to call.
  • body (dict): The request body as a dictionary.
  • subdomain (str): The subdomain to use for the custom request. (i.e. "rp" (if you know you know 😉))

Note: For more details and usage examples, refer to the PurGPT API documentation.


Quickstart

import purgpt
import os

token = "" #replace with your actuall token 

ai = purgpt.PurGPT(token)

print(ai.generate("Say hello"))

Thats all!

If you have any questions, feel free to reach out to @thecatsmoo on Discord!

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

PurGPT.py-0.0.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PurGPT.py-0.0.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file PurGPT.py-0.0.1.tar.gz.

File metadata

  • Download URL: PurGPT.py-0.0.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for PurGPT.py-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7cf94b0b703e3d3f26315b996b471b3d6326112aca040804ab91e7f151fc7b67
MD5 6787db37d8345657b08eadba2d97b9c5
BLAKE2b-256 284425d98e421d2625cc24b28221bf32919f1fbcc67ece2388212f868aadb1ba

See more details on using hashes here.

File details

Details for the file PurGPT.py-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: PurGPT.py-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for PurGPT.py-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7cf9899ce4147442b894ccdaae641a549ba3f7e463bbfbfec65bd92cbdc3b50c
MD5 3a385fe85072f193c6dbbf8e44db2fc7
BLAKE2b-256 109380f27af944cdffe02de7b00701bc032857a01e50c93a0bc01a3d22338a70

See more details on using hashes here.

Supported by

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