Registry / llm-agents / byllm
library0.6.16pypypiunverified

byLLM (byllm) is a Python library providing a unified API for interacting with various Large Language Model (LLM) providers like OpenAI, Anthropic, Ollama, and Google Gemini. It simplifies LLM integration, abstracting away provider-specific client libraries and response formats. Currently at version 0.6.4, it is part of the Jaseci ecosystem and undergoes frequent updates, often alongside releases of `jaclang` and `jaseci` itself, targeting Python 3.11+.

pip install byllm
INSTALL
IMPORT
SIG · BYLLM
B
byllm
llm-agentspythonv0.6.16
Install
18.1s avg
Import
Disk
434MB
Pass rate
3/ 10
Env Coverage3 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.4.20 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✕ build_error
py 3.11
✕ build_error
✓ 20.63s
py 3.12
✕ build_error
✓ 16.93s
py 3.13
✕ build_error
✓ 16.6s
py 3.9
✕ build_error
✕ build_error
434MB installed
● package 434MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

OpenAI
from byllm.providers.openai import OpenAI
Anthropic
from byllm.providers.anthropic import Anthropic
Ollama
from byllm.providers.ollama import Ollama
LLMProvider
from byllm.providers.llm_provider import LLMProvider
from byllm import LLMProvider
Base class is in a submodule, not directly under `byllm`.

This quickstart demonstrates how to initialize the OpenAI provider, generate text, and use chat completion. It emphasizes retrieving API keys from environment variables and includes basic error handling. Remember to install `byllm[openai]` for this example.

import os from byllm.providers.openai import OpenAI # Set your OpenAI API key as an environment variable: # export OPENAI_API_KEY="your_key_here" openai_key = os.environ.get("OPENAI_API_KEY") if not openai_key: print("Warning: OPENAI_API_KEY environment variable not set. Requests will likely fail.") openai_key = "sk-dummy" # Use a dummy key to allow instantiation try: llm = OpenAI(api_key=openai_key, model_name="gpt-3.5-turbo") # Example: Generate text prompt = "What is the capital of France?" response = llm.generate(prompt=prompt, max_tokens=50) print(f"Generated text: {response.text}\n") # Example: Chat completion messages = [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Tell me a short story about a brave knight."} ] chat_response = llm.chat(messages=messages, max_tokens=100) print(f"Chat response: {chat_response.text}\n") except Exception as e: print(f"An error occurred: {e}") print("Please ensure your API key is correct and the model name is valid.")
Debug
Known issues
breakingAs a pre-1.0.0 library (currently 0.6.4), `byllm`'s API and internal structure are subject to significant changes between minor versions. Upgrading without checking release notes might lead to `ImportError` or `AttributeError` for provider classes or method signatures.
fix
Always review the latest GitHub releases and documentation when upgrading. Pin exact versions of `byllm` in your `requirements.txt` to prevent unexpected breaking changes.
affects: <1.0.0
gotcha`byllm` relies on various upstream LLM client libraries (e.g., `openai`, `anthropic`). If your project uses other packages that require different versions of these underlying clients, dependency conflicts can arise, leading to unexpected behavior or `ImportError`s from the core client libraries.
fix
Use a dedicated virtual environment for `byllm` projects. If conflicts occur, try installing `byllm` with specific provider extras (e.g., `pip install byllm[openai]`) and resolve conflicts by carefully managing your `requirements.txt`.
affects: All versions
gotchaMost LLM providers require an API key for authentication. While `byllm` allows passing `api_key` directly, it primarily expects keys to be set as environment variables (e.g., `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`). Forgetting or misconfiguring these will result in authentication failures.
fix
Ensure the correct API key is set as an environment variable before running your application (e.g., `export OPENAI_API_KEY='your_secret_key'`). For development, consider using `python-dotenv` to load keys from a `.env` file.
affects: All versions
Upgrade
Version history
0.6.16latest on PyPI · released Jun 16, 2026
Audit
Dependencies
anthropicoptionalRequired for using the Anthropic LLM provider.
openaioptionalRequired for using the OpenAI LLM provider.
ollamaoptionalRequired for using the Ollama LLM provider.
cohereoptionalRequired for using the Cohere LLM provider.
google-generativeaioptionalRequired for using the Google Generative AI LLM provider.
togetheroptionalRequired for using the Together AI LLM provider.
python-dotenvoptionalUseful for loading environment variables (e.g., API keys).
Agent activity
28 hits · last 30 days
node
24
OpenAI (training)
1
Resources