Built-in Module
ai.generate
Generate text using AI models. Supports Ollama, OpenAI, and custom endpoints.
Configuration
| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | The prompt to send to the AI model |
| model | string | No | Model name (default: from config.yaml) |
| system_prompt | string | No | System instructions for the model |
| max_tokens | number | No | Max tokens in response |
Provider Configuration
Configure your AI provider in .shiro/config.yaml:
Ollama (Local)
yaml
ai:
provider: ollama
model: llama3.2
endpoint: http://localhost:11434OpenAI
yaml
ai:
provider: openai
model: gpt-4o
api_key: "{{env.OPENAI_API_KEY}}"Custom Endpoint
yaml
ai:
provider: custom
model: my-model
endpoint: https://my-ai-api.example.com
api_key: "{{env.CUSTOM_API_KEY}}"Examples
Code Review
json
{
"id": "review",
"type": "ai.generate",
"config": {
"system_prompt": "You are an expert code reviewer. Be concise and actionable.",
"prompt": "Review this diff and identify issues:\n{{steps.get_diff.diff}}",
"model": "gpt-4o"
},
"depends_on": ["get_diff"]
}Commit Message Generation
json
{
"id": "gen_commit_msg",
"type": "ai.generate",
"config": {
"prompt": "Write a conventional commit message for:\n{{steps.get_diff.diff}}",
"max_tokens": 100
},
"depends_on": ["get_diff"]
}Output
text- Generated text responsemodel- Model usedtokens_used- Token count (if available)