A wrapper of LiteLLM
Project description
LiteAI-SDK
LiteAI-SDK is a wrapper of LiteLLM which provides a more intuitive API and AI SDK like DX.
Installation
pip install liteai-sdk
Develop with coding agent
You can access the complete usage guidance with llms.txt, just give it to your coding agent to tell it how to use LiteAI-SDK.
Examples
Below is a simple example of just a API call:
import os
from dotenv import load_dotenv
from liteai_sdk import LLM, LlmProviders, LlmRequestParams, UserMessage
load_dotenv()
llm = LLM(provider=LlmProviders.OPENAI,
api_key=os.getenv("API_KEY", ""),
base_url=os.getenv("BASE_URL", ""))
response = llm.generate_text_sync( # sync API of generate_text
LlmRequestParams(
model="deepseek-v3.1",
messages=[UserMessage(content="Hello.")]))
print(response)
Below is an example that shows the automatically tool call:
import os
from dotenv import load_dotenv
from liteai_sdk import LLM, LlmProviders, LlmRequestParams, UserMessage
load_dotenv()
def example_tool():
"""
This is a test tool that is used to test the tool calling functionality.
"""
print("The example tool is called.")
return "Hello World"
llm = LLM(provider=LlmProviders.OPENAI,
api_key=os.getenv("API_KEY", ""),
base_url=os.getenv("BASE_URL", ""))
params = LlmRequestParams(
model="deepseek-v3.1",
tools=[example_tool],
execute_tools=True,
messages=[UserMessage(content="Please call the tool example_tool.")])
print("User: ", "Please call the tool example_tool.")
messages = llm.generate_text_sync(params)
for message in messages:
match message.role:
case "assistant":
print("Assistant: ", message.content)
case "tool":
print("Tool: ", message.result)
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 liteai_sdk-0.5.15.tar.gz.
File metadata
- Download URL: liteai_sdk-0.5.15.tar.gz
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba04d1dfb2cfbca5ff7f59205cd68f2df5207869ce82ab0f4330a7ea7a8b055e
|
|
| MD5 |
abdd61ad436a8ff149e4052495b42090
|
|
| BLAKE2b-256 |
3a3b0baa2027260c231a598d1181f98b80a810c02a9fdb0c26e4608ed507036f
|
Provenance
The following attestation bundles were made for liteai_sdk-0.5.15.tar.gz:
Publisher:
publish.yml on BHznJNs/liteai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
liteai_sdk-0.5.15.tar.gz -
Subject digest:
ba04d1dfb2cfbca5ff7f59205cd68f2df5207869ce82ab0f4330a7ea7a8b055e - Sigstore transparency entry: 862932008
- Sigstore integration time:
-
Permalink:
BHznJNs/liteai@443b84a87e69b57fc419928fd3e6371afa946693 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/BHznJNs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@443b84a87e69b57fc419928fd3e6371afa946693 -
Trigger Event:
push
-
Statement type:
File details
Details for the file liteai_sdk-0.5.15-py3-none-any.whl.
File metadata
- Download URL: liteai_sdk-0.5.15-py3-none-any.whl
- Upload date:
- Size: 24.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3d4331aa0df90eee3a1dec93779e462d4f9cc2f58d85a5953508fe5c35d343a
|
|
| MD5 |
32087399c9eccfa27460ea3f06a8adbc
|
|
| BLAKE2b-256 |
8abfbfdc1ae60ae0debe23688385346e37db05fd93186149ee8715b174d1a708
|
Provenance
The following attestation bundles were made for liteai_sdk-0.5.15-py3-none-any.whl:
Publisher:
publish.yml on BHznJNs/liteai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
liteai_sdk-0.5.15-py3-none-any.whl -
Subject digest:
c3d4331aa0df90eee3a1dec93779e462d4f9cc2f58d85a5953508fe5c35d343a - Sigstore transparency entry: 862932024
- Sigstore integration time:
-
Permalink:
BHznJNs/liteai@443b84a87e69b57fc419928fd3e6371afa946693 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/BHznJNs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@443b84a87e69b57fc419928fd3e6371afa946693 -
Trigger Event:
push
-
Statement type: