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.2.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.2-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coresight_sdk-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 5b66552122697bbe71fcd7efd398e485ec009581d3e0000c47b504c63bf077d9
MD5 6715e7ce652b3e081feb90b76c899bd6
BLAKE2b-256 12f03b74aa6dd9b3188d0a17ddce67d0bf40b6016b81d254639f44f3096c942b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: coresight_sdk-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e618a99a8581a4faefe895becc394f4a4a0d3f8232dbc62e2ff8f1f8ae6e5b2d
MD5 df88ad17e442b9179b39dbce4ec3aa44
BLAKE2b-256 3e6169675a75fd27cbfee5a83035ba06367300a727f84cb5e0eef55c68a64951

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