Raxol.AI.ContentGeneration (Raxol v0.2.0)
View SourceContent generation capabilities for Raxol applications.
This module provides AI-powered content generation for various aspects of terminal UIs, including:
- Text suggestions
- Command completions
- Help content generation
- Documentation generation
- Interactive tutorials
- Contextual hints
The generation is configurable and can be adapted to different contexts within the application.
Summary
Functions
Generates content based on the specified type and prompt.
Generates a contextual help document based on application state.
Generates an interactive tutorial for a specific feature.
Generates text suggestions based on current input context.
Types
Functions
@spec generate(generation_type(), String.t(), keyword()) :: {:ok, String.t()} | {:error, String.t()}
Generates content based on the specified type and prompt.
Options
:max_length
- Maximum length of the generated content (default: 100):style
- Style of the generated content (default: :neutral):tone
- Tone of the generated content (default: :neutral):context
- Additional context for generation (default: %{}):model
- AI model to use for generation (default: :default)
Examples
iex> generate(:text, "Create a welcome message", max_length: 50)
{:ok, "Welcome to the terminal! How can I assist you today?"}
Generates a contextual help document based on application state.
Examples
iex> generate_help(%{current_view: :editor, command_mode: true})
{:ok, %{title: "Editor Mode Commands", content: "..."}}
Generates an interactive tutorial for a specific feature.
Examples
iex> generate_tutorial(:keyboard_shortcuts)
{:ok, %{steps: [...], interactive: true}}
Generates text suggestions based on current input context.
Examples
iex> suggest_text("print(", context: %{language: :python})
{:ok, ["print("Hello, World!")", "print(value)", "print(f"Value: {value}")"]}