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.2.0.tar.gz (32.4 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.2.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gseai-1.2.0.tar.gz
  • Upload date:
  • Size: 32.4 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.2.0.tar.gz
Algorithm Hash digest
SHA256 831212adbe12f7808d4683078e39f901c243f555702b905d66e7e8dadd48bc11
MD5 fcc87e15d80b5271208ff9085574ea77
BLAKE2b-256 bbd0e756707a5203b8420832a621a04a419089d23dec3ab639fb332627200aa8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gseai-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ab98d43a730ea8f128acd0a4b80bfc0999425935d1f0e0a23590a00ef5b9a0f
MD5 93273bb257dedd5c24ad365e68ae8d89
BLAKE2b-256 2f54ee0474e219278ae62dcf4a00a5093add26e1cbe0e5b07fe9f3f07b64f868

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