Quantum LLM Client
quantum-llm-client is a Python client library designed to interact with OpenAI-compatible LLM server endpoints. It incorporates built-in prompt management using YAML configurations and features an automated financial advisor persona with response latency tracking.
Features
- OpenAI-Compatible Integration: Connect easily to any LLM server serving OpenAI-compatible endpoints.
- Prompt Management: Centralized YAML configuration (
client_prompts.yml) for managing system instructions and user templates. - Financial Advisor Persona: Pre-configured system prompts enforcing domain-specific guardrails.
- Latency Tracking: Automatically computes and returns the execution latency (in seconds) for each API call.
- Robust Error Handling: Gracefully catches API and unexpected exceptions without crashing execution.
Installation
Using pip
pip install quantum-llm-client
Using uv
uv pip install quantum-llm-client
Quickstart
from quantum_llm_client.qa_service import QAService
# Initialize the service with your endpoint's base URL
client = QAService(base_url="http://localhost:8000/v1")
# Query the client
query = "What is the difference between a stock and a bond?"
response, latency = client.generate_answer(query)
print(f"Response:\n{response}")
print(f"\nLatency: {latency:.4f} seconds")
Architecture & Components
1. QAService (qa_service.py)
Main entry point for handling chat completion requests.
__init__(base_url: str): Sets up the underlying OpenAI client using the supplied endpoint URL.generate_answer(query: str, temperature: float = 0.1) -> tuple[str, float]: Formats system and user prompts, executes the request against the server, and returns a tuple containing:response_content: The generated text response string or an error message.latency: The execution duration in seconds.
2. PromptManager (prompt_manager.py)
Utility class responsible for loading and rendering prompt templates from client_prompts.yml.
get_prompt(prompt_name: str) -> str: Fetches the raw template for a given key.format(prompt_name: str, **kwargs) -> str: Injects variable parameters (e.g.,{input}) into template placeholders.
3. Prompt Configuration (client_prompts.yml)
Stores system instructions and user prompt templates:
system_prompt: Sets the model role as a specialized financial advisor with strictly enforced boundaries.prompt_template: Wraps the user query with execution instructions.
Metadata
Release files for quantum-llm-client 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| quantum_llm_client-0.1.2.tar.gz | 4.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| quantum_llm_client-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.6 kB
Release files / quantum_llm_client-0.1.2.tar.gz
| Download URL | quantum_llm_client-0.1.2.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aaa6ee52b080cb9739f1d8cdaa5b944a17bfe0c9fbeacef13ddfe0ce729a2e90
|
|
BLAKE2b-256 checksum How to use checksums |
67160a1879674b75d2299194da6970f9e901dc30fbce3e100a610fc85247e970
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.5
|
Release files / quantum_llm_client-0.1.2-py3-none-any.whl
| Download URL | quantum_llm_client-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f20f714e131ed148735706f6494f9a5d95770c48a5df72066bc5f2a4497b95eb
|
|
BLAKE2b-256 checksum How to use checksums |
b1ff1d28c1505214b344b6faf69774c31ae37501d6c6086a01c4589d9dbf3142
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.5
|
Security for quantum-llm-client 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.