Test Drive: ell
Published on .
Today I’m test driving ell “The Language Model Programming Library.” From the tagline, it has captured my attention, although I am wary of anything that stands between me and the prompt. I’m going back to my company industry classification task. The process is simple:
- Install ell
- Write prompt
- Run program
- View in “studio”
I can’t quite get onboard with the syntax since I want my functions to do input-output, but with the ell.simple()
decoration I encode my system prompt into the docstring and then I return my user prompt. Ok fine, it works, but I don’t like it.
Studio is fantastic. Unlike many other observability tools, it doesn’t rely on a running service (cough – a heavy docker-compose system) and instead just writes a SQLite database that you can view at any time. This is great! It also feels very natural to track your prompt engineering automatically, and I guess the commit messages are a good example of “practice what you preach.” I can also see the DAG view coming in handy. The docs are excellent!
import ell
ell.init(store='./logdir', autocommit=True, verbose=True)
desc = """PTT Public Company Limited is a Thailand-based company engaged in the gas and petroleum businesses. The Company supplies, transports and distributes natural gas vehicle (NGV), petroleum products and lubricating oil via service stations throughout Thailand and also exports to overseas markets. Through its subsidiaries and affiliated companies, the Company is involved in exploration, production, refinery, marketing and distribution of petroleum, petrochemical products and aromatics. In addition, the Company operates international trade businesses, including import and export of crude oil, condensates, petroleum products, petrochemicals, and sourcing of international transport vessels and carriers."""
@ell.simple(model="gpt-4o-mini", temperature=1.0)
def classify(desc : str):
"""Determine the full GICS sub-industry code based on the description. Respond only with the code"""
return desc
story = classify(desc, api_params=dict(n=3))