Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Emmimal/control-layer
/ functions
Functions
145 in github.com/Emmimal/control-layer
⨍
Functions
145
◇
Types & classes
31
↳
Endpoints
1
↓ 17 callers
Method
validate
(self, user_input: str)
control_layer.py:254
↓ 13 callers
Method
run
( self, user_input: str, constraints: Optional[List[str]] = None, context: str
control_layer.py:876
↓ 10 callers
Method
reserve
(self, name: str, text: str)
control_layer.py:323
↓ 8 callers
Method
build
( self, user_input: str, constraints: List[str], context: str = "", mu
control_layer.py:374
↓ 7 callers
Method
record_failure
(self)
control_layer.py:562
↓ 7 callers
Method
should_retry
(self, failure_mode: FailureMode, attempt: int)
control_layer.py:635
↓ 7 callers
Method
used
(self)
control_layer.py:336
↓ 6 callers
Method
log
(self, record: AuditRecord)
control_layer.py:730
↓ 6 callers
Method
register
(self, name: str, fn: Callable[[str], str])
control_layer.py:671
↓ 5 callers
Function
_apply_base_style
(ax, title, xlabel, ylabel)
demo.py:431
↓ 5 callers
Method
_log_record
( self, audit_id: str, attempt: int, validation: ValidationResult, lat
control_layer.py:1026
↓ 5 callers
Method
_packet
( self, prompt: str, response: str, attempts: int, start: float,
control_layer.py:1047
↓ 5 callers
Method
is_open
(self)
control_layer.py:554
↓ 5 callers
Method
register_fallback
(self, name: str, fn: Callable[[str], str])
control_layer.py:873
↓ 5 callers
Method
remaining
(self)
control_layer.py:339
↓ 5 callers
Method
route
( self, user_input: str, failure_mode: FailureMode )
control_layer.py:676
↓ 4 callers
Method
jittered_delay_s
Exponential backoff with random jitter. Prevents thundering herd when multiple requests retry simultaneously.
control_layer.py:642
↓ 3 callers
Method
all_records
(self)
control_layer.py:739
↓ 3 callers
Method
call
(self, prompt: str)
control_layer.py:801
↓ 3 callers
Method
get_mutation_hint
(self, failure_mode: FailureMode)
control_layer.py:629
↓ 3 callers
Method
record_success
(self)
control_layer.py:557
↓ 3 callers
Method
sanitize
(self, user_input: str)
control_layer.py:285
↓ 2 callers
Method
count
Exact token count via tiktoken, or char/4 heuristic if offline.
control_layer.py:317
↓ 2 callers
Method
failure_distribution
(self)
control_layer.py:743
↓ 2 callers
Function
make_deterministic_llm
(responses: list)
demo.py:118
↓ 2 callers
Method
report
(self)
control_layer.py:346
↓ 1 callers
Method
_bad_response
(self)
demo.py:110
↓ 1 callers
Method
_check_json
( self, response: str, required_keys: List[str] )
control_layer.py:482
↓ 1 callers
Method
_format_constraints
(self, constraints: List[str])
control_layer.py:412
↓ 1 callers
Method
_good_response
(self, prompt: str)
demo.py:105
↓ 1 callers
Method
_hash
(text: str)
control_layer.py:1071
↓ 1 callers
Method
_load_existing
(self)
control_layer.py:716
↓ 1 callers
Method
_make_audit_id
(text: str)
control_layer.py:1075
↓ 1 callers
Method
_quality_score
(self, response: str, schema: ResponseSchema)
control_layer.py:505
↓ 1 callers
Function
chart_1_pass_rate
(naive_rate, cl_rate, ax)
demo.py:445
↓ 1 callers
Function
chart_2_failure_dist
(audit, ax)
demo.py:459
↓ 1 callers
Function
chart_3_retry_dist
(attempts_dist, ax)
demo.py:481
↓ 1 callers
Function
chart_4_latency
(naive_latencies, cl_latencies, ax)
demo.py:505
↓ 1 callers
Function
chart_5_token_budget
(config, ax)
demo.py:526
↓ 1 callers
Function
chart_6_quality_scores
(records, ax)
demo.py:554
↓ 1 callers
Function
demo_1_input_guard
()
demo.py:132
↓ 1 callers
Function
demo_2_schema_enforcement
()
demo.py:172
↓ 1 callers
Function
demo_3_constraint_violation
()
demo.py:222
↓ 1 callers
Function
demo_4_fallback_router
()
demo.py:272
↓ 1 callers
Function
demo_5_benchmark
()
demo.py:316
↓ 1 callers
Function
generate_all_charts
(benchmark_results, cl_packets, config)
demo.py:574
↓ 1 callers
Method
pass_rate
(self)
control_layer.py:757
↓ 1 callers
Function
print_summary_table
(benchmark_results)
demo.py:601
↓ 1 callers
Method
remaining_chars
(self)
control_layer.py:342
↓ 1 callers
Method
to_dict
(self)
control_layer.py:175
↓ 1 callers
Method
write
()
tests/test_control_layer.py:450
Method
__call__
(self, prompt: str)
demo.py:87
Method
__init__
(self, max_input_chars: int = 2000)
control_layer.py:247
Method
__init__
(self, total_tokens: int, encoding_name: str = "cl100k_base")
control_layer.py:306
Method
__init__
( self, system_prompt: str, config: ControlLayerConfig, )
control_layer.py:366
Method
__init__
(self, failure_threshold: int = 5, recovery_seconds: float = 30.0)
control_layer.py:536
Method
__init__
(self, config: ControlLayerConfig)
control_layer.py:626
Method
__init__
(self)
control_layer.py:667
Method
__init__
(self, log_path: str = "audit.jsonl")
control_layer.py:709
Method
__init__
(self, llm_fn: Callable[[str], str], timeout_seconds: float)
control_layer.py:797
Method
__init__
( self, llm_fn: Callable[[str], str], system_prompt: str, schema: Optional[Res
control_layer.py:845
Method
__init__
( self, failure_rate: float = 0.6, failure_mode: FailureMode = FailureMode.SCHEMA_VIOL
demo.py:76
Function
call
(prompt: str)
demo.py:120
Function
default_config
()
tests/test_control_layer.py:43
Method
latency_stats
(self)
control_layer.py:763
Method
llm
(p)
tests/test_control_layer.py:506
Method
max_gt_base
(cls, v, info)
control_layer.py:120
Method
max_positive
(cls, v)
control_layer.py:138
Method
min_lt_max
(self)
control_layer.py:144
Method
reserve_tokens
(self, name: str, tokens: int)
control_layer.py:330
Method
reset
(self)
control_layer.py:575
Method
retry_distribution
(self)
control_layer.py:750
Method
setup_method
(self)
tests/test_control_layer.py:64
Method
setup_method
(self)
tests/test_control_layer.py:152
Method
setup_method
(self)
tests/test_control_layer.py:190
Method
setup_method
(self)
tests/test_control_layer.py:304
Function
simple_layer
(tmp_path, default_config)
tests/test_control_layer.py:48
Method
slow_llm
(p)
tests/test_control_layer.py:380
Method
state
(self)
control_layer.py:545
Method
target
()
control_layer.py:805
Method
test_accurate_count
(self)
tests/test_control_layer.py:116
Method
test_audit_log_written
(self, simple_layer, tmp_path)
tests/test_control_layer.py:565
Method
test_budget_is_returned
(self)
tests/test_control_layer.py:178
Method
test_circuit_breaker_blocks_after_failures
(self, tmp_path)
tests/test_control_layer.py:538
Method
test_circuit_open_never_retried
(self)
tests/test_control_layer.py:320
Method
test_config_validation_rejects_bad_values
(self)
tests/test_control_layer.py:571
Method
test_constraints_appear_in_prompt
(self)
tests/test_control_layer.py:164
Method
test_context_appears_when_provided
(self)
tests/test_control_layer.py:174
Method
test_custom_values_accepted
(self)
tests/test_control_layer.py:593
Method
test_defaults_valid
(self)
tests/test_control_layer.py:588
Method
test_delay_increases_with_attempt
(self)
tests/test_control_layer.py:328
Method
test_empty_input_blocked
(self)
tests/test_control_layer.py:72
Method
test_empty_response_fails
(self)
tests/test_control_layer.py:193
Method
test_error_in_fallback_skipped
(self)
tests/test_control_layer.py:360
Method
test_failure_distribution
(self, tmp_path)
tests/test_control_layer.py:423
Method
test_fallback_triggered_after_exhausted_retries
(self, tmp_path)
tests/test_control_layer.py:522
Method
test_first_non_empty_wins
(self)
tests/test_control_layer.py:347
Method
test_forbidden_phrase_blocked
(self)
tests/test_control_layer.py:226
Method
test_half_open_after_recovery
(self)
tests/test_control_layer.py:273
Method
test_injection_blocked_before_llm
(self, tmp_path)
tests/test_control_layer.py:483
next →
1–100 of 145, ranked by callers