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)
  • apply opentelemetry in async functions

0.2.0

  • 2025-01-11 support json mode(OpenAI)
  • 2024-11-01 apply opentelemetry in sync functions

0.1.2

  • 2024-10-25 fix exception when use new model name as str type

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.2.0.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

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

lite_llm_client-0.2.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for lite_llm_client-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ccb1f6b605cd733476d64e922e167d930995b3b0c4a000f2be5a518a70209bb9
MD5 b7ad2823c95401499f563991fb6c60b8
BLAKE2b-256 4363c42905bcc05a7ba2116f2eef99f7b3d2715d4d8ee73127270d8e264b37b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lite_llm_client-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b20b1065b58a276f5de64035312bf23afcb147f0ccb53701051741128a65fb9e
MD5 8a3394eab19847f963f82fe59c185ee7
BLAKE2b-256 66703dd0771ca9aefdaa14d671264656d79531c42bd749a30c7162a9d05dfd36

See more details on using hashes here.

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