Fast and easy wrapper around LLMs.
Project description
FastLLM
Fast and easy wrapper around LLMs. The package aims to be simply, precise and allows for fast prototyping of agents and applications around LLMs. At the moment focus around OpenAI's models.
Warning - very early stage of development.
Samples
Require an openai api key in OPENAI_API_KEY
environment variable or .env
file.
export OPENAI_API_KEY=...
Agents
from fastllm import Agent
find_cities = Agent("List {{ n }} cities comma separated in {{ country }}.")
cities = find_cities(n=3, country="Austria").split(",")
print(cities)
['Vienna', 'Salzburg', 'Graz']
from fastllm import Agent, Message, Model, Prompt, Role
s = ";"
creative_name_finder = Agent(
Message("You are an expert name finder.", Role.SYSTEM),
Prompt("Find {{ n }} names.", temperature=2.0),
Prompt("Print names {{ s }} separated, nothing else!"),
model=Model("gpt-4"),
)
names = creative_name_finder(n=3, s=s).split(s)
print(names)
['Ethan Gallagher, Samantha Cheng, Max Thompson']
Development
Using poetry.
poetry install
Tests
poetry run pytest
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
fastllm-0.1.0.tar.gz
(10.0 kB
view hashes)
Built Distribution
fastllm-0.1.0-py3-none-any.whl
(10.2 kB
view hashes)