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!
- Head over to the Discord server <-- Invites are currently paused!
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 toTrue
, the package will return the full JSON response from the request. IfFalse
(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.
- (dict or str): If in development mode (
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 isTrue
).
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 isTrue
).
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 isTrue
).
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 isTrue
).
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 isTrue
).
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 isTrue
).
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 isTrue
).
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for PurGPT.py-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cf9899ce4147442b894ccdaae641a549ba3f7e463bbfbfec65bd92cbdc3b50c |
|
MD5 | 3a385fe85072f193c6dbbf8e44db2fc7 |
|
BLAKE2b-256 | 109380f27af944cdffe02de7b00701bc032857a01e50c93a0bc01a3d22338a70 |