Skip to main content

('A library for augmenting large language models using MLX',)

Project description

mlx_augllm

MLX(Apple Silicon向け機械学習フレームワーク)を用いた、 ローカルで動作する LLM / VLM のための統一インターフェースライブラリです。

本ライブラリは以下を目的としています。

  • ローカルLLM/VLMを簡単かつ一貫したAPIで扱える
  • Tool Use(関数呼び出し)に対応
  • 会話履歴の管理を自動化
  • Apple Siliconに最適化

インストール

pip install -U mlx_augllm
  • Apple Silicon必須

サンプル

from mlx_augllm import MlxAugmentedLLM, MlxLLMInterface, PromptBuilder 

def run_test():

    # モデルの準備
    model_path = "mlx-community/gemma-3-27b-it-4bit"
    augmented_llm = MlxAugmentedLLM(
        llm_interface=MlxLLMInterface(
            model_path=model_path,
            use_vision=False,
            temp=0.7,
            top_k=50,
            top_p=0.9,
            min_p=0.05,
            max_tokens=8192
        ),
        prompt_builder=PromptBuilder(system_prompt_text="あなたは有能なアシスタントです。"),
    )

    # 実行テスト
    user_query = "トポロジー最適化について教えてください。"
    
    print(f"\nユーザーの問いかけ: {user_query}")
    print("-" * 50)
    print("AIの応答 (Streaming):")

    # respond の呼び出し (contextを渡す)
    response_generator = augmented_llm.respond(
        user_text=user_query,
        stream=True,
        temp=0.7
    )

    full_response = ""
    for chunk in response_generator:
        print(chunk, end="", flush=True)
        full_response += chunk
    
    print("\n" + "-" * 50)
    print("【内部レポート】")
    if augmented_llm.report_text:
        print(f"最終回答の文字数: {len(augmented_llm.report_text)}")

if __name__ == "__main__":
    run_test()

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

mlx_augllm-1.4.1.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

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

mlx_augllm-1.4.1-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file mlx_augllm-1.4.1.tar.gz.

File metadata

  • Download URL: mlx_augllm-1.4.1.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for mlx_augllm-1.4.1.tar.gz
Algorithm Hash digest
SHA256 89769425a43f8335d33da4f67e659950faf89bf2a0ce2ca7a3ec244d9ba11042
MD5 221028268475b2c4199a98a51f363b4f
BLAKE2b-256 01c3758399e821ce0ec67dfc13725fce6981b92ac4824c8cc84f672818e70122

See more details on using hashes here.

File details

Details for the file mlx_augllm-1.4.1-py3-none-any.whl.

File metadata

  • Download URL: mlx_augllm-1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for mlx_augllm-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b4572bd27c9182ecd014f749465a36695b04699e23047bcc694a108acc815ed6
MD5 a77acfaf201d2187715d635548422e54
BLAKE2b-256 141f9b9a3e1a7824e4db59448d6fafd55f2ba6322f18a854141a4013f14f3e4a

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