Skip to main content

API Wrapper for Xytext - LLM Interfaces for Production.

Project description

xytext

xytext is a Python client library for interacting with the Xytext API. It offers a simple way to send requests to the Xytext API and handle responses effectively. This package is designed to integrate Xytext API functionalities into Python applications.

Installation

Install xytext using pip:

pip install xytext

Usage

To use xytext, you must have your Xytext API credentials: FUNC_ID, STAGE, and AUTH_TOKEN. These credentials are necessary to authenticate your requests.

Example

from xytext import Xytext, XytextResponse

def example_usage():
    func_id = "your_func_id"
    stage = "your_stage"
    auth_token = "your_auth_token"

    xt = Xytext(func_id, stage, auth_token)
    try:
        response = xt.invoke("Your input text here")
        print(response.result)
    except Exception as e:
        print("Error:", str(e))

example_usage()

API Reference

Xytext

This is the primary class used to interact with the Xytext API.

Constructor

Xytext(func_id, stage, auth_token)

Parameters:

func_id (String) The function ID for the Xytext API.

stage (String) The stage of the API environment ("staging", "prod").

auth_token (String) Your authorization token for the Xytext API.

timeout (Integer) The timeout for the API request in seconds. Default is 900 seconds (15 minutes).

Methods

invoke(input_text) Sends a request to the Xytext API.

Parameters:

input_text (String) The text input for the API.

Returns: An instance of XytextResponse.

XytextResponse

This class represents the response received from the Xytext API.

Properties raw_response The complete response from the API as a Python dictionary.

success Boolean indicating if the API request was successful.

message A message from the API, typically containing error details if any.

usage Details about the usage of the API for this call.

call_id A unique identifier for the API call.

result The content returned by the API, either as a Python object or a string.

Additional Information

Keep your API credentials secure. Avoid exposing them in client-side code. Utilize environment variables to safeguard your auth token. Properly handle API responses and exceptions in your application to ensure robustness.

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

xytext-1.0.5.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

xytext-1.0.5-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file xytext-1.0.5.tar.gz.

File metadata

  • Download URL: xytext-1.0.5.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for xytext-1.0.5.tar.gz
Algorithm Hash digest
SHA256 a6ea8a931a36119383de903cac59dc0c2c73e4ef585cbfe8f7506a29150473dc
MD5 8038558529841ef07d33ac7ce1f93d17
BLAKE2b-256 59f56f450892d19e2faffe5bd732ae3e47886a5f47ce15e182e6ab8c7f907bd7

See more details on using hashes here.

File details

Details for the file xytext-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: xytext-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for xytext-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d446cbbfbb0269328b2ba69872350a23b01d72a29f1b384c89e3b464ce0c1560
MD5 2be924c645160f75aba95af2b1519751
BLAKE2b-256 d9323c2b3b7936572ebdec127c40769411ad1727027d3f7a6467d191ec0fdd62

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