Skip to main content

A client library for the prompts-testing API.

Project description

This file provides a clear overview for anyone who visits your project on GitHub or PyPI.

Markdown

promptsapi

A simple Python client library for interacting with the prompts-testing API.

Installation

You can install promptsapi directly from PyPI using pip:

pip install promptsapi
Usage
The library provides a single, easy-to-use function to generate content from the API.

Example
Here's how to use the generate_prompt function:

Python

from promptsapi import generate_prompt

# Replace with your actual API key
API_KEY = "YOUR_API_KEY_HERE"

# The URL for the generate endpoint
API_URL = "[https://prompts-testing-v1-0.onrender.com/api/v1/generate](https://prompts-testing-v1-0.onrender.com/api/v1/generate)"

# The raw text input for the API
prompt_text = "write a short story about a brave knight"

# Call the function
response = generate_prompt(
    api_key=API_KEY,
    api_url=API_URL,
    raw_input=prompt_text
)

# Print the response if the request was successful
if response:
    print(response)
Error Handling
The generate_prompt function handles common errors gracefully. It will print a message to the console and return None if it encounters issues like:

Network timeouts

HTTP errors (e.g., 404 Not Found, 500 Internal Server Error)

Unexpected exceptions

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

promptsapi-0.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

promptsapi-0.1.0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file promptsapi-0.1.0.tar.gz.

File metadata

  • Download URL: promptsapi-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for promptsapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1d9d0a5e25b54182f45636f8910d5e124af206ac418958591d20778f43417d77
MD5 7b049b168abdf4cb2e8bf1e9628a82d4
BLAKE2b-256 22aee4496e54db7cff2b0d8ce2cf7830e68e1af335850cd93daf97317f8dea2c

See more details on using hashes here.

File details

Details for the file promptsapi-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: promptsapi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for promptsapi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cebccf9804c92d28884b0cb6db491477ca42ee5d686f390a9124524499cffcf9
MD5 7c9f4252fd3d22824b58fdbcd113811a
BLAKE2b-256 e63c3178adec302c5513b1bef04b82f729105ce36ae30d1aae87b3ea28385d6e

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