HTMLCSSJAVASCRIPTANGULARINTERVIEW QUESTIONSSQLPYTHONJAVAPHPHOW TOW3.CSSCC++C#BOOTSTRAPREACTNEXTJSMYSQLJQUERYEXCELXMLDJANGONUMPYPANDASNODEJSDSATYPESCRIPTANGULARJSGITPOSTGRESQLMONGODBASPAIRGOKOTLINSWIFTSASSVUEGEN AIAGENTIC AIPROMPT ENGINEERINGDOCKERKUBERNETESSPRINGSPRING BOOTUNIXSCIPYAWSCYBERSECURITYDATA SCIENCEINTRO TO PROGRAMMINGINTRO TO HTML & CSSBASHRUSTTOOLS
AI-Powered Full Stack Tutorial 0/70 lessons ~6 min read Lesson 23“React, Next.js, Node, PostgreSQL, LLMs, RAG, agents, and production AI apps”
AI Integration Architecture and Provider Portability
TechLearningPro's tutor, the refund drafter, the file summarizer, and the lesson-panel stream each imported a different vendor SDK.
Course progress0%
Focus
22 guided sections
Practice signal
Examples included
Career prep
Interview Q&A included
AI-Powered Full Stack Development · Lesson 23 · AI and LLM Application Fundamentals
Lesson Overview
TechLearningPro's tutor, the refund drafter, the file summarizer, and the lesson-panel stream each imported a different vendor SDK. Fourteen call sites named that vendor's types in application code. When the vendor had a half-day incident, every feature failed in a different shape: one threw a string, one returned an empty 200, one retried until the token ceiling melted. A second vendor was already approved by security, and the team could not route a single feature to it without rewriting the safety checks and the UI state machine.
The fix is an integration architecture with a port and adapters. Application services depend on a small TypeScript interface: a normalized request, a normalized result, a capability flag, and a normalized error. Each provider lives in an adapter that maps HTTP, auth headers, and vendor JSON into that interface. A registry selects an adapter by configuration. Tests use a fake adapter. The browser, the quiz service, and the review executor never import a vendor SDK.
This lesson closes AI and LLM Application Fundamentals. It assumes you can call a model from the server, parse structured output, stream, measure quality, choose a model under a budget, hold side effects for a human, accept a file, and render a draft. Those are Lessons 12–22. Routing and cost policy from Model Selection, Routing, Latency and Cost Optimization plug in behind the registry. The safety gate from Responsible AI, Safety and Human-in-the-Loop Design stays in front of any effect. Provider-specific model behavior is studied in Generative AI. Tool protocols that must still pass through a port are studied in Agentic.
Planning assumptions:
Two adapters exist in the lab: a fake and a fetch-based adapter whose transport you inject. No live vendor host is required.
Credentials are a SecretHandle resolved at the edge of the adapter. Logs record the handle name.
Illustrative timeouts (8 seconds for a short draft) match earlier lessons. Re-read the current provider's limits when you bind a real base URL.
The port version in this lesson is model-port-v1. Breaking changes mint v2 beside it. They do not silently change the interface.
Learning Objectives
By the end of this lesson you will be able to:
Explain a port as the interface application code calls, and an adapter as the vendor-specific implementation.
Draw the dependency rule: domain services import the port, and only the composition root imports adapters.
Define a normalized text request with prompt version, messages, token cap, timeout, and optional response format.
Define a normalized result with text, model id, and usage counts.
Normalize errors to a closed set: timeout, rate_limited, refused, invalid_response, unavailable, unsupported_capability.
Represent capabilities (text, json, vision, stream) and reject requests an adapter cannot serve.
Implement a fake adapter that supports the success path and each error.
Implement a fetch adapter that accepts an injected fetch, a base URL, and a secret reader, and that never logs the secret.
Register adapters by provider id and resolve them from configuration.
Share one contract test across the fake and the fetch adapter.
Keep vendor response bodies inside the adapter. The API returns the normalized result or a typed error.
Record usage in one shape so cost dashboards survive a provider change.
Version the port and the prompt separately.
Describe a fallback adapter that runs only for unavailable and rate_limited, and that does not rerun after refused.
Hand Module 3 a generation boundary that retrieval can call without knowing which vendor is live.
You know the server holds provider credentials (Lesson 1) and that drafts are not product facts.
You know structured outputs and streaming exist. This lesson normalizes them. It does not re-specify SSE framing.
You will not create a provider account. The fetch adapter is tested with a stub fetch. If you later point it at a real host, load the secret from the environment or a secret manager and keep it out of Git.
What is AI Integration Architecture and Provider Portability?
Integration architecture is the way a product depends on an external model service: where the call sits, which types cross the boundary, how failures look, and how you observe cost. Provider portability is the ability to replace or add a provider by writing an adapter and a configuration change, while tutor, safety, ingest, and UI code keep compiling against the same port.
A port is an interface owned by your application. An adapter is a module that implements the port for one vendor or for a fake. This is the hexagonal style: the domain sits in the middle, and the vendor sits at the edge. The purpose is ordinary engineering. Vendors change prices, models, outage patterns, and JSON shapes. A learning platform that names one vendor in every feature cannot negotiate, cannot fail over, and cannot test without a network.
Teams adopted vendor SDKs quickly because the happy path is a few lines. The historical lesson from databases and payment gateways applies again: hide the vendor at the boundary the moment a second caller appears. TechLearningPro is past that moment. The port you write here is the one Module 3's retrieval flow will call when it asks a model to phrase an answer from supplied passages.
Term
Meaning in this lesson
Port
ModelPort, the only type feature code sees
Adapter
Fake or HTTP implementation of ModelPort
Capability
A feature flag on the adapter: text, json, vision, stream
Normalized usage
inputTokens and outputTokens in one shape
Secret handle
A name resolved to a credential inside the adapter
Registry
Map from provider id to adapter
Port version
model-port-v1, stored on the request metadata
Composition root
The one file that reads config and constructs adapters
Why Do We Need It?
text
Feature code imports VendorSdk
|
v
14 shapes of error, 14 retry policies,
credential handling copied badly
|
v
Outage or price change becomes a rewrite
|
v
Feature code imports ModelPort
|
v
One error union, one usage shape,
one place that sees the secret
Benefits:
A contract test defines "done" for every new provider.
The UI and the safety layer match on error codes from Lesson 20 and Lesson 22.
Cost reporting survives a migration because usage is normalized before it is stored.
A fake adapter keeps CI free of network and free of secrets.
Retrieval can generate from passages by calling complete with a grounded prompt, without a vendor branch in the retriever.
Real World Example
TechLearningPro production configuration names primary: "provider_a" and fallback: "provider_b" as ids. The composition root builds two HTTP adapters with different base URLs and secret handles, plus the fake in test. The tutor service calls ports.for("tutor").complete(request). During a provider incident, operations switches the tutor id to the fallback in configuration and restarts or reloads the process. Safety tickets, quiz writes, and the panel state machine stay on their existing types.
Payments went through this years ago: application code talks to a charge port, and a processor adapter maps vendor errors to declined or unavailable. Banks do the same with market-data vendors. Google, Microsoft, Amazon, and the model labs each publish a different JSON shape for chat. Netflix-style edge gateways already isolate third-party failure domains. TechLearningPro's model gateway is that isolation for generation. The Generative AI course can go deep on one vendor's parameters. This course refuses to let those parameters leak into the lesson player.
Internal Working
A feature builds a ModelRequest: port version, prompt version, messages, maxOutputTokens, timeoutMs, and a responseFormat of text or json.
The feature asks the registry for the adapter configured for that feature.
The adapter checks capabilities. A vision request to a text-only adapter returns unsupported_capability and does not open a socket.
The HTTP adapter resolves SecretHandle to a header value in memory, sets a timeout with AbortSignal, and sends the vendor body.
On success it maps vendor usage numbers into inputTokens and outputTokens. Missing usage becomes usageKnown: false rather than a silent zero that would under-bill a dashboard. Zero is reserved for a vendor field that is actually zero.
On HTTP 429 it returns rate_limited. On abort it returns timeout. On a provider refusal body it returns refused. On a 5xx or a network throw it returns unavailable. On JSON that lacks the expected text it returns invalid_response.
The adapter logs provider id, latency, status class, and token counts. It does not log the Authorization header, the secret, or the full prompt.
The feature receives the normalized result. The tutor maps it to the panel statuses from Lesson 22. The safety service maps refused to a draft outcome and still refuses to execute a ticket that was never approved.
Optional fallback: if the primary returns unavailable or rate_limited, the registry may call the fallback adapter once with the same request. It does not fall back on refused or invalid_response, because those are answers about this prompt, not about reachability.
The browser never performs steps 3–7. It calls your API.
Architecture
flowchart TB
subgraph features [Application features]
Tutor[Tutor service]
Safety[Safety drafter]
Files[File summarizer]
end
subgraph portLayer [Port]
Registry[Adapter registry]
Port[ModelPort v1]
end
subgraph adapters [Adapters]
Fake[Fake adapter]
HttpA[HTTP adapter A]
HttpB[HTTP adapter B]
end
subgraph outside [Outside the process]
Vendor[Provider HTTP API]
Secrets[Secret store]
end
Tutor --> Registry
Safety --> Registry
Files --> Registry
Registry --> Port
Port --> Fake
Port --> HttpA
Port --> HttpB
HttpA --> Secrets
HttpB --> Secrets
HttpA --> Vendor
HttpB --> Vendor
text
Composition root
| reads provider id + secret handle name
v
Registry
|
+--> FakeModelAdapter (tests, local)
+--> FetchModelAdapter (injected fetch)
|
v
Tutor / safety / multimodal call complete()
|
v
Normalized result or normalized error
|
x Vendor types do not leave the adapter file
Request flow crosses the port. Response flow returns through the same port. The database is not on the generation path except to store usage and the prompt version after the call. PostgreSQL remains the system of record for tickets and progress. The provider remains stateless from the product's point of view.
Deep Dive
What the port includes
complete for a bounded text or JSON draft is the required method. Streaming is a capability: stream returns an async iterator of { type: "token", text: string } or a terminal error. Features that need SSE, as in Lesson 16, adapt the iterator to the HTTP response at the edge. Vision is a capability that accepts an object reference your server can resolve, not a browser File and not a vendor URL minted on the client. Tool calls are out of this port's v1. When agents need them, add a separate method in a reviewed v2 or a sibling ToolPort, and keep Lesson 20's executor as the only side-effect writer. The Agentic course is where tool schemas grow. They should still normalize errors the same way.
What stays inside the adapter
URL paths, header names, API-key placement, vendor error codes, and vendor usage field names stay in the adapter. Prompt wording stays with the feature, because the prompt is product policy, versioned as promptVersion. Sampling parameters that you rely on (temperature, JSON mode) are either expressed as port fields you support everywhere or guarded by a capability. If only one vendor can do something, the feature checks the capability and chooses a simpler path on other adapters. That is portability with eyes open: you do not pretend every vendor is identical. You make the difference explicit.
Secret handles
text
config: { secretHandle: "model_primary" }
secret store: resolves the handle in the adapter
log line: secretHandle=model_primary, never the value
The reader interface is read(handle: SecretHandle): Promise<string>. Tests pass a reader that returns a fixed test token string such as test-token and assert the outbound header equals that token while the log sink does not contain it. Do not commit a live key. Do not invent a realistic production key in fixtures.
Usage and cost
Dashboards sum inputTokens and outputTokens by tenant, feature, provider id, and prompt version. When usageKnown is false, the row is excluded from dollar estimates and counted in a data-quality metric. Falling back to a second provider records two usage rows if both were called. A fallback that never ran records one. This is how Lesson 19's budget survives a migration.
Timeouts, retries, idempotency
Generation is not idempotent in its text, and a retry can double the bill. The adapter performs a single attempt with timeoutMs. The registry may try one fallback adapter on unavailable or rate_limited. It does not loop. The feature does not add a third retry. User-initiated retry from Lesson 22 creates a new request. There is no idempotency key on the vendor call itself. Idempotency remains on product effects (the refund ledger), which never move into the adapter.
Port versioning
portVersion: "model-port-v1" is a constant on each request the feature fills in. Adapters reject a mismatched version with unsupported_capability so a half-upgraded worker fails clearly. When you need a new field, add an optional field to v1 if every current adapter can ignore it, or introduce v2 and keep v1 until callers move. Prompt versions are independent: you can ship tutor-explain-v4 on port v1.
Configuration
Environment holds MODEL_PRIMARY_ID, MODEL_PRIMARY_BASE_URL, and MODEL_PRIMARY_SECRET_HANDLE. It does not hold feature prompts. A missing base URL fails process start in production and selects the fake in the test composition root. Fail at boot when a configured adapter cannot be constructed. Fail at request time when a capability is missing.
Code Examples
Place the port in packages/model-port/src/. Adapters live beside it. Feature packages depend on port.ts only.
Simple example: the port
packages/model-port/src/port.ts
typescript
exportconstPORT_VERSION="model-port-v1"asconst;
exporttypeSecretHandle=string;
exportinterfaceModelMessage{
role:"system"|"user";
content:string;
}
exportinterfaceModelRequest{
portVersion:typeofPORT_VERSION;
promptVersion:string;
feature:string;
messages: ModelMessage[];
maxOutputTokens:number;
timeoutMs:number;
responseFormat:"text"|"json";
}
exportinterfaceUsage{
inputTokens:number;
outputTokens:number;
/** False when the vendor omitted counts. Do not treat that as zero spend. */
The vendor JSON type VendorSuccess is private to this file. The path /v1/complete is a stand-in for the lab. When you bind a real provider, replace the URL, the body, and the response mapping inside this class after you read that provider's current documentation. Leave ModelResult alone.
The fallback test registers two fake adapters under primary and fallback. A production registry registers two FetchModelAdapter instances the same way. The refusal case points at a healthy fallback and still returns refused, which is the canFallback policy.
Read those variables in the composition root, not in the tutor. Missing variables throw at startup with the variable name, not with a secret value.
Real-Time Enterprise Example
In production the API process boots the registry once. The tutor feature id resolves to provider_a with fallback provider_b. Usage rows land in model_usage (tenant_id, feature, provider_id, model, prompt_version, input_tokens, output_tokens, usage_known, latency_ms). Finance reads that table after a price-card join that lives outside the request path, because prices change and should not be hard-coded in the adapter. When usage_known is false, the row is flagged for the on-call data check.
An incident runbook has three moves: switch the feature's provider id to the fallback, disable the feature flag from Lesson 20, or do both. Switching providers does not redeploy tutor business logic. Disabling the flag stops spend even if both vendors are unhealthy. The lesson player still uses Lesson 22 statuses, because unavailable and rate_limited already map to failed.
Multi-tenant challenge: a tenant contract forbids vendor B. The registry's complete gains an allowlist argument allowedProviderIds from the tenant policy. A global fallback that the tenant forbids is skipped, and the primary error is returned. The allowlist is data, reviewed like the safety tier table. It is not a string the browser may set.
Challenge on a long outage: do not enqueue unbounded tutor retries. Explanation is interactive. If both adapters fail, record one failure and wait for the learner to retry. Batch jobs such as nightly eval may retry with jitter. They use a different caller and a different budget, still through ModelPort.
Performance Optimization
Keep the port call off the lesson-document request. The player loads content first, as in Lesson 22. Adapter timeouts are finite and cleared in finally so a stuck timer cannot pin the process. Connection reuse is the HTTP client's job; pass the platform fetch or a pooled client into fetchImpl rather than constructing a new agent per call inside feature code.
Avoid loading every vendor SDK into the server bundle. A thin fetch adapter is enough until a vendor feature truly requires a SDK, and that SDK import stays inside the adapter file. JSON parsing of vendor bodies is bounded by the response size limit on the HTTP client. Set that limit so a runaway body cannot exhaust memory.
Cache normalized completions only with the key Lesson 1 described: tenant where required, prompt version, model, and a hash of the authorized input. The adapter itself does not cache. Caching inside the adapter would hide a cross-tenant bug in a layer few feature reviewers read. CPU cost of the mapping is noise next to network time. Spend optimization energy on token caps, fallback rules, and not retrying refusals.
Security
Authentication. The port does not authenticate learners. The feature API does, before complete.
Authorization. The feature decides which excerpt or file pages may enter messages. The adapter sends what it is given, so the feature must be the gate.
Least privilege. The secret handle for generation cannot read the database role that writes refunds. The adapter's network policy can reach the vendor host and the secret store.
Validation. Port version, token cap, timeout, and capability checks reject bad requests before spend.
Secrets.SecretReader is the only source. Logs include secretHandle. Tests assert the token is absent from log lines. Error returns do not include response headers.
Tenant isolation. Usage rows carry tenant_id from the feature, not from the vendor body. Ignore any tenant field a vendor might echo.
Injection. The adapter does not elevate user content. A prompt-injection string in messages is still data. Tools are not on this port.
Supply chain. Pin adapter dependencies. A SDK, if you add one later, is a reviewed dependency of the adapter package only.
OWASP API issues that match: security misconfiguration (secret in logs or client), unrestricted resource consumption (no timeout, fallback loops), and software and data integrity (unpinned vendor contract). The controls are the handle, the single fallback, and the contract test.
Common Mistakes
Importing the vendor SDK in the tutor. Symptom: a provider rename touches UI and safety packages. Cause: the port was skipped "for the first call." Fix: move the import into the adapter and keep it there.
Leaking vendor errors to the browser. Symptom: the client branches on a vendor code and shows a stack. Cause: the route returned response.text(). Fix: return ModelErrorReason only.
Logging the Authorization header. Symptom: a credential in the log vendor. Cause: a fetch wrapper dumped init. Fix: log status, latency, provider id, and handle name. Rotate the secret if it leaked.
Treating missing usage as zero. Symptom: the dashboard shows a free month during a parsing bug. Cause: inputTokens: body.input_tokens ?? 0 with usageKnown left true. Fix: set usageKnown false when fields are absent.
Retrying refusals on the fallback. Symptom: a policy refusal is rephrased by a second model and then shown. Cause: fallback ran for every ok: false. Fix: fall back only on unavailable and rate_limited.
A retry loop inside the adapter. Symptom: bills climb during an outage. Cause: for loop around fetch. Fix: one attempt per adapter, one fallback.
Secret in the repository "for the demo." Symptom: a key in Git history. Cause: a fixture used a real credential. Fix: test-token in memory, rotation, and history cleanup with the security owner.
Capability drift. Symptom: vision uploads hit a text model and fail opaquely. Cause: no capability check. Fix: unsupported_capability before the request.
Prompt text copied into the adapter. Symptom: a provider migration changes tutor behavior. Cause: the system prompt lived in the HTTP body builder. Fix: prompts stay in the feature with promptVersion.
Caching in the adapter by prompt string only. Symptom: cross-tenant answers. Cause: a shortcut cache. Fix: cache in the feature with a tenant-aware key, or do not cache.
Boot continues when the secret handle cannot be read. Symptom: every request fails at the worst time. Cause: lazy init swallowed the error. Fix: resolve configuration at startup.
Port changes without a version. Symptom: an old worker sends a field the new adapter misreads. Fix: PORT_VERSION and a rejection on mismatch.
Best Practices
Own ModelPort in your repository. Treat vendor types as private to adapters.
Export a closed error union and map every vendor failure into it.
Keep prompts and safety policy in feature modules.
Check capabilities before spending a request.
Inject fetch and SecretReader so tests stay offline.
Log handle names, provider ids, latency, and status classes.
Set usageKnown honestly.
Time out every call and clear the timer.
Fall back at most once, and only for reachability errors.
Do not fall back on refusals or schema failures.
Version the port separately from the prompt.
Fail process start when production config is incomplete.
Share a contract test across adapters.
Store usage in your database with tenant, feature, and prompt version.
Keep price cards out of the hot path.
Pin dependencies for adapter packages.
Hide fallback and provider ids from learners. Staff tools may show them.
Re-read vendor docs when you change the private mapping, and note the date in the adapter's module comment.
Give batch eval a separate budget and the same port.
Let Module 3 pass grounded passages in messages without a new vendor branch.
Keep tool execution out of complete.
Review registry changes like you review authentication changes.
Interview Questions & Answers
Beginner
What is the difference between a port and an adapter?
The port is the interface your tutor and safety code call. The adapter is the module that speaks one provider's HTTP or returns a fake. Features import the port.
Why is a fake adapter part of production architecture and not a toy?
It defines the contract, runs in CI without a secret, and can force every normalized error. If the fake cannot express a failure the UI handles, the design is unfinished.
Where does the API key live?
In a secret store, read through SecretReader inside the adapter, referenced by a handle name in configuration. It is absent from the browser, from Git, and from logs.
Intermediate
Which errors may trigger a fallback provider? unavailable and rate_limited. refused and invalid_response return immediately because another provider would be a different policy decision, not a retry of a failed connection.
How do you keep cost reporting stable across vendors?
Map each vendor's counters into inputTokens, outputTokens, and usageKnown before the row is stored. Join to a price card later. Record the provider id on the row so a mix of vendors stays explainable.
What is a capability, and why not try the call and see?
A capability is a declared ability such as json or vision. Checking it returns unsupported_capability without a billed request and without a half-parsed error.
Senior
How would you test a new HTTP adapter?
Run assertHappyPath with a stub fetch. Add cases for 429, 500, abort, refusal JSON, and a body missing text. Assert logs contain the handle name and exclude the test token. Then bind a real host in a manual staging check and record the vendor doc date. Do not weaken the contract to match a quirk. Map the quirk inside the adapter.
Why is generation retry policy different from the refund ledger's idempotency?
A repeated generation spends tokens and can change words. A repeated refund with the same key must not move money twice. The adapter tries once. The ledger, from Lesson 20, replays the effect id.
Architect
How should retrieval use this port in Module 3?
The retriever gathers passages the caller may see and passes them in messages with a prompt version. It calls ModelRegistry.complete. It does not import an adapter. If generation fails, the product can still show the passages. Grounding quality is a retrieval concern. Reachability is a port concern.
When would you accept a vendor SDK despite this design?
When a capability you truly need is impractical over raw HTTP, such as a streaming protocol the SDK maintains. Isolate the SDK inside one adapter package, keep ModelResult stable, and still run the contract test. A second provider without that SDK remains a fetch adapter. The Agentic stack can add a tool port beside this one. It should not dissolve the boundary.
Knowledge Check
1. What problem does this capability solve?
It lets TechLearningPro add, test, and switch model providers without rewriting the tutor, the safety drafts, the file pipeline, or the panel. Failures and usage share one shape.
2. What alternatives exist, and when would you choose each?
A single direct SDK call fits a throwaway spike on one machine. A port plus a fake fits every feature in this course. A second HTTP adapter fits a real fallback. A fallback call fits unavailable and rate_limited only. An in-adapter retry loop fits none of the interactive tutor paths.
3. Which data, identity, and trust boundaries matter?
Features authenticate the user and authorize the content that enters messages. The adapter holds the secret for the duration of one call. Logs hold handle names. The browser holds neither vendor types nor vendor credentials. Usage rows include the tenant from your session, not from the vendor payload.
4. What can fail, and how should the system respond?
Unknown provider ids and 5xx become unavailable. HTTP 429 becomes rate_limited and may try one fallback. Refusals and bad payloads return as themselves. Timeouts abort the fetch. A missing capability returns before the network. The lesson UI maps these to Lesson 22 statuses and still shows the lesson.
5. How would you test quality, security, performance, and cost?
The contract test covers the happy path. Adapter tests cover status mapping and log redaction. Registry tests cover fallback policy. Security review checks startup config and secret handling. Performance review checks a single attempt and a cleared timer. Cost review checks usageKnown and the ban on refusal fallbacks.
Key Takeaways
Features depend on ModelPort, not on a vendor SDK.
Adapters map HTTP, secrets, and vendor JSON at the edge.
Errors belong to a closed union.
Capabilities fail closed before a request is sent.
Usage is normalized, and unknown usage is not stored as a confident zero.
Secrets are handles in config and values only inside the adapter.
Logs omit credentials and raw prompts.
One attempt per adapter, one reachability fallback.
Refusals do not fall back.
The port version and the prompt version are different knobs.
A fake adapter and a shared contract test define compatibility.
The composition root is the only place that reads provider env vars.
Tool side effects stay out of complete.
Retrieval will call this same port with passages attached.
Switching providers is a registry change plus a mapping review, not a UI rewrite.
Summary
Lesson 23 gives the module a stable seam. Tutor explanations, safety drafts, multimodal summaries, and the panel's streaming edge can share one TypeScript port. Vendors sit in adapters that normalize text, usage, and errors, with secrets confined to a reader and tests that prove those secrets stay out of logs. Fallback is deliberate and narrow. That seam is what Module 3 will call when a retrieved passage needs a sentence wrapped around it, and what later agent work will keep even when a sibling port learns to request tools.
Next Lesson Preview
Module 3 opens with Retrieval-Augmented Generation Architecture. You will place a retriever beside this port: authorize passages first, ask ModelPort to draft from those passages, and keep the quiz and the review executor on their existing writers. The provider behind the port can change. The retrieval boundary stays yours.
Further Reading
TypeScript handbook for interfaces and discriminated unions used as the port.
The current chat or responses guide for any provider you bind. Record the URL and the date in the adapter module comment when you replace the lab path /v1/complete.
Generative AI for vendor-specific model behavior that should remain behind the adapter.
Agentic systems for tool-calling designs that should add a port rather than bypass this one.