Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ Click the image above to watch the demo of using the Obsidian Plugin Generator.
```
3. Set up environment variables:
- `GROQ_API_KEY`: Your Groq API key (if using Groq)
- `OLLAMA_MODEL`: Your preferred Ollama model (default is "llama3.1")
- `OPENAI_API_KEY`: Your OpenAI API key (if using OpenAI)
- `ANTHROPIC_API_KEY`: Your Anthropic API key (if using Anthropic)
- `OLLAMA_MODEL`: Your preferred Ollama model (default is "gemma3:latest")

## Usage

Expand All @@ -28,7 +30,7 @@ python obsidian_plugin_generator.py [plugin_name] [options]
### Options

- `--vault-path PATH`: Path to Obsidian vault (default: ~/Documents/ObsidianVault)
- `--ai {ollama,groq,anthropic}`: AI service to use (default: ollama)
- `--ai {ollama,groq,anthropic,openai}`: AI service to use (default: ollama)
- `--name`: Name of the plugin (default: "My Obsidian Plugin")

### Examples
Expand All @@ -37,12 +39,13 @@ python obsidian_plugin_generator.py [plugin_name] [options]
python obsidian_plugin_generator.py --name "My Custom Plugin"
python obsidian_plugin_generator.py --name "Task Tracker" --vault-path ~/Obsidian/MyVault
python obsidian_plugin_generator.py --name "Code Snippets" --ai groq
python obsidian_plugin_generator.py --name "AI Assistant" --ai openai --model gpt-5
```

## Features

- AI-powered plugin generation based on user descriptions
- Supports multiple AI services: Ollama and Groq
- Supports multiple AI services: Ollama, Groq, Anthropic, and OpenAI
- Automatically clones and modifies the Obsidian sample plugin
- Generates enhanced TypeScript code for the plugin
- Handles existing directories with options to overwrite, rename, or cancel
Expand Down
9 changes: 7 additions & 2 deletions obsidian_plugin_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def __init__(self, service_type: str, model: Optional[str] = None):
self.model = "llama-3.3-70b-versatile"
elif self.service_type == "ollama":
self.model = "gemma3:latest"
elif self.service_type == "openai":
self.model = "gpt-5"
# Add other defaults if needed

def query(self, prompt: str, max_retries: int = 3) -> str:
Expand All @@ -54,8 +56,11 @@ def query(self, prompt: str, max_retries: int = 3) -> str:
litellm_model = (
f"groq/{model_str}" if not model_str.startswith("groq/") else model_str
)
elif self.service_type == "openai":
# OpenAI models can be used directly without prefix in litellm
litellm_model = model_str
else:
# Assuming direct use for other potential services (like OpenAI)
# Assuming direct use for other potential services
litellm_model = model_str

messages = [{"role": "user", "content": prompt}]
Expand Down Expand Up @@ -360,7 +365,7 @@ def main():
)
parser.add_argument(
"--ai",
choices=["ollama", "groq", "anthropic"],
choices=["ollama", "groq", "anthropic", "openai"],
default="ollama",
help="AI service to use",
)
Expand Down