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 byllmVerified import paths — ran on the pinned version, not inferred.
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.
Always review the latest GitHub releases and documentation when upgrading. Pin exact versions of `byllm` in your `requirements.txt` to prevent unexpected breaking changes.
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`.
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.