Provider
dopus.core.Provider
Bases: ABC
Abstract base class to manage requests and responses to LLM providers. Core responsibilities: - transforming Convo messages into the format the LLM expects - transforming tools into the correct format for making the API request - extracting data from the response of the API call
Attributes:
| Name | Type | Description |
|---|---|---|
__messages |
List[Dict[str, Any]]
|
A list of messages. |
request
abstractmethod
request(messages: List[Dict[str, Any]], registry: Any, tools: Optional[List[Any]] = None, system_prompt: str = '') -> Any
Make the completion request to the llm provider
:param messages: List of message dictionaries. :param registry: The registry object. :param tools: Optional list of tools. :param system_prompt: Optional system prompt. :return: The response from the request.
get_tools
abstractmethod
Get a list of tools.
:param tools: List of tools. :param registry: The registry object. :return: List of tools.
extract_tool_call_data
abstractmethod
Extract data from a tool call.
:param tool_call: The tool call dictionary. :return: Extracted data.
build_log
abstractmethod
build_log(response: Any, messages: List[Dict[str, Any]], result: Any, tools: List[Any]) -> Dict[str, Any]
Build a log from a response, messages, result, and tools.
:param response: The response object. :param messages: List of message dictionaries. :param result: The result object. :param tools: List of tools. :return: The log dictionary.
get_tool_calls
abstractmethod
Get tool calls from a response.
:param response: The response object. :return: List of tool call dictionaries.
on_stop
Handle when the agentic loop stops.
:param convo: The conversation object. :param result: Optional result to be processed.