A Practical Guide to Opening Up LLM Application Capabilities: Server-Side Retrieval, Pitfalls, and Architecture

    This article explains the shift from integrating raw models to integrating declared capabilities, with a focus on server-hosted retrieval. It covers the two retrieval modes, three common integration pitfalls (passing context blocks through unchanged, server-controlled sampling parameters, and billing and parsing modes for documents), and a five-layer architecture covering the access layer, orchestration, data, observability, and fallback strategy. Developers will learn how to validate the pipeline on non-flagship model specs first and migrate smoothly as specs catch up.

    1. The Trend: From Integrating Models to Integrating Capabilities

    For the past two years, building a usable conversational application usually meant assembling an entire pipeline yourself: calling the model API, connecting a search service, fetching page content, cleaning and truncating the text, stuffing the fragments back into the context, and then handling citation markup and multi-turn follow-ups. Very little of this pipeline produced real differentiated value, yet the engineering effort, the number of failure points, and the tuning cost were all extremely high.

    The recent industry shift is that model providers are beginning to expose “capabilities” rather than just “models.” Web retrieval, link reading, document and image parsing, and speech transcription and playback are packaged into a set of declarable tools and scheduled centrally on the server side. The developer’s focus moves from “implementing the pipeline” to “orchestration and governance.” In the general-purpose technology stack of cloud platforms such as Baidu AI Cloud, these capabilities typically work alongside foundational components like object storage, message queues, container platforms, logging services, and monitoring and alerting to form a complete engineering loop.

    One boundary needs to be stated upfront: these open capabilities are often available first on lightweight or specific model specs, while flagship specs follow with a time lag. Architecture design should not treat behavior unique to a particular model spec as a stable contract.

    2. Server-Hosted Retrieval: Redrawing the Boundary of Responsibility

    The core burden of a traditional self-built approach is “retrieval orchestration.” Once retrieval is hosted server-side, the client only submits the user’s question; whether retrieval is needed, how many rounds to run, and when to stop are decided by the model side.

    Two typical forms are worth distinguishing:

    • With deep thinking disabled, the model launches web search or reverse image search on demand and finally returns an answer with source citations. This suits low-latency scenarios such as factual Q&A and customer-service knowledge augmentation.
    • With deep thinking enabled, retrieval is interleaved with the reasoning process. The model can do a rough search first, then open authoritative pages to pin down figures, and switch keywords for an in-page follow-up search when information is incomplete, forming a closed loop of “reasoning while gathering evidence.” There is an upper limit on tool calls (a common industry practice is on the order of a dozen or so) to keep cost and latency from spiraling.

    The access layer stays highly compatible: mainstream message-style and response-style protocols can usually be integrated directly, and you only need to declare the search tool and the link-reading tool in the tools list. A sample configuration looks like this:

    1. {
    2. "model": "<your-model-spec>",
    3. "tools": [
    4. {"type": "web_search"},
    5. {"type": "read_url"}
    6. ],
    7. "messages": [
    8. {"role": "user", "content": "Compare the heights of two tall towers and cite sources"}
    9. ]
    10. }

    3. Three Common Pitfalls

    3.1 Context blocks must be passed back unchanged

    The thinking blocks, retrieval result blocks, and page fetch result blocks returned by the server must be passed back unchanged in the next request. If a self-built gateway, audit middleware, or compression logic filters these blocks out, the request still returns a success status code, but the model has already “forgotten” the page it just read, showing up as off-topic answers or repeated retrieval. This type of failure is extremely hard to detect. It is advisable to set a pass-through whitelist for content blocks at the gateway and record the sequence of block types in the logging service for retrospective analysis.

    3.2 Sampling parameters are taken over by the server

    Once tool calling, automatic title generation, or a higher safety level is enabled, the sampling pace is controlled by the server, and parameters carried in the request such as temperature and top_p are ignored. This means approaches that rely on fine-grained tuning to control output style will stop working, and stability requirements should be moved forward into prompt constraints, output structure validation, and post-processing.

    3.3 Billing and parsing modes need upfront evaluation

    Document parsing (PDF, Word, presentations, images) is usually billed per page and distinguishes between plain text extraction and layout-aware recognition. Plain text mode is cheaper but loses chart information; layout-aware mode crops out chart regions and inserts them back in place, so the model can truly “see” the charts, at the cost of the cropped images being billed as image input, and chart detection being automated with a risk of missed crops. For chart-heavy materials such as earnings reports and research reports, it is advisable to validate recall on a small sample first, then decide on the mode and budget.

    4. Architecture Recommendations

    1. Access layer: keep the protocol native and avoid having the middleware rewrite the content block structure.
    2. Orchestration layer: leave the “whether to retrieve” decision to the model, and only set timeouts, retries, and tool call limits on the business side.
    3. Data layer: put raw documents and parsing artifacts in object storage, and run parsing tasks asynchronously through a message queue to avoid long documents blocking the main path.
    4. Observability layer: use the logging service to record tool call sequences, retrieval rounds, and token consumption, and use monitoring and alerting to set thresholds on failure rate and latency percentiles.
    5. Fallback strategy: when retrieval is unavailable, degrade to a pure model answer clearly labeled “not connected to the web,” and avoid fabricating citations.

    5. Conclusion

    The essence of opening up capabilities is converging repetitive engineering effort into declarative configuration, and the developer’s competitive edge shifts to scenario design, context governance, and cost control. Validating the pipeline on non-flagship specs first and then migrating smoothly as specs catch up is the more prudent engineering rhythm for now.