AI gems: langchainrb
This course examines langchainrb, the Ruby port of the Langchain idea, against code built by hand. It covers the unified LLM interface and the provider features it cannot express, such as prompt caching, structured outputs, thinking and effort. It looks at prompt templates and the Assistant class that wraps the agent loop. It also covers Vectorsearch with pgvector and the decisions it makes for you. It closes with six questions for evaluating an AI gem. It then builds a seam that keeps any library behind one interface you own.
What you'll learn
- ✓How the unified LLM interface works and what it cannot express
- ✓Prompt templates with declared variables and no logic
- ✓How Assistant maps onto a hand-written agent loop, and what you add back
- ✓What Vectorsearch with pgvector decides on your behalf
- ✓Six questions for evaluating an AI gem for adoption
- ✓Building a seam so only one class names the library
What an LLM framework promises
You have now built a RAG pipeline, a vector index, a prompt with examples and an agent loop, all by hand. Each one is a well-known pattern, and a reasonable person looking at that work asks the obvious question: is there a gem for this?
Read the full lesson free →Curriculum
7 lessonsWhat an LLM framework promises
What langchainrb offers, the state of its releases, and the trade made by any unified provider interface.
The unified LLM interface
The shared complete, chat and embed interface, its escape hatches, and the Anthropic features it silently drops.
Prompt templates: the nice part
Prompt templates with declared variables and no logic, few-shot templates, and a twenty-line portable version.
Assistant: the agent loop, wrapped
How Assistant wraps the agent loop, its callbacks, and the budgets and approval gates you add back.
Vectorsearch: RAG in three calls
Vectorsearch with pgvector in four calls, and the chunking, tenant, re-indexing and index decisions it makes.
Evaluating an AI gem for adoption
Six questions for judging an AI gem, applied to langchainrb, plus practices that keep adoption reversible.
The seam, and a decision procedure
An interface you own between the app and any AI library, and a five-step procedure for adopting one.