Overview
chatlas
Your friendly guide to building LLM chat apps in Python with less effort and more clarity.
Quick start
Get started in 3 simple steps:
- Choose a model provider, such as ChatOpenAI or ChatAnthropic.
- Visit the providerโs reference page to get setup with necessary credentials.
- Create the relevant
Chat
client and start chatting!
from chatlas import ChatOpenAI
# Optional (but recommended) model and system_prompt
= ChatOpenAI(
chat ="gpt-4o-mini",
model="You are a helpful assistant.",
system_prompt
)
# Optional tool registration
def get_current_weather(lat: float, lng: float):
"Get the current weather for a given location."
return "sunny"
chat.register_tool(get_current_weather)
# Send user prompt to the model for a response.
"How's the weather in San Francisco?") chat.chat(
# ๐ ๏ธ tool request
37.7749, -122.4194) get_current_weather(
# โ
tool result
sunny
The current weather in San Francisco is sunny.
Install
Install the latest stable release from PyPI:
pip install -U chatlas
Why chatlas?
๐ Opinionated design: most problems just need the right model, system prompt, and tool calls. Spend more time mastering the fundamentals and less time navigating needless complexity.
๐งฉ Model agnostic: try different models with minimal code changes.
๐ Stream output: automatically in notebooks, at the console, and your favorite IDE. You can also stream responses into bespoke applications (e.g., chatbots).
๐ ๏ธ Tool calling: give the LLM โagenticโ capabilities by simply writing Python function(s).
๐ Multi-turn chat: history is retained by default, making the common case easy.
๐ผ๏ธ Multi-modal input: submit input like images, pdfs, and more.
๐ Structured output: easily extract structure from unstructured input.
โฑ๏ธ Async: supports async operations for efficiency and scale.
โ๏ธ Autocomplete: easily discover and use provider-specific parameters like temperature
, max_tokens
, and more.
๐ Inspectable: tools for debugging and monitoring in production.
๐ Extensible: add new model providers, content types, and more.
Next steps
Next weโll learn more about what model providers are available and how to approach picking a particular model. If you already have a model in mind, or just want to see what chatlas can do, skip ahead to hello chat.