Simple, self-contained examples showing how to use an OpenAI-compatible API for various AI tasks. The scripts work with OpenAI directly or any other OpenAI-compatible endpoint (vLLM, LLM Factory, etc.) — just point config.ini at your server and pick your model IDs.
pip install -r requirements.txt
config.ini.example to config.ini[API] section (LLM Factory keys are issued at https://llm-factory.ai.uky.edu/api-keys)[MODELS] section ships with the models currently served by the example LLM Factory endpoint (https://api-llm-factory.ai.uky.edu/v1). Using a different OpenAI-compatible server? Update the base URL and model IDs — run python test_models_endpoint.py to list what it offers (each entry includes a task field indicating what the model is for).chat_completions_test.py – Chat with a language modelstream_test.py – Stream chat responses token by tokentools_test.py – Use tool-augmented language models (function calling)vision_test.py – Process images with multimodal modelsembeddings_test.py – Create vector embeddings from textsimple_rag.py – Implement a basic RAG (Retrieval-Augmented Generation) system with FAISStranscriptions_test.py – Generate transcriptions from audio files (uses the included fitnessgram.mp3 sample)test_tts.py – Generate speech from text (writes test_<voice>.mp3 files)test_models_endpoint.py – List the models available on the configured serverdecisions_test.py – Probe the decisions endpoints (/v1/systemone Nimble / TypeSafe System One and /v1/decisions OpenAI Decisions format) and report whether they work on the configured serverquota_test.py – Probe rate-limit/quota behavior (HTTP 429s, Retry-After and X-RateLimit headers, /quotas/me) if your server implements itRun each script after configuring to test different capabilities of the API.
Imported from gh:Kentucky-Open-Science/llm-basics. Source last updated 2026-11-05. Synced 2026-11-05.
Source code on GitHub.
This repository contains simple examples showing how to use the OpenAI API to communicate with LLM Factory Endpoints for various AI tasks.
config.ini.example to config.ini and add your API key to the openai_api_key field* chat_completions_test.py - Chat with a language model
* embeddings_test.py - Create vector embeddings from text
* transcriptions_test.py - Generate transcriptions from audio files
* vision_test.py - Process images with multimodal models
* tools_test.py - Use tool-augmented language models
* simple_rag.py - Implement a basic RAG (Retrieval-Augmented Generation) system
Run each script after configuring to test different capabilities of the LLM Factory API.