Module: Datadog::AIGuard::Contrib::RubyLLM::ChatInstrumentation
- Defined in:
- lib/datadog/ai_guard/contrib/ruby_llm/chat_instrumentation.rb
Overview
module that gets prepended to RubyLLM::Chat
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.evaluate!(messages) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/datadog/ai_guard/contrib/ruby_llm/chat_instrumentation.rb', line 10 def evaluate!() = .flat_map do || if .tool_call? .tool_calls.map do |tool_call_id, tool_call| AIGuard.assistant(id: tool_call_id, tool_name: tool_call.name, arguments: tool_call.arguments.to_s) end elsif .tool_result? AIGuard.tool(tool_call_id: .tool_call_id, content: .content) else AIGuard.(role: .role, content: .content) end end AIGuard.evaluate(*, allow_raise: true) end |