Skip to main content

Python SDK for the CoreSight API

Project description

Coresight Python SDK

This Python SDK (coresight_sdk) provides a convenient interface to the Multi-Tenant Messaging API as defined by the provided openapi.yaml. It supports:

  • Client Management: Create, retrieve, and update client information.
  • User Management: Create and retrieve both anonymous and authenticated users.
  • Threads & Messages: Create new threads, post messages, and retrieve message history.
  • Feedback: Provide feedback on messages.
  • LLM Chat: Interact with a Large Language Model endpoint.
  • Subscriptions: Manage subscriptions, create, update, and cancel.

Installation

  1. Clone or download this repository to your local machine.
  2. Install Poetry if you haven't already (see Poetry Installation).
  3. In the project root (where pyproject.toml is located), run:
    poetry install
    
    This installs all dependencies in a virtual environment and makes the SDK available for import.

Usage

Basic Example

from coresight_sdk.client import CoresightClient

# 1. Initialize the SDK client
client = CoresightClient(
    base_url="https://myapi.execute-api.myregion.amazonaws.com/Prod",
    api_key="YOUR_API_KEY"  # Optional but required for endpoints needing x-api-key
)

# 2. Sign up a new client
signup_response = client.sign_up(
    name="John Doe",
    email="[email protected]",
    password="Secret123",
    package="Free"  # one of "Free", "Basic", "Premium"
)
print("Sign-up response:", signup_response)

# 3. Log in an existing client
login_response = client.login(
    email="[email protected]",
    password="Secret123"
)
print("Login token:", login_response.get("token"))

# 4. Create a new thread (requires valid x-api-key)
thread_response = client.create_thread(client_id=signup_response["client_id"])
print("New thread:", thread_response)

# 5. Create a message in the thread
message_response = client.create_message(
    client_id=signup_response["client_id"],
    thread_id=thread_response["thread_id"],
    user_input="Hello, I'd like some help with an issue."
)
print("Message created:", message_response)

Additional Endpoints

  • Clients: get_client, update_client
  • Anonymous Users: create_anonymous_user, get_anonymous_user
  • Authenticated Users: create_authenticated_user, get_authenticated_user
  • Threads: create_thread, get_thread
  • Messages: create_message, get_message, get_thread_messages
  • Feedback: add_feedback, get_feedback
  • LLM Chat: chat_with_llm
  • Subscriptions: create_subscription, update_subscription, cancel_subscription

Testing

  1. Create a tests/ folder (if it doesn't exist) and add your test files (e.g., test_client.py).
  2. Run tests with:
    poetry run pytest
    
  3. Use mocks or a dedicated test environment to avoid modifying production data during tests.

Contributing

  1. Fork this repository.
  2. Create a feature branch for your changes.
  3. Submit a Pull Request.

License

This project is provided under the MIT License.

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

coresight_sdk-1.0.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

coresight_sdk-1.0.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file coresight_sdk-1.0.1.tar.gz.

File metadata

  • Download URL: coresight_sdk-1.0.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.11.11 Linux/6.8.0-1020-azure

File hashes

Hashes for coresight_sdk-1.0.1.tar.gz
Algorithm Hash digest
SHA256 df93d5b9152553daf01ef8654c7aed1f2a53db227761e699c49014d6956d7864
MD5 b7db481b85f4e2b018cbfd79ce0d693e
BLAKE2b-256 d7f1bf7951d2ff1b07f3d9015c9d2377367859aa19d2a0dcab4034a1f91c0008

See more details on using hashes here.

File details

Details for the file coresight_sdk-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: coresight_sdk-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.11.11 Linux/6.8.0-1020-azure

File hashes

Hashes for coresight_sdk-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3e9f2f20a96775af12ab3050c88e1c7f2692e69efb789e68ff97464b506102ab
MD5 354a44bff3db46f4c98f905f68146f2b
BLAKE2b-256 e7ec3f0c910dd79a8f08d272796a236db152d7dba0a55c227e900324e942a57d

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