praisonai-code — no wrapper import required.
praisonai-code answer without wrapper imports.
How It Works
Module Map
Quick Start
How It Works
The user asks about models; the agent queries the catalogue and credential helpers, then answers.The Four Modules
| Module | Public exports | Purpose |
|---|---|---|
praisonai_code.llm.catalogue | ModelCatalogue, ModelInfo | Discover and validate LLM models |
praisonai_code.llm.config | build_config_list | AutoGen-style [{model, base_url, api_key, api_type}] |
praisonai_code.llm.env | LLMEndpoint, resolve_llm_endpoint, default_model_for_available_provider | Resolve which model/endpoint to hit |
praisonai_code.llm.credentials | is_configured, inject_credentials_into_env, resolve_llm_endpoint_with_credentials | Credential gate for CLI startup |
How It Works
The user asks about models; the catalogue and credential gate resolve an endpoint, then the agent answers.Which Import Path Should I Use?
Backward Compatibility Guarantee
All four
praisonai.llm.* module paths still resolve — a sys.modules alias in the wrapper points at praisonai_code.llm.*. The unit test test_c5_backward_compat.py::test_module_identity asserts:praisonai.llm.catalogue is praisonai_code.llm.cataloguepraisonai.llm.config is praisonai_code.llm.configpraisonai.llm.env is praisonai_code.llm.envpraisonai.llm.credentials is praisonai_code.llm.credentials
Standalone Smoke Test
This example runs in a venv with onlypraisonai-agents + praisonai-code installed (no wrapper):
Module Reference
praisonai_code.llm.catalogue
~/.praison/cache/models.json (TTL 3600s). Falls back to 14 curated models (OpenAI 5, Anthropic 3, Google 3, Groq 2, Ollama 1) when litellm is unavailable.
praisonai_code.llm.config
praisonai_code.llm.env
praisonai_code.llm.credentials
Best Practices
Use praisonai_code.llm.* for new standalone scripts
Use praisonai_code.llm.* for new standalone scripts
New scripts that target the
praisonai-code package should import from praisonai_code.llm.* to avoid taking a dependency on the wrapper:Do not migrate existing praisonai.llm.* imports
Do not migrate existing praisonai.llm.* imports
Existing code using
from praisonai.llm.catalogue import ModelCatalogue works without change — the shim guarantees module identity. Migration has no functional benefit.Check is_configured() before calling agents in CLI scripts
Check is_configured() before calling agents in CLI scripts
Use
is_configured() as a fast gate before running an agent — it checks env vars and the credential store without making any network calls:Configuration Options
ModelCatalogue Python Reference
Python configuration options for ModelCatalogue
LLMEndpoint Python Reference
Python configuration options for LLMEndpoint
Related
Model Catalogue
CLI commands for models list, describe, validate
AutoGen Config List
Build AutoGen config_list from the resolved endpoint
LLM Endpoint Config
Endpoint precedence and provider routing
PraisonAI Code CLI
The standalone CLI runtime these modules power
Package Boundaries (C7.1)
Three-tier ownership and the
_wrapper_bridge pattern
