Skip to main content

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

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("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("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.content)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

liteai_sdk-0.3.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

liteai_sdk-0.3.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file liteai_sdk-0.3.0.tar.gz.

File metadata

  • Download URL: liteai_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for liteai_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 11fe6ce09043a7996997fba5fa1d238a0a01c28a37b476bc0930391affc1c0b0
MD5 51f61189e296a15400730e8603918adf
BLAKE2b-256 18f284975a4a8535edc38cc70f0ed78dd231ce674a104120920ac6991d5acd4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for liteai_sdk-0.3.0.tar.gz:

Publisher: publish.yml on BHznJNs/liteai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file liteai_sdk-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: liteai_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for liteai_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a46c74e773a3159fdc6d79f31b964fc8cfe65611cd1f30c1f0d29124011e2f3
MD5 fa2c9dbb3e50b76ddfce66935ef478a9
BLAKE2b-256 d25a503fd180bb64671ce13086e90463a888d6c7dafea98a99c81ccf47b027e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for liteai_sdk-0.3.0-py3-none-any.whl:

Publisher: publish.yml on BHznJNs/liteai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page