No project description provided
Project description
vaklm
Easy interaction with OpenAI-compatible LLM endpoints.
No more client.chat.completions.create verbosity!
Installation
pip install vaklm
Usage
from vaklm import vaklm, VAKLMException
print("Non-streaming example:")
try:
response = vaklm(
endpoint="http://localhost:11434/v1/chat/completions",
model_name="llama3.2:latest",
user_prompt="Write a short story about a cat.",
system_prompt="You are a creative writer.",
api_key="YOUR_API_KEY",
temperature=0.7
)
print(response)
except VAKLMException as e:
print(f"Error: {str(e)}")
from vaklm import vaklm
print("\nStreaming example:")
try:
for chunk in vaklm(
endpoint="http://localhost:11434/v1/chat/completions",
model_name="llama3.2:latest",
user_prompt="Write a short story about a cat.",
system_prompt="You are a creative writer.",
api_key="YOUR_API_KEY",
stream=True,
temperature=0.7
):
print(chunk, end='', flush=True)
except VAKLMException as e:
print(f"Error: {str(e)}")
# Note: When streaming, the function also accumulates any reasoning_content
# from the API response which can be accessed or processed as needed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
vaklm-0.2.6.tar.gz
(3.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
vaklm-0.2.6-py3-none-any.whl
(4.0 kB
view details)
File details
Details for the file vaklm-0.2.6.tar.gz.
File metadata
- Download URL: vaklm-0.2.6.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7863389102fbea613306317a189355bcfc4fbfd9eff0acefffc13062ae7b509f
|
|
| MD5 |
738aed0feba79f5928ff3796b0495f3a
|
|
| BLAKE2b-256 |
2140270ad265c8f4eafe450edf2dd2f705321020cdb0273732c802bf107dfde9
|
File details
Details for the file vaklm-0.2.6-py3-none-any.whl.
File metadata
- Download URL: vaklm-0.2.6-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f80401cec075fe4877963d5eee4f72d7016cc80bbc90faabccf4c0616e17082
|
|
| MD5 |
9667df53c2225ad1d4c99b424512d11b
|
|
| BLAKE2b-256 |
b337472e7f22dc029cdec6df3d73cdffbdba1a8d98bce1a8f70ee1ba1e66e973
|