anyone knows how to use MLX and an agent with langgraph ?
# loading the model
llm = MLXPipeline.from_model_id(
"mlx-community/Llama-3.2-3B-Instruct",
pipeline_kwargs
={"max_tokens": 1024, "temp": 0.1},
)
model = ChatMLX(
llm
=llm)
# creating the agent
class AlbumStudio(BaseModel):
conditions: int
agent = create_react_agent(
model
=model,
tools
=[internet_search_DDGO, process_content],
prompt
="You're a wizard who extracts whole numbers from web pages. You must always answer with a whole number.",
response_format
=AlbumStudio
)
# launching the agent
messages = [
HumanMessage(
"content": "blabla"
),
]
result = agent.invoke({"messages": messages})
this code gives me this error : ValueError: Last message must be a HumanMessage!