Building an AI Assistant from Modular LLM Capabilities: A Technical Practice Guide
This article examines the shift from "model as an API" to a composable supply of models, tools, and orchestration, and explains how to build a stable AI assistant on top of it. It covers a three-layer capability model, how to treat parameterized request options as contracts, retrieval-augmented generation practices, asynchronous multimodal and file pipelines, a layered architecture with a governance checklist, and common pitfalls with a four-week rollout plan. The guidance is product-neutral and focuses on architecture, tool orchestration, cost control, and risk management.
1. Background and the Technical Signal
A cloud vendor recently announced that it is opening up several core capabilities from its AI assistant application as APIs. On one hand, capabilities such as web search, deep-research-style retrieval, file input, and link reading are integrated into the existing chat endpoint, and developers can invoke them by enabling the corresponding parameters. On the other hand, search, web crawling, OCR, speech recognition, and speech synthesis are exposed as standalone tool endpoints that can be called individually or in combination. The official framing is that developers can use these to replicate a fully featured AI assistant application.
The real value of this announcement is not the word “replicate,” but the fact that it marks a structural change in how LLM capabilities are supplied: a move from “model as an API” to a composable supply of “model + tools + orchestration.” In the past, developers received a text completion endpoint, and the capability boundary was determined by the model weights. Now the capability boundary is determined jointly by parameter switches and a tool inventory. For engineering teams, this significantly increases the design freedom of the product form, while shifting complexity from the model layer to the application orchestration layer.
This article does not review or recommend any specific product. Instead, it abstracts the trend into a general technical question: once a foundation model vendor modularizes and opens up capabilities such as search, crawling, recognition, and synthesis, how should developers design the architecture, orchestrate tools, and control cost and risk in order to build a stable, usable AI assistant?
2. Capability Layers: Turning a Full Suite into Composable Building Blocks
The key to understanding this opening up is to first build a mental model of capability layers. It can be divided into three layers.
The first layer is the model inference layer, responsible for semantic understanding, intent recognition, content generation, and reasoning organization. It determines the language quality and logical coherence of the answer.
The second layer is the parameterized enhancement layer, where capabilities such as web retrieval, deep retrieval, attachment parsing, and link reading are enabled through switches within a single chat request. The defining trait of this layer is that it is tightly coupled with the conversation: the model internally decides when to retrieve, how many rounds to retrieve, and how to fuse external information into the generation process. What developers need to do is set the switches, constrain the budget, and define fallback strategies.
The third layer is the standalone tool layer, including atomic capabilities such as search, web crawling, OCR, speech recognition, and speech synthesis. The defining trait of this layer is that it is decoupled from the conversation, with clear input/output contracts. It can be orchestrated into any workflow, or used independently of the model, for example to digitize documents in batches or add subtitles to existing content.
The engineering significance of the layering is this: the parameterized layer lowers the integration barrier and raises the ceiling of the experience, while the standalone tool layer provides controllability and reusability. Mature solutions typically use both — parameterized capabilities to bring the main path online quickly, and standalone tools to cover deterministic requirements such as retrieval from fixed sources, extraction into a fixed format, and batch offline processing.
3. The Engineering Semantics of Parameterized Invocation
“Just enable the corresponding parameter” sounds simple, but engineering-wise it must be managed as a contract. It is advisable to divide request parameters into three categories.
Capability switches: whether web access is allowed, whether deep retrieval is enabled, whether attachments are parsed, whether links are read. These parameters directly affect latency and cost, and must have default values and an allowlist.
Constraints: the upper limit on retrieval rounds, the upper limit on the number of cited sources, the size and page-count limits for attachments, and the timeout. Constraint parameters are the cost guardrails; missing them is equivalent to handing the budget over to the model’s discretion.
Output contract: whether citations are required, the structured output format, language and style, and the refusal policy. The dividing line between an AI assistant and a chat toy often lies in whether the output contract is strict.
Illustrative request structure (pseudocode, expressing only the idea of parameter layering):
{"model": "<your-model-endpoint>","messages": [{"role": "user", "content": "Summarize the key conclusions of this quarterly report"}],"capabilities": {"web_search": true,"deep_research": false,"file_input": true,"link_reading": true},"constraints": {"max_search_rounds": 2,"max_sources": 5,"timeout_ms": 8000},"output": {"require_citations": true,"format": "markdown"}}
The most common pitfall in practice is “turning everything on.” Enabling all capabilities at once leads to uncontrollable latency, context polluted by low-quality content, and cost that scales linearly with the number of rounds. A more robust strategy is intent-based routing: disable retrieval for chit-chat and formatting tasks; enable a single retrieval round for factual questions; and enable multi-round deep retrieval only for research tasks, combined with a budget circuit breaker.
4. Retrieval-Augmented Generation: The Core of Answer Credibility
Once web capabilities are opened up, the difference in application quality mainly comes down to the details of retrieval-augmented generation.
On the retrieval side, query rewriting is needed. A user’s original phrasing often contains references and omissions, and using it directly for retrieval yields a very low recall rate. The common approach is to first use the model to perform coreference resolution and keyword expansion, then run multiple retrieval paths concurrently.
On the fusion side, deduplication and conflict handling are needed. Information from multiple sources often shows inconsistent numbers. Engineering-wise, traceable primary sources should be prioritized, and disagreements should be explicitly flagged in the answer rather than letting the model “pick one and speak.”
On the generation side, citations should be mandatory. Requiring the model to provide a clickable source for every factual claim is one of the most effective means of suppressing hallucination. If the output contract does not support citations, at least require a source list to be returned for post-processing verification.
On the fallback side, failure paths must be defined. When retrieval times out, crawling is refused, or a page is empty, the system should degrade to “answer based on known information and state that no external material was obtained,” rather than silently fabricating.
def answer_with_retrieval(query, budget=2):rewritten = rewrite_query(query) # coreference resolution + keyword expansiondocs = search(rewritten, top_k=5) # concurrent multi-path retrievaldocs = [d for d in docs if d.is_readable]if not docs:return llm_answer(query, context=[], note="No external material was obtained")context = dedup_and_rank(docs)[:budget * 3]return llm_answer(query, context=context, require_citations=True)
5. Multimodal and File Processing Pipelines
File input, OCR, speech recognition, and speech synthesis together form the “sensory and vocal system” of an AI assistant. The engineering key is to make it an asynchronous pipeline rather than a synchronous blocking call.
A typical pipeline is: upload to object storage to obtain a temporary credential → parse asynchronously (document extraction, OCR, transcription) → persist results and chunk them into the index → recall relevant chunks by relevance during the conversation → generate the answer → when voice output is needed, call the synthesis endpoint and cache the audio.
A few easily overlooked details: first, parsing results must retain locators such as page numbers and coordinates, otherwise citations cannot be traced back; second, audio and document artifacts should have lifecycle policies to avoid object storage costs spiraling out of control; third, long documents must be chunked before vectorization, and the chunk size must balance semantic completeness against recall precision; fourth, the entire pipeline needs task status queries and idempotent design to prevent duplicate billing.
6. Architecture and Engineering Governance
A production-ready AI assistant should adopt the following layered architecture.
The access layer handles authentication, rate limiting, and tenant isolation; the orchestration layer handles intent routing, capability switch decisions, and tool invocation; the capability layer wraps the model endpoint and the various standalone tools; the data layer contains object storage, vector indexes, session storage, and logging services; the observability layer uses monitoring, alerting, and distributed tracing to locate latency spikes and failing nodes.
The governance checklist can be summarized in five items: cost (set capability budgets per tenant and per scenario), quality (citation coverage, refusal accuracy, retrieval hit rate), security (two-way content moderation of input and output, redaction of sensitive information), compliance (licensing of data sources, retention periods, deletability), and resilience (timeouts, retries, circuit breaking, degradation).
If running on Baidu AI Cloud, the above capabilities can be covered by general categories: object storage holds attachments and audio, a container platform hosts the orchestration services, a message queue decouples parsing tasks, and logging plus monitoring and alerting complete the observability build. Specific product selection and configuration should follow the official documentation.
7. Common Pitfalls and a Rollout Path
Pitfall one: treating all parameters turned on as proof of strong capability. The actual effect is often higher latency, doubled cost, and more verbose answers.
Pitfall two: building only the online path and no offline batch processing. Scenarios such as digitizing existing documents and adding subtitles to content are far cheaper to run in batches with standalone tools than to invoke online each time.
Pitfall three: ignoring the output contract. Without structured output and citation requirements, automated evaluation cannot be done downstream.
Pitfall four: going live without an evaluation set. It is advisable to first build a scenario evaluation set of a hundred or so cases, covering four categories: factual Q&A, document summarization, multi-turn follow-ups, and refusals, and to run a regression on every parameter change.
Suggested path: in week one, get the main chat path plus authentication and rate limiting working end to end; in week two, add retrieval and citations; in week three, complete file parsing and the asynchronous multimodal pipeline; in week four, build the evaluation, cost, and alerting dashboards, then gradually open up to tenants.
8. Conclusion
The essence of modular capability opening is turning the question of “can it be done” into the question of “how well can it be orchestrated.” The real competitive edge for developers has shifted from calling a single endpoint to designing a reliable combination of capabilities: parameterized capabilities buy the ceiling of the experience, standalone tools buy determinism and reusability, and evaluation plus governance buy long-term maintainability. Get these three things solid, and a stable, trustworthy, cost-controlled AI assistant no longer depends on any one vendor’s full suite, but rests on your own clear understanding of technical boundaries.
