Elder¶
The judge in The Arena.
Elder¶
orc.themed.elder.Elder
¶
The Elder judges combat between Warriors.
Example
elder = Elder( evaluator_model="claude-3-opus", evaluation_criteria="Judge based on code quality and efficiency.", )
Or with a pre-built judge:¶
elder = Elder(judge=MetricsJudge(weights={"accuracy": 0.7, "latency": 0.3}))
Source code in orc/themed/elder.py
judge
property
¶
Get or create the underlying Judge instance.
__init__(evaluator_model=None, evaluation_criteria=None, judge=None, llm=None)
¶
Initialize an Elder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
evaluator_model
|
Optional[str]
|
LLM model to use for evaluation (e.g., "claude-3-opus"). |
None
|
evaluation_criteria
|
Optional[str]
|
Custom criteria for evaluation. |
None
|
judge
|
Optional[Judge]
|
Pre-built Judge instance (overrides evaluator_model if provided). |
None
|
llm
|
Optional[Any]
|
LLMProvider instance for LLM-based judging. |
None
|
Source code in orc/themed/elder.py
evaluate(task, submissions)
async
¶
Evaluate warrior submissions and determine the victor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
str
|
The task/challenge description. |
required |
submissions
|
List[Submission]
|
List of warrior submissions (typically 2). |
required |
Returns:
| Type | Description |
|---|---|
Verdict
|
Verdict with the winner and reasoning. |
Source code in orc/themed/elder.py
TheArena (Themed API)¶
orc.themed.the_arena.TheArena
¶
Bases: Arena
The Arena where Warriors compete for supremacy.
Same functionality as Arena but accepts Warriors and Elders directly, and produces themed console output.
Example
arena = TheArena( warriors=[grog, thrall, sylvanas], elder=elder, challenge_probability=0.3, )
result = await arena.battle("Optimize the database queries")
Source code in orc/themed/the_arena.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
__init__(warriors, elder, challenge_probability=0.3, **config_kwargs)
¶
Initialize TheArena.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warriors
|
List[Warrior]
|
List of Warrior agents competing. |
required |
elder
|
Elder
|
Elder judge to evaluate trials. |
required |
challenge_probability
|
float
|
Base probability of challenge (0-1). |
0.3
|
**config_kwargs
|
Any
|
Additional Arena config options. |
{}
|
Source code in orc/themed/the_arena.py
battle(task, domain=None, context=None)
async
¶
Execute a battle (alias for process).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
str
|
The challenge to execute. |
required |
domain
|
Optional[str]
|
Optional domain hint. |
None
|
context
|
Optional[Dict[str, Any]]
|
Execution context. |
None
|
Returns:
| Type | Description |
|---|---|
TrialResult
|
TrialResult with the outcome. |
Source code in orc/themed/the_arena.py
get_warchief(domain)
¶
Get the Warchief (current leader) for a domain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
domain
|
str
|
The domain to query. |
required |
Returns:
| Type | Description |
|---|---|
Optional[Warchief]
|
Warchief instance or None if no leader. |
Source code in orc/themed/the_arena.py
Warchief¶
orc.themed.warchief.Warchief
¶
The victorious Warrior, granted command.
After winning a trial, the Warchief can delegate sub-tasks to the defeated Warriors.
Example
warchief = Warchief( warrior=victor, domain="data_analysis", reputation=0.95 ) warchief.command(defeated_warrior) print(f"Warband size: {len(warchief.warband)}")
Source code in orc/themed/warchief.py
name
property
¶
The Warchief's name (from the underlying warrior).
warband
property
¶
All warriors under the Warchief's command.
__init__(warrior, domain, reputation)
¶
Initialize a Warchief.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warrior
|
Warrior
|
The Warrior who won the trial. |
required |
domain
|
str
|
The domain they now control. |
required |
reputation
|
float
|
Their reputation score for this domain. |
required |