nemoguardrails.llm.frameworks.default
Module Contents
Classes
Functions
Data
API
Reshape kwargs in place for the Azure preset.
Validates Azure-specific inputs (azure_endpoint or base_url,
azure_deployment, api_version, api_key). Composes the
deployment URL, sets api-version in default_query, and writes
the api-key header so the standard create_model path can build
the client without an Azure-specific branch.
Sets kwargs["api_key"] = None so the standard path does not emit
the Authorization: Bearer header. Azure authenticates via the
api-key header carried in default_headers.
The resource endpoint can be supplied as azure_endpoint (preferred,
matches the OpenAI Python SDK) or base_url (compatibility alias for
v0.21 LangChain configs). Both accept the same value (a resource-only
URL such as https://my-resource.openai.azure.com/); the deployment
path is composed by this preset. Setting both raises an error.
Close all pooled HTTP clients and drop them from the pool.
Connection-pool teardown only. Registered providers are kept.
Mirrors httpx.AsyncClient.aclose() semantics: an async resource
cleanup hook that releases sockets and TLS sessions back to the OS.
Re-creating models after aclose works as expected: the next call
to create_model for a given config rebuilds the client.
If any client.close() fails, all remaining closes are still
attempted; the first error is re-raised after the pool is cleared.
Drop all providers registered via register_provider.
Registry teardown only. Pooled HTTP clients are not affected; if
the registered provider classes constructed clients via the
framework, those clients survive in the pool until aclose().
Test-only convenience: tear down both pools and providers.
Equivalent to await fw.aclose(); fw.clear_providers(). In
production code, prefer the granular methods so connection refresh
doesn’t accidentally drop registered providers.