Module: TurnKit
- Defined in:
- lib/turnkit.rb,
lib/turnkit/id.rb,
lib/turnkit/run.rb,
lib/turnkit/cost.rb,
lib/turnkit/tool.rb,
lib/turnkit/turn.rb,
lib/turnkit/agent.rb,
lib/turnkit/clock.rb,
lib/turnkit/error.rb,
lib/turnkit/event.rb,
lib/turnkit/skill.rb,
lib/turnkit/store.rb,
lib/turnkit/usage.rb,
lib/turnkit/budget.rb,
lib/turnkit/client.rb,
lib/turnkit/record.rb,
lib/turnkit/result.rb,
lib/turnkit/message.rb,
lib/turnkit/version.rb,
lib/turnkit/workflow.rb,
lib/turnkit/tool_call.rb,
lib/turnkit/compaction.rb,
lib/turnkit/image_tool.rb,
lib/turnkit/media_input.rb,
lib/turnkit/prompt_data.rb,
lib/turnkit/tool_runner.rb,
lib/turnkit/conversation.rb,
lib/turnkit/image_result.rb,
lib/turnkit/memory_store.rb,
lib/turnkit/output_audit.rb,
lib/turnkit/schema_check.rb,
lib/turnkit/model_request.rb,
lib/turnkit/output_policy.rb,
lib/turnkit/rails/railtie.rb,
lib/turnkit/system_prompt.rb,
lib/turnkit/adapters/codex.rb,
lib/turnkit/prompt_context.rb,
lib/turnkit/sub_agent_tool.rb,
lib/turnkit/tool_execution.rb,
lib/turnkit/load_skill_tool.rb,
lib/turnkit/view_media_tool.rb,
lib/turnkit/adapters/ruby_llm.rb,
lib/turnkit/message_projection.rb,
lib/turnkit/prompt_contribution.rb,
lib/turnkit/media_analysis_result.rb,
lib/turnkit/stores/active_record_store.rb,
lib/turnkit/generators/turnkit/install_generator.rb
Defined Under Namespace
Modules: Adapters, Clock, Compaction, Generators, Id, PromptData, Record, SchemaCheck Classes: ActiveRecordStore, Agent, Budget, BudgetError, Client, CompactionError, ConfigError, Conversation, Cost, Error, Event, ImageResult, ImageTool, InputError, LiveContextContribution, LoadSkillTool, MediaAnalysisResult, MediaInput, MemoryStore, Message, MessageProjection, ModelAccessError, ModelRequest, OutputAudit, OutputPolicy, PromptBuildContext, PromptContribution, Railtie, Result, Run, Skill, Store, StoreError, SubAgentTool, SystemPrompt, Tool, ToolCall, ToolContext, ToolError, ToolExecution, ToolRunner, ToolValidationError, Turn, Usage, ViewMediaTool, Workflow
Constant Summary collapse
- VERSION =
"0.4.1"
Class Attribute Summary collapse
-
.available_skills ⇒ Object
Returns the value of attribute available_skills.
-
.client ⇒ Object
Returns the value of attribute client.
-
.compaction ⇒ Object
Returns the value of attribute compaction.
-
.context_contributors ⇒ Object
Returns the value of attribute context_contributors.
-
.conversation_record_class ⇒ Object
Returns the value of attribute conversation_record_class.
-
.cost_calculator ⇒ Object
Returns the value of attribute cost_calculator.
-
.cost_rates ⇒ Object
Returns the value of attribute cost_rates.
-
.default_model ⇒ Object
Returns the value of attribute default_model.
-
.logger ⇒ Object
Returns the value of attribute logger.
-
.max_depth ⇒ Object
Returns the value of attribute max_depth.
-
.max_iterations ⇒ Object
Returns the value of attribute max_iterations.
-
.max_spend ⇒ Object
Returns the value of attribute max_spend.
-
.max_tool_executions ⇒ Object
Returns the value of attribute max_tool_executions.
-
.max_tool_executions_by_name ⇒ Object
Returns the value of attribute max_tool_executions_by_name.
-
.message_record_class ⇒ Object
Returns the value of attribute message_record_class.
-
.model_prompt_contributors ⇒ Object
Returns the value of attribute model_prompt_contributors.
-
.on_event ⇒ Object
Returns the value of attribute on_event.
-
.output_policy_model ⇒ Object
Returns the value of attribute output_policy_model.
-
.output_policy_thinking ⇒ Object
Returns the value of attribute output_policy_thinking.
-
.prompt_behavior ⇒ Object
Returns the value of attribute prompt_behavior.
-
.prompt_cache ⇒ Object
Returns the value of attribute prompt_cache.
-
.prompt_data_max_chars ⇒ Object
Returns the value of attribute prompt_data_max_chars.
-
.prompt_sections ⇒ Object
Returns the value of attribute prompt_sections.
-
.store ⇒ Object
Returns the value of attribute store.
-
.system_prompt_contributors ⇒ Object
Returns the value of attribute system_prompt_contributors.
-
.timeout ⇒ Object
Returns the value of attribute timeout.
-
.tool_execution_record_class ⇒ Object
Returns the value of attribute tool_execution_record_class.
-
.turn_record_class ⇒ Object
Returns the value of attribute turn_record_class.
Class Method Summary collapse
- .check_output_policy(output, constraints: [], context: {}) ⇒ Object
- .configure {|_self| ... } ⇒ Object
- .model ⇒ Object
- .model=(value) ⇒ Object
- .paint(prompt, model:, provider: nil, size: nil, assume_model_exists: nil, input_images: nil, mask: nil, params: {}, metadata: {}, client: nil) ⇒ Object
- .reconcile_stale!(before: Clock.now - (timeout || 300)) ⇒ Object
- .view_media(media, objective:, model:, provider: nil, output_schema: nil, params: {}, metadata: {}, client: nil) ⇒ Object
Class Attribute Details
.available_skills ⇒ Object
Returns the value of attribute available_skills.
66 67 68 |
# File 'lib/turnkit.rb', line 66 def available_skills @available_skills end |
.client ⇒ Object
Returns the value of attribute client.
59 60 61 |
# File 'lib/turnkit.rb', line 59 def client @client end |
.compaction ⇒ Object
Returns the value of attribute compaction.
63 64 65 |
# File 'lib/turnkit.rb', line 63 def compaction @compaction end |
.context_contributors ⇒ Object
Returns the value of attribute context_contributors.
67 68 69 |
# File 'lib/turnkit.rb', line 67 def context_contributors @context_contributors end |
.conversation_record_class ⇒ Object
Returns the value of attribute conversation_record_class.
70 71 72 |
# File 'lib/turnkit.rb', line 70 def conversation_record_class @conversation_record_class end |
.cost_calculator ⇒ Object
Returns the value of attribute cost_calculator.
65 66 67 |
# File 'lib/turnkit.rb', line 65 def cost_calculator @cost_calculator end |
.cost_rates ⇒ Object
Returns the value of attribute cost_rates.
65 66 67 |
# File 'lib/turnkit.rb', line 65 def cost_rates @cost_rates end |
.default_model ⇒ Object
Returns the value of attribute default_model.
59 60 61 |
# File 'lib/turnkit.rb', line 59 def default_model @default_model end |
.logger ⇒ Object
Returns the value of attribute logger.
59 60 61 |
# File 'lib/turnkit.rb', line 59 def logger @logger end |
.max_depth ⇒ Object
Returns the value of attribute max_depth.
60 61 62 |
# File 'lib/turnkit.rb', line 60 def max_depth @max_depth end |
.max_iterations ⇒ Object
Returns the value of attribute max_iterations.
60 61 62 |
# File 'lib/turnkit.rb', line 60 def max_iterations @max_iterations end |
.max_spend ⇒ Object
Returns the value of attribute max_spend.
62 63 64 |
# File 'lib/turnkit.rb', line 62 def max_spend @max_spend end |
.max_tool_executions ⇒ Object
Returns the value of attribute max_tool_executions.
60 61 62 |
# File 'lib/turnkit.rb', line 60 def max_tool_executions @max_tool_executions end |
.max_tool_executions_by_name ⇒ Object
Returns the value of attribute max_tool_executions_by_name.
61 62 63 |
# File 'lib/turnkit.rb', line 61 def max_tool_executions_by_name @max_tool_executions_by_name end |
.message_record_class ⇒ Object
Returns the value of attribute message_record_class.
71 72 73 |
# File 'lib/turnkit.rb', line 71 def @message_record_class end |
.model_prompt_contributors ⇒ Object
Returns the value of attribute model_prompt_contributors.
68 69 70 |
# File 'lib/turnkit.rb', line 68 def model_prompt_contributors @model_prompt_contributors end |
.on_event ⇒ Object
Returns the value of attribute on_event.
69 70 71 |
# File 'lib/turnkit.rb', line 69 def on_event @on_event end |
.output_policy_model ⇒ Object
Returns the value of attribute output_policy_model.
64 65 66 |
# File 'lib/turnkit.rb', line 64 def output_policy_model @output_policy_model end |
.output_policy_thinking ⇒ Object
Returns the value of attribute output_policy_thinking.
64 65 66 |
# File 'lib/turnkit.rb', line 64 def output_policy_thinking @output_policy_thinking end |
.prompt_behavior ⇒ Object
Returns the value of attribute prompt_behavior.
66 67 68 |
# File 'lib/turnkit.rb', line 66 def prompt_behavior @prompt_behavior end |
.prompt_cache ⇒ Object
Returns the value of attribute prompt_cache.
62 63 64 |
# File 'lib/turnkit.rb', line 62 def prompt_cache @prompt_cache end |
.prompt_data_max_chars ⇒ Object
Returns the value of attribute prompt_data_max_chars.
67 68 69 |
# File 'lib/turnkit.rb', line 67 def prompt_data_max_chars @prompt_data_max_chars end |
.prompt_sections ⇒ Object
Returns the value of attribute prompt_sections.
66 67 68 |
# File 'lib/turnkit.rb', line 66 def prompt_sections @prompt_sections end |
.store ⇒ Object
Returns the value of attribute store.
59 60 61 |
# File 'lib/turnkit.rb', line 59 def store @store end |
.system_prompt_contributors ⇒ Object
Returns the value of attribute system_prompt_contributors.
68 69 70 |
# File 'lib/turnkit.rb', line 68 def system_prompt_contributors @system_prompt_contributors end |
.timeout ⇒ Object
Returns the value of attribute timeout.
60 61 62 |
# File 'lib/turnkit.rb', line 60 def timeout @timeout end |
.tool_execution_record_class ⇒ Object
Returns the value of attribute tool_execution_record_class.
71 72 73 |
# File 'lib/turnkit.rb', line 71 def tool_execution_record_class @tool_execution_record_class end |
.turn_record_class ⇒ Object
Returns the value of attribute turn_record_class.
70 71 72 |
# File 'lib/turnkit.rb', line 70 def turn_record_class @turn_record_class end |
Class Method Details
.check_output_policy(output, constraints: [], context: {}) ⇒ Object
114 115 116 |
# File 'lib/turnkit.rb', line 114 def self.check_output_policy(output, constraints: [], context: {}) OutputAudit.check(output, constraints: constraints, context: context) end |
.configure {|_self| ... } ⇒ Object
96 97 98 |
# File 'lib/turnkit.rb', line 96 def self.configure yield self end |
.model ⇒ Object
100 101 102 |
# File 'lib/turnkit.rb', line 100 def self.model default_model end |
.model=(value) ⇒ Object
104 105 106 |
# File 'lib/turnkit.rb', line 104 def self.model=(value) self.default_model = value end |
.paint(prompt, model:, provider: nil, size: nil, assume_model_exists: nil, input_images: nil, mask: nil, params: {}, metadata: {}, client: nil) ⇒ Object
118 119 120 121 |
# File 'lib/turnkit.rb', line 118 def self.paint(prompt, model:, provider: nil, size: nil, assume_model_exists: nil, input_images: nil, mask: nil, params: {}, metadata: {}, client: nil) image_client = client || self.client image_client.paint(prompt: prompt, model: model, provider: provider, size: size, assume_model_exists: assume_model_exists, input_images: input_images, mask: mask, params: params, metadata: ).images.first end |
.reconcile_stale!(before: Clock.now - (timeout || 300)) ⇒ Object
108 109 110 111 112 |
# File 'lib/turnkit.rb', line 108 def self.reconcile_stale!(before: Clock.now - (timeout || 300)) store.find_stale_turns(before: before).each do |turn| store.update_turn(turn.fetch("id"), "status" => "stale", "completed_at" => Clock.now) end end |
.view_media(media, objective:, model:, provider: nil, output_schema: nil, params: {}, metadata: {}, client: nil) ⇒ Object
123 124 125 126 |
# File 'lib/turnkit.rb', line 123 def self.view_media(media, objective:, model:, provider: nil, output_schema: nil, params: {}, metadata: {}, client: nil) media_client = client || self.client media_client.view_media(media: media, objective: objective, model: model, provider: provider, output_schema: output_schema, params: params, metadata: ).media_analyses.first end |