Streamline LLM Interactions in Python
Installation
pip install llmdk
Basic Usage
Client
from llmdk import Llmdk, Providers
# You can also set OPENAI_API_KEY
client = Llmdk(
provider=Providers.OPENAI,
model_name='gpt-4o-mini',
# api_key='***',
)
Generate
Prompt
output = client.generate(
'Who are you?',
# system='Write in Portuguese.',
)
List of messages
output = client.generate(
messages=[
# {'role': 'system', 'content': 'Write in Portuguese.'},
{'role': 'user', 'content': 'Who are you?'},
],
)
Stream
Prompt
for chunk in client.stream(
'Who are you?',
# system='Write in Portuguese.',
):
print(chunk, end='', flush=True)
List of messages
for chunk in client.stream([
# {'role': 'system', 'content': 'Write in Portuguese.'},
{'role': 'user', 'content': 'Who are you?'},
]):
print(chunk, end='', flush=True)
Supported Providers
Anthropic
from llmdk import Llmdk, Providers
# You can also set ANTHROPIC_API_KEY
client = Llmdk(
provider=Providers.ANTHROPIC,
model_name='claude-3-5-sonnet-20240620',
# api_key='***',
)
Groq
from llmdk import Llmdk, Providers
# You can also set GROQ_API_KEY
client = Llmdk(
provider=Providers.GROQ,
model_name='llama-3.1-70b-versatile',
# api_key='***',
)
HuggingFace
from llmdk import Llmdk, Providers
# You can also set HF_TOKEN
client = Llmdk(
provider=Providers.HUGGINGFACE,
model_name='meta-llama/Meta-Llama-3.1-70B-Instruct',
# api_key='***',
)
Ollama
from llmdk import Llmdk, Providers
client = Llmdk(
provider=Providers.OLLAMA,
model_name='llama3.2:1b',
# base_url='http://localhost:11434',
)
OpenAI
from llmdk import Llmdk, Providers
# You can also set OPENAI_API_KEY
client = Llmdk(
provider=Providers.OPENAI,
model_name='gpt-4o-mini',
# api_key='***',
)
Metadata
Release files for llmdk 1.2410.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llmdk-1.2410.3-py3-none-any.whl | Python 3 | none | any | Details for llmdk-1.2410.3-py3-none-any.whl |
Release files / llmdk-1.2410.3-py3-none-any.whl
| Download URL | llmdk-1.2410.3-py3-none-any.whl |
|---|---|
| Size | 32.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c47601dc140b7b4aa46bed977d73436ecd59f1abb556f867dca969df09c7744
|
|
BLAKE2b-256 checksum How to use checksums |
b7aef2b1a7c28cfc03169dc59ad400d0053f04bfb737b8ecda94840a591210be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Security for llmdk 1.2410.3
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.