Index
LLM backend abstraction layer.
Modules:
-
anthropic–Anthropic LLM backend via LiteLLM.
-
base–Abstract LLMBackend base class and factory.
-
ollama–Ollama LLM backend via LiteLLM.
Classes:
-
AnthropicBackend–LLM backend that calls Anthropic models through LiteLLM.
-
LLMBackend–Abstract base class for LLM provider backends.
-
OllamaBackend–LLM backend that calls Ollama models through LiteLLM.
Functions:
-
from_config–Instantiate the correct [
LLMBackend][] from an [LLMConfig][].
AnthropicBackend
¶
AnthropicBackend(config: LLMConfig)
Bases: LLMBackend
LLM backend that calls Anthropic models through LiteLLM.
Parameters:
-
config(LLMConfig) –The LLM configuration section from the Night Brownie runtime config.
Methods:
-
complete–Send a prompt to an Anthropic model and return the text response.
complete
¶
Send a prompt to an Anthropic model and return the text response.
Parameters:
-
prompt(str) –The user prompt to send to the model.
-
system(str | None, default:None) –Optional system prompt.
Returns:
-
str–The model's text response.
LLMBackend
¶
Bases: ABC
Abstract base class for LLM provider backends.
All concrete backends must implement [complete][.].
Methods:
-
complete–Send a prompt to the LLM and return the text response.
complete
abstractmethod
¶
Send a prompt to the LLM and return the text response.
Parameters:
-
prompt(str) –The user prompt to send to the model.
-
system(str | None, default:None) –Optional system prompt to configure model behaviour.
Returns:
-
str–The model's text response as a string.
OllamaBackend
¶
OllamaBackend(config: LLMConfig)
Bases: LLMBackend
LLM backend that calls Ollama models through LiteLLM.
Parameters:
-
config(LLMConfig) –The LLM configuration section from the Night Brownie runtime config.
Methods:
-
complete–Send a prompt to an Ollama model and return the text response.
complete
¶
Send a prompt to an Ollama model and return the text response.
Parameters:
-
prompt(str) –The user prompt to send to the model.
-
system(str | None, default:None) –Optional system prompt.
Returns:
-
str–The model's text response.
from_config
¶
from_config(config: LLMConfig) -> LLMBackend
Instantiate the correct [LLMBackend][] from an [LLMConfig][].
Parameters:
-
config(LLMConfig) –The LLM section of the Night Brownie runtime config.
Returns:
-
LLMBackend–A concrete [
LLMBackend][] instance.
Raises:
-
ValueError–If
config.provideris not a supported backend.