Module: Legion::LLM::Audit
- Extended by:
- Legion::Logging::Helper
- Defined in:
- lib/legion/llm/audit.rb,
lib/legion/llm/audit/exchange.rb,
lib/legion/llm/audit/tool_event.rb,
lib/legion/llm/audit/skill_event.rb,
lib/legion/llm/audit/prompt_event.rb
Defined Under Namespace
Classes: PromptEvent, SkillEvent, ToolEvent
Constant Summary
collapse
- Exchange =
Legion::LLM::Transport::Exchanges::Audit
Class Method Summary
collapse
Class Method Details
.emit_prompt(event) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/legion/llm/audit.rb', line 19
def emit_prompt(event)
if transport_connected? && defined?(Legion::LLM::Audit::PromptEvent)
Legion::LLM::Audit::PromptEvent.new(**event).publish
log.info('[llm][audit] published prompt audit')
:published
else
log.warn('[llm][audit] dropped prompt audit: transport unavailable')
:dropped
end
rescue StandardError => e
handle_exception(e, level: :warn, operation: 'llm.audit.emit_prompt')
:dropped
end
|
.emit_skill(**event) ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/legion/llm/audit.rb', line 47
def emit_skill(**event)
if transport_connected? && defined?(Legion::LLM::Audit::SkillEvent)
Legion::LLM::Audit::SkillEvent.new(**event).publish
log.info('[llm][audit] published skill audit')
:published
else
log.warn('[llm][audit] dropped skill audit: transport unavailable')
:dropped
end
rescue StandardError => e
handle_exception(e, level: :warn, operation: 'llm.audit.emit_skill')
:dropped
end
|
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/legion/llm/audit.rb', line 33
def emit_tools(event)
if transport_connected? && defined?(Legion::LLM::Audit::ToolEvent)
Legion::LLM::Audit::ToolEvent.new(**event).publish
log.info('[llm][audit] published tool audit')
:published
else
log.warn('[llm][audit] dropped tool audit: transport unavailable')
:dropped
end
rescue StandardError => e
handle_exception(e, level: :warn, operation: 'llm.audit.emit_tools')
:dropped
end
|
.transport_connected? ⇒ Boolean
61
62
63
64
|
# File 'lib/legion/llm/audit.rb', line 61
def transport_connected?
!!(defined?(Legion::Settings) &&
Legion::Settings[:transport][:connected] == true)
end
|