Skip to main content

A toolkit for initializing LLMs and embeddings with multiple providers

Project description

Init LLM

A toolkit for initializing LLMs(Langchain) and embeddings with multiple providers. All models are openai compatible.

Installation

pip install init-llm

Quick Start

from init_llm import ChatLLM, EmbeddingLLM

# Initialize chat model
llm = ChatLLM('openai')  # or 'azure', 'anthropic', etc.
response = llm.invoke('Hello!')

# Initialize embeddings
embeddings = EmbeddingLLM('text-embedding-3-small')
vector = embeddings.embed_query('Hello world')

Configuration

The package uses two configuration files:

  • model_providers.toml: Model configurations and provider settings
  • .env: API keys and other sensitive information

Auto Configuration

On first use, the package will:

  1. Check for configuration files in the working directory
  2. If not found, create them automatically with default settings
  3. Load environment variables from .env

Custom Configuration

You can specify custom configuration location and env file name:

llm = ChatLLM(
    'openai',
    config_dir='/path/to/config',
    env_file='custom.env'
)

See Supported Providers in model_providers.toml

License

MIT

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

init_llm-0.1.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

init_llm-0.1.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: init_llm-0.1.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for init_llm-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8e844270502b263b4946d1804f182d280d6dacc69c9f935fcafa7da76e46518e
MD5 bffb654465d19d06d0f0de86af446ff1
BLAKE2b-256 47d66d6b595b799103bbf5d72ea3261ae0041183a36ecd09b7e177f9a9d0bd4d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: init_llm-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for init_llm-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6691ca0ad03e32ce8bad9089873a2a446b390e67d81f00850a3a412b8d0ef907
MD5 09ffa8bde68ed48e2090eca7aa21a94f
BLAKE2b-256 5944624ae10f15b605996745e6c050bac4e6adb69efaf41cd91655ab27830413

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