Skip to main content

llm wrappers for multimodal architectures team

Project description

mmar-llm

Library to access different LLM's via common API:

  • GigaChat
  • OpenRouter
  • ..

Usage

Create llm_config.json with llm-endpoints:

{
  "default_model": "model",
  "warmup": true,
  "wait_seconds_on_llm_retry": [1, 2, 4, 4, 4],
  "endpoints": [
    {
      "key": "model",
      "caption": "GigaChat MAX 2",
      "descriptor": "gigachat",
      "args": {
		"authorization_key": "MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwOjAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMA=="
      }
    },
	...
  ]
}

Create llm-hub:

from pathlib import Path
from types import SimpleNamespace

from mmar_llm import LLMConfig, LLMHub


def create_llm_hub(llm_config_path: str, tmp_path: str | None = None):
    llm_config = LLMConfig.model_validate_json(Path(llm_config_path).read_text())
    llm_hub_config = SimpleNamespace(llm=llm_config, files_dir=tmp_path)
    llm_hub = LLMHub(llm_hub_config)
    return llm_hub

lh = create_llm_hub('/path/to/llm_config.json')
print(lh.get_response(request='What is your name?'))

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

mmar_llm-2.1.1.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

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

mmar_llm-2.1.1-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file mmar_llm-2.1.1.tar.gz.

File metadata

  • Download URL: mmar_llm-2.1.1.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.31

File hashes

Hashes for mmar_llm-2.1.1.tar.gz
Algorithm Hash digest
SHA256 d5356e7ff8a164ddff401c42a55e015acfb2647e924f287fa41297f26c773792
MD5 b5fec9dc8ad086ef68b4fe2ad1e00c64
BLAKE2b-256 091d24c59901f5f63fcfd7b58f05838dc4236d86ea6888e616b586b0e188c506

See more details on using hashes here.

File details

Details for the file mmar_llm-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: mmar_llm-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.31

File hashes

Hashes for mmar_llm-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 06bdcb85153e873bbce9fed6c04b5c3eae40b7c7e622039b33f19f83652296d5
MD5 636b4dde4e45759c934ea7d2501e9318
BLAKE2b-256 317550ddd2be496a79387dfe44ec13532c017bb33537c08ed5560ae6c7e23177

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