FHLMI Client

raw JSON →
0.46.0 verified Fri May 01 auth: no python

A Python client library for providing LLM responses to FutureHouse applications. Currently at version 0.46.0, targeting Python >=3.11. Under active development with frequent releases.

pip install fhlmi
error ImportError: cannot import name 'FHLMIClient' from 'fhlmi'
cause Older version of the library (<0.20.0) had a different API. Not all versions export FHLMIClient.
fix
Upgrade fhlmi: pip install --upgrade fhlmi
error AttributeError: 'ChatResponse' object has no attribute 'text'
cause Using old attribute name after the breaking change in 0.40.0.
fix
Use response.content instead of response.text.
breaking The `.chat()` method changed from returning plain text to returning a pydantic model in 0.40.0. Access `.content` for the response text.
fix Use `response.content` instead of treating the response as a string.
deprecated The `model` parameter in `chat()` is deprecated as of 0.45.0. Use `model_name` instead.
fix Replace `model=` with `model_name=`.
gotcha The client requires Python 3.11 or later. Installing on older Python versions will fail silently or produce cryptic errors.
fix Ensure your runtime uses Python >=3.11.

Initialize client with API key and send a chat message.

from fhlmi import FHLMIClient
import os

client = FHLMIClient(api_key=os.environ.get('FHLMI_API_KEY', ''))
response = client.chat([{"role": "user", "content": "Hello"}])
print(response)