Thinking in ranges: composing transformations in C++20
A practical introduction to readable data pipelines with views and ranges adaptors.
Read article →What does an LLM application need from its C++ client?
Explore the pieces behind a useful model client, from requests and responses to errors.
Read article →RAG in practice: connect models to useful context
Trace the retrieval flow and the design choices that shape grounded answers.
Read article →Calling an LLM API from C++: a first principles guide
Plan a small integration and think carefully about boundaries, timeouts and types.
Read article →Embeddings and vector search, explained for builders
Understand vector representations and how nearest-neighbor search supports RAG.
Read article →AI agents in C++: tools, loops and useful boundaries
Break an agent into understandable components and make room for testing.
Read article →MODERN C++
Thinking in ranges: composing transformations in C++20
C++20 ranges let you describe a sequence of operations as a pipeline. A view such as std::views::filter selects values, while std::views::transform maps each selected value. Combine them with the pipe operator to make the order of work visible in the code.
Views are generally lazy: the work happens as elements are read, rather than when the pipeline is declared. This can avoid intermediate containers, but it also means a view depends on the lifetime of the underlying range. Keep the source alive for as long as you use the view, and materialize results when you need independent storage.
C++ + AI
What does an LLM application need from its C++ client?
A useful LLM client is more than an HTTP request. It needs a clear boundary between application logic and the provider API, safe handling of credentials, request and response types, and predictable error reporting. Keep network details inside a client component so the rest of the application can work with ordinary C++ values.
Plan for timeouts, HTTP failures, malformed responses and provider rate limits. If the application streams output, represent partial responses explicitly. Keep prompts and model settings separate from transport code so they can be reviewed and changed without rewriting the client.
AI ENGINEERING
RAG in practice: connect models to useful context
Retrieval-Augmented Generation adds relevant source material to a model request. A typical pipeline splits documents into chunks, creates embeddings, stores those vectors with useful metadata, and retrieves likely matches for a question. The selected context is then included with the prompt so the model can answer from your material.
Good results depend on the whole pipeline: document preparation, chunk size, retrieval strategy, and how clearly the prompt asks the model to use the retrieved sources. Test with representative questions and inspect the retrieved passages when an answer is weak; retrieval is often the part that needs improvement.
C++ + AI
Calling an LLM API from C++: a first-principles guide
Start by separating the API interaction into a few steps: construct a request, send it over HTTPS, check the HTTP status, parse the JSON response, and convert the result into application-level types. This keeps provider-specific fields from spreading throughout your code.
Store API keys outside source control, set reasonable timeouts, and surface useful errors without logging credentials or private prompts. As the client grows, add support for structured output, streaming, and retries only where the application needs them. Each behavior should have an explicit limit so a temporary service problem cannot stall the whole program.
AI ENGINEERING
Embeddings and vector search, explained for builders
An embedding maps text to a numeric vector that represents aspects of its meaning. A search system can embed a query and compare it with stored document vectors, using a similarity measure such as cosine similarity to rank likely matches. This can find related wording even when a query does not repeat the document’s exact keywords.
For useful results, store vectors alongside the source text and metadata, and make sure the query and document embeddings come from compatible models. Vector search is one retrieval signal; combining it with keyword search can help with exact names, identifiers and technical terms.
C++ + AI
AI agents in C++: tools, loops and useful boundaries
An agent uses a model to choose among actions, often by calling tools that your application provides. A simple cycle sends the model a task, inspects its response, runs an approved tool when requested, and returns the result for the next step. The model proposes actions; your C++ program should validate and execute them.
Make tool inputs typed and validated, define which operations are allowed, and cap the number of steps. Handle tool errors as normal results the model can reason about, while keeping secrets and sensitive operations outside its reach. These boundaries make the workflow easier to understand and safer to operate.
LEARN BY BUILDING
Take an idea further.
Explore practical courses in C++ and AI Engineering.
