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

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


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.22.tar.gz (14.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.22-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: liteai_sdk-0.3.22.tar.gz
  • Upload date:
  • Size: 14.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.22.tar.gz
Algorithm Hash digest
SHA256 db53c6a003c2f8258dd4f3f6e32329e61e6016fd721a1ae4810bbe898d401de3
MD5 77bde17b04f851da59c94f0bc7b51a35
BLAKE2b-256 ed84cba1779e111b6f3466eefde6e6298794d49f7318cf64e8852d8995bca683

See more details on using hashes here.

Provenance

The following attestation bundles were made for liteai_sdk-0.3.22.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.22-py3-none-any.whl.

File metadata

  • Download URL: liteai_sdk-0.3.22-py3-none-any.whl
  • Upload date:
  • Size: 15.3 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.22-py3-none-any.whl
Algorithm Hash digest
SHA256 e29f3a587fd59d2d0c96dc8da5b0248e741279cc5f32e2a13e918964589bc12c
MD5 6a4fd2290a0249f8c7be6b7ee021cd92
BLAKE2b-256 58821495b068c0b47a46e1eef603e3da0d6c2c4fbcc770057cec6d440659c536

See more details on using hashes here.

Provenance

The following attestation bundles were made for liteai_sdk-0.3.22-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