Every LLM provider in ai-blackteam extends BaseProvider. This abstract class defines how ai-blackteam talks to AI models - whether that’s Anthropic’s API, OpenAI, Google, or a local Ollama instance.

Data Classes

Two dataclasses hold results: Two dataclasses hold results:

PromptResult

Returned by send_prompt() and send_in_conversation().

ToolResult

Returned by send_with_tools().
Each tool call dict has this shape:

The BaseProvider Class

Methods

send_prompt(prompt, system_prompt=None) -> PromptResult

Required. Send a single prompt to the model. This is the most basic operation.

send_in_conversation(messages, system_prompt=None) -> PromptResult

Required. Send a conversation history (list of {"role": ..., "content": ...} dicts). Used by multi-turn attacks where each turn builds on previous context.

send_with_tools(messages, tools, system_prompt=None) -> ToolResult

Optional. Send a conversation with tool definitions. Used by tool-use attacks. Returns any tool calls the model wants to make. Default implementation raises NotImplementedError. Only providers that support function calling need to override this.

default_model() -> str

Required. Returns the default model name for this provider.

supports_tools() -> bool

Returns whether this provider supports tool/function calling. Default is False.

get_model_info() -> dict

Returns basic model info. Used internally by the Engine for logging.

The 7 Providers

Source

src/ai-blackteam/providers/base.py