Skip to main content

Python SDK for ArtaSupport TSE copilot and batch APIs.

Project description

artasupport Python SDK

artasupport is a Python SDK for ArtaSupport TSE APIs (copilot and batch).

Requirements

  • Python 3.10+
  • An API key (arta_live_...)
  • Backend base URL (http://localhost:8000 or your deployed URL)

Install

pip install artasupport

Local development install:

pip install -e .

Environment setup

export ARTASUPPORT_API_KEY="arta_live_...<secret>"
export ARTASUPPORT_BASE_URL="http://localhost:8000"

You can also pass api_key= and base_url= directly in code.

How it works

Each SDK call:

  1. Builds auth headers (x-api-key + Bearer)
  2. Sends request to backend (/api/tse, /v1/models, /v1/sessions, /api/ingest)
  3. Parses typed response (text, session_id, usage, next_steps, etc.)
  4. Raises typed exceptions for API/network/config errors

Usage mode 1: Quick one-shot calls

Use top-level helper functions for simple scripts.

from artasupport import tse_copilot, tse_batch

resp = tse_copilot(user_input="internet is slow")
print(resp.text)

resp2 = tse_batch(text="summarize tunnel issue")
print(resp2.text)

Usage mode 2: Sync conversation with context

Use ArtaSupportMessage when you want multi-turn chat. Conversation context is tied to session_id.

from artasupport import ArtaSupportMessage

with ArtaSupportMessage() as client:
    sid = client.create_session().session_id

    r1 = client.tse_copilot(user_input="internet is slow", session_id=sid)
    r2 = client.tse_copilot(user_input="only one location affected", session_id=sid)

    print(r1.text)
    print(r2.text)

    # optional cleanup
    client.delete_session(sid)

Usage mode 3: Async conversation

Use AsyncArtaSupportMessage in async apps.

import asyncio
from artasupport import AsyncArtaSupportMessage

async def main():
    async with AsyncArtaSupportMessage() as client:
        sid = (await client.create_session()).session_id
        r = await client.tse_batch(user_input="summarize issue", session_id=sid)
        print(r.text)

asyncio.run(main())

AsyncArtaSupportMessage is non-blocking async I/O, not token streaming.

Usage mode 4: File ingestion

Upload PDF or Excel files for runbook extraction and cases ingestion.

from artasupport import tse_ingest

# Quick one-shot upload
response = tse_ingest("runbook.pdf")
print(response.status)  # "completed" or "processing"

# With explicit client
from artasupport import ArtaSupportMessage

with ArtaSupportMessage() as client:
    response = client.tse_ingest("cases.xlsx")
    print(f"Ingestion {response.status}")

Async version:

import asyncio
from artasupport import AsyncArtaSupportMessage

async def upload_file():
    async with AsyncArtaSupportMessage() as client:
        response = await client.tse_ingest("runbook.pdf")
        print(f"Status: {response.status}")

asyncio.run(upload_file())

Supported file types: .pdf, .xlsx, .xls Folders are not supported; tse_ingest(...) expects a single file path.

Input styles

For tse_copilot(...) and tse_batch(...), provide exactly one of:

  • user_input="..."
  • text="..."
  • message="..."
  • messages=[{"role": "user", "content": "..."}]

Error handling

from artasupport import (
    ArtaSupportMessage,
    APIError,
    AuthenticationError,
    RateLimitError,
)

try:
    with ArtaSupportMessage() as client:
        resp = client.tse_copilot(user_input="help", session_id="sess_...")
except AuthenticationError as exc:
    print("Invalid/revoked API key:", exc)
except RateLimitError as exc:
    print("Rate limited:", exc)
except APIError as exc:
    print("API failure:", exc.status_code, exc.request_id, exc.message)

API surface

  • Top-level helpers:
    • tse_copilot(...)
    • tse_batch(...)
    • tse_ingest(file_path)
  • Sync client:
    • ArtaSupportMessage
    • list_models(), create_session(), delete_session()
    • tse_copilot(...), tse_batch(...), tse_ingest(file_path)
  • Async client:
    • AsyncArtaSupportMessage
    • await list_models(), await create_session(), await delete_session()
    • await tse_copilot(...), await tse_batch(...), await tse_ingest(file_path)

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

artasupport-0.1.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

artasupport-0.1.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file artasupport-0.1.0.tar.gz.

File metadata

  • Download URL: artasupport-0.1.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for artasupport-0.1.0.tar.gz
Algorithm Hash digest
SHA256 aff9367ccbb4428212aa1a4f2fb7005649bd523cd9bc7fb547d64a52a5a98c73
MD5 03dee1b4b1a1f5a00f00a9fade3e5c14
BLAKE2b-256 088174b61270cdfed131edf92fe1007527a4a426ba676e0c406f5079f979f247

See more details on using hashes here.

File details

Details for the file artasupport-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: artasupport-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for artasupport-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 616b622333e1ec8406571db67fa03fddb3779426cbdeb284b761307af3e269b4
MD5 f9a07c5bbc6fd950fce61096c8ed5e2a
BLAKE2b-256 9ffa89c08fe42df01cb81b1a0ab76e25f772a578c4fb578e02284212ae60f278

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