Python SDK to call all LLM apis.
Project description
Unified LLM Python API Library
A unified interface for interacting with multiple LLM providers (OpenAI compatible only for now) with consistent API design.
Features
- Single interface for multiple LLM providers
- Standardized request/response formats
- Easy provider configuration
Basic Usage
Async call
DEEPSEEK_BASE_URL=https://api.deepseek.com
DEEPSEEK_API_KEY=sk-xxxx
from kissllm import LLMClient
from kissllm.tools import tool
# Example tool definition
@tool
def get_weather(location: str, unit: str = "celsius"):
"""Get current weather for a location"""
# Mock implementation
return f"Sunny 22°C in {location}"
# Initialize client with provider/model
client = LLMClient(provider_model="deepseek/deepseek-chat")
async def main():
# Basic async completion
response = await client.async_completion(
messages=[{"role": "user", "content": "What's the weather in Paris?"}],
tools=True,
tool_choice="auto"
)
print(response.choices[0].message.content)
# Async streaming
stream = await client.async_completion(
messages=[{"role": "user", "content": "What's 15*27?"}],
stream=True,
tools=[{
"type": "function",
"function": {
"name": "calculate",
"description": "Calculate math expressions",
"parameters": {
"type": "object",
"properties": {
"expression": {"type": "string"}
}
}
}
}]
)
print("\nStreaming response:")
async for chunk in stream.iter_content():
print(chunk, end="")
# Continue with tool results
if response.tool_calls:
continuation = await client.continue_with_tool_results(response)
print("\n\nFinal answer:")
print(continuation.choices[0].message.content)
# Run the async application
import asyncio
asyncio.run(main())
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
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
File details
Details for the file kissllm-0.0.1.tar.gz.
File metadata
- Download URL: kissllm-0.0.1.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
020f92407adc58c7de8df03ebcf9ff6a8d88da510899de0616e0e6b62e375316
|
|
| MD5 |
2c4a60479ceaac17d28ade79214e724d
|
|
| BLAKE2b-256 |
b36e973b475059ef1d6d0e5daa11e6be7d4bcad001bc30ce8b910aa7e5a1ce61
|
Provenance
The following attestation bundles were made for kissllm-0.0.1.tar.gz:
Publisher:
publish-to-pypi.yml on Arosial/kissllm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kissllm-0.0.1.tar.gz -
Subject digest:
020f92407adc58c7de8df03ebcf9ff6a8d88da510899de0616e0e6b62e375316 - Sigstore transparency entry: 191971443
- Sigstore integration time:
-
Permalink:
Arosial/kissllm@bbca4f38f6f2fa5c26ed9b3e3a1f1789c8eb660e -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/Arosial
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@bbca4f38f6f2fa5c26ed9b3e3a1f1789c8eb660e -
Trigger Event:
push
-
Statement type:
File details
Details for the file kissllm-0.0.1-py3-none-any.whl.
File metadata
- Download URL: kissllm-0.0.1-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6b9cbf8c91b16b2d800bf1e9cb1e4acd13932f8612b9bab5146e81c6937a71a
|
|
| MD5 |
76be437580449130d9738c32b62cc243
|
|
| BLAKE2b-256 |
fdf8b800a0e691f80fc191f8e07640f26082790f2c7a6d3571bcb29ccf71d4d2
|
Provenance
The following attestation bundles were made for kissllm-0.0.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on Arosial/kissllm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kissllm-0.0.1-py3-none-any.whl -
Subject digest:
c6b9cbf8c91b16b2d800bf1e9cb1e4acd13932f8612b9bab5146e81c6937a71a - Sigstore transparency entry: 191971445
- Sigstore integration time:
-
Permalink:
Arosial/kissllm@bbca4f38f6f2fa5c26ed9b3e3a1f1789c8eb660e -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/Arosial
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@bbca4f38f6f2fa5c26ed9b3e3a1f1789c8eb660e -
Trigger Event:
push
-
Statement type: