Peter Griffin AI
PeterAi
This class provides methods to explain Linux commands using the Google Generative AI model.
Source code in peter_explains/peter_ai.py
__init__(model_name='gemini-pro')
Initialize the PeterAi class with the specified model.
Args: - model_name (str): The name of the model to use for explaining Linux commands.
Returns: - None
Source code in peter_explains/peter_ai.py
explain_command(command)
async
Explain a Linux command in a JSON format suitable for use in a command-line tool.
This function uses the Google Generative AI model to explain a Linux command in a JSON format suitable for use in a command-line tool. It takes a Linux command as input and returns a JSON object with the following keys:
command_name: The name of the Linux command purpose: A short, funny explanation of its purpose in Peter Griffin's voice. syntax: Basic command structure with optional placeholders for arguments (e.g., "command_name [options]
") options: A few common options. Provide brief, humorous explanations for each. examples: 2-3 examples demonstrating the command's usage. Keep it simple and funny!
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command |
str
|
The Linux command to explain. |
required |
Returns:
Type | Description |
---|---|
CommandExplanation | CommandExplanationWithArguments
|
CommandExplanation | CommandExplanationWithArguments: The explanation of the Linux command. |