Protocols
Handler protocol for chat providers. Defines a fixed Protocol for all chat provider handler functions. Ensures that all handler functions have exactly the same signature.
typing.Protocol is used to define a structural type that specifies the expected signature of the handler functions, without enforcing a specific class hierarchy. This allows for maximum flexibility in how the handler functions are implemented, while still ensuring that they conform to the expected interface.
- class smarter.apps.provider.services.text_completion.lib.protocols.OpenAICompatiblePassthroughProtocol(*args, **kwargs)[source]
Bases:
ProtocolA Protocol for OpenAI compatible passthrough functions. Ensures that passthrough function call signature conforms to this exact standard.
- Parameters:
request (Request) – The DRF request object.
user_profile (UserProfile) – The user profile making the request.
data (dict[str, Any]) – The OpenAI-compatible chat completion request data.
- Returns:
The response data.
- Return type:
OpenAICompatibleChatCompletionResponseType
- __init__(*args, **kwargs)
- class smarter.apps.provider.services.text_completion.lib.protocols.SmarterChatHandlerProtocol(*args, **kwargs)[source]
Bases:
ProtocolA fixed Protocol for all Smarter chat provider handler functions. Ensures that handler function call signature conforms to this exact standard.
- Parameters:
user_profile (UserProfile) – The user profile making the request.
chat (Chat) – The chat object.
data (Union[dict[str, Any], list]) – The Smarter chat API request data.
plugins (Optional[List[PluginBase]]) – Optional list of plugins to use.
functions (Optional[list[str]]) – Optional list of function names to use.
- Returns:
The response data.
- Return type:
- __init__(*args, **kwargs)