Skip to main content

GSE AI Server API

This package provides an API for connecting to UB GSE's AI server (powered by LocalAI). See the Computational Literacies Lab handbook page for details about the server.

The documentation provides details on using the API.

Quickstart

from gseai import GSEAIServer

with GSEAIServer("your-api-token") as server:
    # List available models
    models = server.list_models()

    # Simple single-turn chat
    response = server.chat("model-id", "What is machine learning?")

    # Multi-turn chat using the OpenAI-compatible API
    response = server.chat_completions(
        "model-id",
        messages=[{"role": "user", "content": "What is machine learning?"}],
    )

Job queue

Large models can take longer than the server's HTTP timeout to respond. The job queue lets you submit a request and collect the result later — no need to keep a connection open.

from gseai import GSEAIServer

with GSEAIServer("your-api-token") as server:
    # Submit a job and get an ID immediately
    job = server.submit_job("my-job", "qwen2.5-coder", "Explain transformers.")
    job_id = job["job_id"]

    # Come back later and wait for it
    result = server.wait_for_job(job_id)
    print(result["result"])

    # File-in jobs (transcribe, image_edit, etc.)
    job = server.submit_file_job("transcribe-lecture", "transcribe", "whisper-1", "lecture.mp3")

    # Binary-out jobs (speech, images) — fetch the file when done
    audio = server.get_job_result(job_id)
    open("output.mp3", "wb").write(audio)

The CLI supports the same workflow:

# Submit and walk away
gseai queue submit qwen2.5-coder "Explain transformers." -n my-job
# a3f1c7d2-...

# Check status, then fetch result when done
gseai queue status a3f1c7d2-...
gseai queue wait a3f1c7d2-...

# Or submit and wait in one step
gseai queue run qwen2.5-coder "Explain transformers." -n my-job

# File-in jobs
gseai queue upload whisper-1 lecture.mp3 --job-type transcribe -n lecture
gseai queue wait <job-id>

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gseai-1.4.0.tar.gz (34.5 kB view details)

Uploaded Source

Built Distribution

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

gseai-1.4.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file gseai-1.4.0.tar.gz.

File metadata

  • Download URL: gseai-1.4.0.tar.gz
  • Upload date:
  • Size: 34.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.4 {"installer":{"name":"uv","version":"0.11.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gseai-1.4.0.tar.gz
Algorithm Hash digest
SHA256 bbcb2b456d3ae6716bf702281bea0d0044cab74802940f15826cafbc3dd48d2c
MD5 0bd3715f41bdc3b65c00a6b4830b89d0
BLAKE2b-256 4daea457c6c6a3002daf8dd3806956299767c7e634ffd7e3e0acf3d7eb18c3d9

See more details on using hashes here.

File details

Details for the file gseai-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: gseai-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.4 {"installer":{"name":"uv","version":"0.11.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gseai-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8bd063f978b8f0ab9d85532bd5ed88853a59f1094e55090141b713ca6aacd447
MD5 4ca1299d98386ce2954427ee85e5482c
BLAKE2b-256 ba9b2cea161abd693259b0ab0f44e0fa3514a2c0b545481caadf83cb1759d142

See more details on using hashes here.

Release history Release notifications | RSS feed

1.5.0

2 files

This release

1.4.0 This release

2 files

1.3.0

2 files

1.2.0

2 files

1.0.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page