MLXPipeline()MLX Pipeline API.
To use, you should have the mlx-lm python package installed.
Example using from_model_id:
.. code-block:: python
from langchain_community.llms import MLXPipeline pipe = MLXPipeline.from_model_id( model_id="mlx-community/quantized-gemma-2b", pipeline_kwargs={"max_tokens": 10, "temp": 0.7}, )
Example passing model and tokenizer in directly: .. code-block:: python
from langchain_community.llms import MLXPipeline
from mlx_lm import load
model_id="mlx-community/quantized-gemma-2b"
model, tokenizer = load(model_id)
pipe = MLXPipeline(model=model, tokenizer=tokenizer)