Skip to main content

A Python SDK for fetching and managing prompts by goman.live

Project description

Goman LIve

This SDK allows developers to easily fetch and manage prompt templates from a remote server. It supports both local environments and remote contexts, making it versatile for different projects. The package was developed as part of the Goman.live SaaS product, which functions as a prompt management platform.

Installation

To use this SDK in your Python project, install it via pip:

pip install goman-live-sdk
from goman_live_sdk import PromptSDK
from prompt_sdk import PromptSDK

# Initialize the SDK
application_id = "your_application_id"
api_key = "your_api_key"
base_url = "https://api.example.com"
sdk = PromptSDK(application_id, api_key, base_url)

# Fetch a prompt from the remote server
prompt_id = "example_prompt_id"
context = {"username": "JohnDoe"}
options = {"url": "https://api.example.com/custom_prompts/example_prompt_id"}
try:
    prompt_response = sdk.get_prompt_from_remote(prompt_id, context, options)
    print(f"Prompt: {prompt_response.template}")
except Exception as e:
    print(f"Error fetching prompt: {e}")

# Send JSON result to the editor
result_json = {"result": "This is a test result"}
try:
    response = sdk.send_json_result_to_editor(result_json, prompt_id)
    print(f"Response: {response}")
except Exception as e:
    print(f"Error sending JSON result: {e}")

# Send image result to the editor
result_image = "base64_encoded_image_string"
try:
    response = sdk.send_image_result_to_editor(result_image, prompt_id)
    print(f"Response: {response}")
except Exception as e:
    print(f"Error sending image result: {e}")

# Initialize WebSocket connection
def example_callback(data):
    print(f"Received data: {data}")
    return {"status": "processed"}

sdk.init_callbacks(example_callback)
try:
    sdk.init_socket(base_url, api_key, application_id, prompt_id)
except Exception as e:
    print(f"Error initializing WebSocket: {e}")

# Close the WebSocket connection
sdk.close_socket()

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

goman_live_sdk-0.1.10.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

goman_live_sdk-0.1.10-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file goman_live_sdk-0.1.10.tar.gz.

File metadata

  • Download URL: goman_live_sdk-0.1.10.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for goman_live_sdk-0.1.10.tar.gz
Algorithm Hash digest
SHA256 59ac3a2f75d00dbe2ed888cd9195bf56b625b439aa75e4a2f0f6e501bb50e7f6
MD5 7780c0b43522b1a67d3bb6131a42054c
BLAKE2b-256 d869292f8fc89df98be70671dca9697b6084ad1a6f0776edf4aa33519f834a3b

See more details on using hashes here.

File details

Details for the file goman_live_sdk-0.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for goman_live_sdk-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 0d1a2141bab84a4ae64ea3c6e1fd887b68a11f14d6668c6f25243e4c6e3e7eeb
MD5 8b098f4556d6362755faca4ae324824c
BLAKE2b-256 52e01f9f0728f245c14fde083ca866376f402553b9601a01c5d15244e1647b16

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