LLMQuiver
English | 简体中文
The auxiliary tool is used to invoke the online LLM service API, supporting local caching, prompt rendering, and configuration management.
Supported
- Support Openai/Azure LLM service providers (or openai-compatible service providers).
- Support vllm service.
- Local caching (based on sqlite).
- Prompt rendering (based on toml file).
- Configuration management (based on toml file).
To Be Done
- Multi service provider support.
Installation
pip install llm-quiver
Basic Usage
1. Direct Call Mode
Assuming you have a configuration file path/to/gpt.toml, you need to fill in your own API_KEY, content as follows:
API_TYPE = "azure_openai"
API_BASE = "https://endpoint.openai.azure.com/"
API_VERSION = "2023-05-15"
API_KEY = "********************************"
MODEL_NAME = "gpt-4o-20240513"
temperature = 0.0
max_tokens = 4096
enable_cache = true
cache_dir = "oai_cache"
Running code:
from llm_quiver import LLMQuiver
# Initialize
llm = LLMQuiver(
config_path="path/to/gpt.toml",
)
# Text generation mode
prompt_values = ["Who are you?"]
responses = llm.generate(prompt_values)
# Default role is system
# ["I am an AI assistant developed by OpenAI, designed to help answer questions, provide information, and complete various tasks. How can I help you?"]
# Chat mode
messages = [[{"role": "user", "content": "Who are you?"}]]
responses = llm.chat(messages)
# ["I am an AI assistant developed by OpenAI, designed to help answer questions, provide information, and engage in conversations. Feel free to ask me anything!"]
2. Toml Template Call Mode
First, create a TOML template file, for example hello_world.toml:
[hello_world_template]
prompt = "Hello {name}, who are you?"
Then you can use it like this:
from llm_quiver import TomlLLMQuiver
# Specify template during initialization
llm = TomlLLMQuiver(
config_path="path/to/gpt.toml",
toml_prompt_name="hello_world_template",
toml_template_file="path/to/hello_world.toml"
)
# Pass template parameters
prompt_values = [dict(name="GPT")]
responses = llm.generate(prompt_values)
Configuration Guide
There are two ways to configure API keys and other parameters:
- Through environment variables:
Configuration can be loaded by passing parameter config_path="path/to/config.toml" or setting environment variable "export LLMQUIVER_CONFIG=path/to/config.toml". Parameters like API_TYPE, API_BASE, API_VERSION, API_KEY, MODEL_NAME can also be set in environment variables.
- Directly passing configuration file path:
llm = TomlLLMQuiver(
config_path="path/to/config.toml",
toml_prompt_name="template_name",
toml_template_file="path/to/template.toml"
)
Configuration file example:
API_TYPE = "azure_openai"
API_BASE = "https://endpoint.openai.azure.com/"
API_VERSION = "2023-05-15"
API_KEY = "********************************"
MODEL_NAME = "gpt-4o-20240513"
temperature = 0.0
max_tokens = 4096
enable_cache = true
cache_dir = "oai_cache"
Return Value Description
- Both generate() and chat() methods return a list of strings
- Each element corresponds to a response for one input prompt
Notes
- API key must be correctly configured before use
- Template files must comply with TOML format specifications
- Input parameters must correspond to placeholders in the template
Metadata
Release files for llm-quiver 0.3.8
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 | |
|---|---|---|---|---|
| llm_quiver-0.3.8.tar.gz | 22.5 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llm_quiver-0.3.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.1 kB
Release files / llm_quiver-0.3.8.tar.gz
| Download URL | llm_quiver-0.3.8.tar.gz |
|---|---|
| Size | 22.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
70158aadc840a42fcb1be0b60b7e71c524b4f81a76eb54bea3a7f63f1a0a0507
|
|
BLAKE2b-256 checksum How to use checksums |
79aed11d897e57707e7474dfac4164232c175fe1eca121c016a99f83a2ae895f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2025.
Transparency logRelease files / llm_quiver-0.3.8-py3-none-any.whl
| Download URL | llm_quiver-0.3.8-py3-none-any.whl |
|---|---|
| Size | 23.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
57593da10a37d87d508729341243a2826982ee051cdad17d83498512cc795e8e
|
|
BLAKE2b-256 checksum How to use checksums |
d0e2df9e19d9c137f17576d808bb94ca96b943dc7c0b18a880d904e3423bfab4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2025.
Transparency logSecurity for llm-quiver 0.3.8
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for llm_quiver-0.3.8.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2025.
Transparency logA 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.