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.2.tar.gz (6.6 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.2-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: init_llm-0.1.2.tar.gz
  • Upload date:
  • Size: 6.6 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.2.tar.gz
Algorithm Hash digest
SHA256 34769dca23ddc4eaeabe97233589ca2327c4a4aa929e547dbf95eca7ded470f2
MD5 a30861fb36a6ce40ba7afd7acee4920e
BLAKE2b-256 e6af8e1e6d8bcc55b2038210f0e31cde887509e610c273d0ea8b6307afb5a7ee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: init_llm-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 31cf4802467824a69f200f5407c768dd10fa0f17ad8bcc60fb84afa5a34f5849
MD5 75b126897955bb9d19b5ea7dc504b903
BLAKE2b-256 3260ee98db013b1b3e8c8b7235d8ac5d367a1e19f6df6e8bf46769287e893afd

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