Skip to main content

Stax.ai CX Service SDK

Project description

Stax.ai CX Service SDK

This project is created and maintained by Stax.ai, Inc.. This is proprietary to Stax.ai, Inc. Unauthorized use, copy, license, or modification of this project and all associated source code is strictly prohibited.

About

...coming soon...

Installation

pip install stax_cx_service_sdk

Usage

Write your service app

from os import getenv
from stax_cx_service_sdk import def_service

# This is the internal token for cross-internal system communication
@def_service(getenv('INTERNAL_KEY'))
def app(**kwargs):
    '''
    Your custom service.
    - kwargs is a dictionary with arguments sent to the service.

    Return an optional string representing the message to log.
    If there is an error, raise an exception with a nice human-readable error message to show up on the log.
    '''

    # Put your service functionality here
    # ...

    # Raise an exception to report the error
    raise Exception("Oops, something went wrong!")

    # Return without an exception to complete

Testing your service

To test your automation, simply comment out the @def_service line and call the app function with the appropriate input arguments.

Deploy your service

  1. Navigate to the Project CX Google Cloud topic.
  2. Create a Pub/Sub topic with the name: service-{NAME}, for example service-generate-client-summary.
  3. Create a Cloud Function with the same name as the Pub/Sub topic.
  4. Set the trigger type to Cloud Pub/Sub.
  5. Pick the previously created Pub/Sub topic.
  6. Select the appropriate memory, CPU, timeout, and concurrency settings.
  7. Select the App Engine default service account.
  8. Add the runtime environment variable: INTERNAL_KEY.
  9. Ensure your entry file is called main.py and that you have a requirements.txt file with your dependencies.
  10. Load your source code as a ZIP and configure the function appropriately (make sure the entry-point is set.)
  11. Test your function, and deploy it!

Using your service

In the API, use the auto package to publish messages to the appropriate Pub/Sub topic created earlier to send a request to the service.

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

stax_cx_service_sdk-0.0.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

stax_cx_service_sdk-0.0.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file stax_cx_service_sdk-0.0.1.tar.gz.

File metadata

  • Download URL: stax_cx_service_sdk-0.0.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.5

File hashes

Hashes for stax_cx_service_sdk-0.0.1.tar.gz
Algorithm Hash digest
SHA256 bb07f914307edd0756aeec72158ea7b1c126dbe858e87628d8a55497400c2a49
MD5 9a41c05f620f3783542c8c57872d7289
BLAKE2b-256 567380d763d93a00ad382864503f8203c93e90c0a8f0b3ef7faebd3c32d701b2

See more details on using hashes here.

File details

Details for the file stax_cx_service_sdk-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for stax_cx_service_sdk-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d1ecf7f8625cbd0ae493aee3f6e164d21557cacaff2a41ae0685f28c4b365f73
MD5 654a4330c5dfe2e5120259a36df1cfc0
BLAKE2b-256 984504cf6bd9ceaf5ddb4dfa4a8d7247f90d9003c68840a519d189e8704c4e41

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page