Module: Ollama::Client::ToolIntent
- Defined in:
- lib/ollama/client/tool_intent.rb
Overview
Tool intent extraction for agent decision pipelines.
Instance Method Summary collapse
-
#generate_tool_intent(prompt:, tools:, model: nil, schema: nil) ⇒ Ollama::ToolIntent?
Extract a structured tool intent from the model using the client's internal schema validators.
Instance Method Details
#generate_tool_intent(prompt:, tools:, model: nil, schema: nil) ⇒ Ollama::ToolIntent?
Extract a structured tool intent from the model using the client's internal schema validators.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ollama/client/tool_intent.rb', line 18 def generate_tool_intent(prompt:, tools:, model: nil, schema: nil) intent_schema = schema || Ollama::Schemas.tool_intent parsed = generate( prompt: prompt, schema: intent_schema, model: model, tools: tools, strict: true ) return nil unless parsed.is_a?(Hash) input = parsed["input"].is_a?(Hash) ? parsed["input"] : {} Ollama::ToolIntent.new(parsed["action"].to_s, input) rescue InvalidJSONError, RetryExhaustedError nil end |