Sycophant.Registry
(sycophant v0.4.2)
Copy Markdown
Extensible registry for auth strategies and wire protocols.
Built-in adapters are seeded when the Sycophant application starts.
Library users can register additional adapters from their own
Application.start/2:
Sycophant.Registry.register_auth!(:my_provider, MyApp.Auth.Custom)
Sycophant.Registry.register_protocol!(:chat, :my_proto, MyApp.WireProtocol.Custom)
Sycophant.Registry.register_protocol!(:embedding, :my_embed, MyApp.EmbeddingProto.Custom)Overriding a built-in key is allowed -- the last registration wins.
Summary
Functions
Looks up the auth strategy module for provider.
Looks up the protocol adapter module for the given kind and protocol_name.
Registers a custom authentication strategy for the given provider.
Registers a custom protocol adapter under the given kind and protocol_name.
Types
Functions
Looks up the auth strategy module for provider.
Looks up the protocol adapter module for the given kind and protocol_name.
Registers a custom authentication strategy for the given provider.
The module must implement the Sycophant.Auth behaviour. Raises
Sycophant.Error.Invalid.InvalidRegistration if it does not.
Sycophant.Registry.register_auth!(:my_provider, MyApp.Auth.Custom)
Registers a custom protocol adapter under the given kind and protocol_name.
The module must implement Sycophant.WireProtocol for :chat kind or
Sycophant.EmbeddingWireProtocol for :embedding kind. Raises
Sycophant.Error.Invalid.InvalidRegistration if it does not.
Sycophant.Registry.register_protocol!(:chat, :my_proto, MyApp.WireProtocol.Custom)
Sycophant.Registry.register_protocol!(:embedding, :my_embed, MyApp.EmbeddingProto.Custom)