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
- Clone or download this repository to your local machine.
- Install Poetry if you haven't already (see Poetry Installation).
- In the project root (where
pyproject.tomlis located), run:poetry installThis 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
- Create a
tests/folder (if it doesn't exist) and add your test files (e.g.,test_client.py). - Run tests with:
poetry run pytest
- Use mocks or a dedicated test environment to avoid modifying production data during tests.
Contributing
- Fork this repository.
- Create a feature branch for your changes.
- Submit a Pull Request.
License
This project is provided under the MIT License.
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
coresight_sdk-1.0.1.tar.gz
(4.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df93d5b9152553daf01ef8654c7aed1f2a53db227761e699c49014d6956d7864
|
|
| MD5 |
b7db481b85f4e2b018cbfd79ce0d693e
|
|
| BLAKE2b-256 |
d7f1bf7951d2ff1b07f3d9015c9d2377367859aa19d2a0dcab4034a1f91c0008
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e9f2f20a96775af12ab3050c88e1c7f2692e69efb789e68ff97464b506102ab
|
|
| MD5 |
354a44bff3db46f4c98f905f68146f2b
|
|
| BLAKE2b-256 |
e7ec3f0c910dd79a8f08d272796a236db152d7dba0a55c227e900324e942a57d
|