Skip to main content

A small example package

Project description

Lite LLM Client

This project made for very light llm client. the main idea is do not use any llm client library.

setup

How to pass API_KEY

  1. use parameter of LLMConfig
from lite_llm_client import LiteLLMClient, OpenAIConfig, LLMMessage, LLMMessageRole

client = LiteLLMClient(OpenAIConfig(api_key="YOUR API KEY"))
answer = client.chat_completions(messages=[LLMMessage(role=LLMMessage.USER, content="hello ai?")])

print(answer)
  1. use .env
    • rename .env_example to .env
    • replace YOUR KEY to real api_key
OPENAI_API_KEY=YOUR KEY
ANTHROPIC_API_KEY=YOUR KEY
GEMINI_API_KEY=YOUR KEY

Known issue

  • gemini path may not stable. guide code has /v1beta/.... sometimes gemini returns http 500 error

Roadmap

Future version

  • support multimodal (image and text)

0.1.0

  • 2024-07-21 support OpenAI
  • 2024-07-25 support Anthropic
  • 2024-07-27 add options for inference
  • 2024-07-28 support Gemini
  • 2024-07-30 support streaming (OpenAI). simple SSE implement.
  • 2024-07-31 support streaming (Anthropic).
  • 2024-08-01 support streaming (Gemini). unstable google gemini.
  • 2024-08-13 support inference result(token count, stop readon)

Reference

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

lite_llm_client-0.1.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

lite_llm_client-0.1.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file lite_llm_client-0.1.1.tar.gz.

File metadata

  • Download URL: lite_llm_client-0.1.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for lite_llm_client-0.1.1.tar.gz
Algorithm Hash digest
SHA256 05587706c43915a85e712c5572ca7ebe3235ad12305f2da712bdb6a7c5f5d1ad
MD5 fd6a8c1ccd5fb8c445330d9065e8dd35
BLAKE2b-256 20be47c7bd41fa0d43f5167d2a4c14401049a9ef700ff759c586894a66437d39

See more details on using hashes here.

File details

Details for the file lite_llm_client-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for lite_llm_client-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a161262f8d24b3d820f04f646d24cb0c993f20b8a421b5f29c03e06603464730
MD5 dfe91bd12ce06790d0becd2d90e104ae
BLAKE2b-256 42f114efc742510cc204cea0872998b16884eecd1cfc0dc8b43d36a66b9af0ac

See more details on using hashes here.

Supported by

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