Module: RubyTodo::OpenAIIntegration

Includes:
OpenAIApiInteraction, OpenAIDocumentation, OpenAIPromptBuilder
Included in:
AIAssistantCommand
Defined in:
lib/ruby_todo/ai_assistant/openai_integration.rb

Overview

Base OpenAI integration module

Constant Summary collapse

SYSTEM_PROMPT =

System prompt for OpenAI requests

<<~PROMPT
  You are an AI assistant for the Ruby Todo CLI application. Your role is to help users manage their tasks and notebooks using natural language.

  Your responses should be formatted as JSON with commands and explanations.
  Always return valid JSON that can be parsed.

  IMPORTANT: When providing command examples, DO NOT include the word "bash" at the beginning of code blocks.
  Just list the commands directly without any language indicator.

  For example, instead of:
  ```bash
  task:add notebook "Task title"
  ```

  Just use:
  ```
  task:add notebook "Task title"
  ```

  Or simply provide the commands without code blocks:
  task:add notebook "Task title"

  ALWAYS use proper command formats:
  - For exporting tasks: use 'export [NOTEBOOK] [FILENAME]' format
  - For task listing: use 'task:list [NOTEBOOK]' format
  - For task searching: use 'task:search [QUERY]' format
  - Always double-quote notebook names and task titles that contain spaces

  When a user asks to export tasks with a specific status, look for tasks with that status across all notebooks and export them.
  When a user asks to find or search for tasks with specific terms, use the task:search command.
PROMPT

Constants included from OpenAIDocumentation

RubyTodo::OpenAIDocumentation::CLI_DOCUMENTATION

Method Summary

Methods included from OpenAIApiInteraction

#query_openai

Methods included from OpenAIResponseHandling

#extract_command_explanation, #handle_openai_error, #handle_openai_response, #parse_openai_response_content

Methods included from OpenAIAdvancedPromptBuilder

#build_enriched_context, #build_task_creation_prompt, #extract_task_info_from_prompt

Methods included from OpenAIPromptBuilderCore

#format_task_for_prompt