Targets¶
LLM API targets. A target executes a Stimulus and returns a Transcript;
providers implement _complete(messages).
LLMTarget¶
Bases: ABC
Abstract base class for LLM targets.
Subclasses implement name and _complete. interact and query are
provided by the base class.
Source code in src/rotalabs_redqueen/llm/targets.py
name: str
abstractmethod
property
¶
Human-readable name, e.g. openai:gpt-4.
id: str
property
¶
Stable target id (redqueen-spec). Defaults to :attr:name.
aclose() -> None
async
¶
query(prompt: str) -> TargetResponse
async
¶
interact(stimulus: Stimulus) -> Transcript
async
¶
Execute a Stimulus and return a Transcript.
Source code in src/rotalabs_redqueen/llm/targets.py
OpenAITarget¶
Bases: LLMTarget
OpenAI API target (GPT-4, etc.).
Source code in src/rotalabs_redqueen/llm/targets.py
AnthropicTarget¶
Bases: LLMTarget
Anthropic API target (Claude).
Source code in src/rotalabs_redqueen/llm/targets.py
GeminiTarget¶
Bases: LLMTarget
Google Gemini API target.
Source code in src/rotalabs_redqueen/llm/targets.py
OllamaTarget¶
Bases: LLMTarget
Local Ollama target (chat API).
Source code in src/rotalabs_redqueen/llm/targets.py
MockTarget¶
Bases: LLMTarget
Mock target for testing and conformance.
Deterministic by design: the response is a pure function of the message text (no global RNG, clock, or network), as required for reproducible runs and conformance (redqueen-spec conformance.md §1.3).
Source code in src/rotalabs_redqueen/llm/targets.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | |
create_target¶
Create a target from a provider:model spec string.
Source code in src/rotalabs_redqueen/llm/targets.py
TargetResponse¶
A single completion from a provider (internal to a Target).
Source code in src/rotalabs_redqueen/llm/targets.py
Errors¶
TargetError¶
RateLimitError¶
Bases: TargetError
Rate limit exceeded.
NetworkError¶
Bases: TargetError
Network connectivity error.