Skip to main content

Python client for the GSE AI LocalAI server

Project description

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>

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

gseai-1.3.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.3.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gseai-1.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 68e9982ecb1fd5dc6280f172085f1e882d7c1754cda9b25719029dad44f5c0e0
MD5 0c4e1bd7f8b4194de6cad7c51902cc80
BLAKE2b-256 2b06f9029b5a537a909f8b89afd410c175b85f6f35bed736c6372eff0c6ed8f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gseai-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 10ce06acad47ae33a5a6c809594a1f58a0df0e6dc5c676eb311a77e56f6a8882
MD5 263e2267c6d1f2ba9ed4d07451fac91c
BLAKE2b-256 8a260d0d5373728ff150de8cc1e2f4a8fb5bf3f5142624078d7a4d7a7a632ec5

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