Authentication#
Langworks provides various general utilities to ease accessing resources requiring authentication.
- type langworks.auth.Authenticator = Callable[[Middleware], AuthenticationDetails]#
Callable invoked by an
Middleware
when seeking access to an external resource.
- langworks.auth.UsernameCredentials(username: str, password: str | None = None) AuthenticationDetails #
Generates an
Authenticator
that generates authentication details with the given username and password.Parameters#
- username
Username with which to authenticate against the LLM provider.
- password
Password with which to authenticate against the LLM provider.
- langworks.auth.TokenCredentials(token: str = None) AuthenticationDetails #
Generates an
Authenticator
that generates authentication details with the given tokenParameters#
- token
Token with which to authenticate against the LLM provider.
- class langworks.auth.AuthenticationDetails#
Holds authentication details that may be retrieved by an
Authenticator
.Properties#
- password: str | None = None#
Password with which to authenticate against the LLM provider.
- token: str | None = None#
Access token with which to authenticate against the LLM provider.
- username: str | None = None#
Username with which to authenticate against the LLM provider.