Quick Start
Quick Start Guide
This guide will help you get started with AI-Task by creating a simple text summarization task.
Create Your First Task
Create a new directory for your task:
mkdir my_first_task cd my_first_taskCreate a task file named
summarize.ai:name: "Text Summarizer" description: "Summarizes input text" pipe: - type: "llm" tmpl: | SYSTEM: You are a helpful AI assistant that summarizes text. USER: Please summarize this text: {{ pipein_text }} A: Here is the summary: model: "claude-3-7-sonnet-latest"Create a test input file:
echo "This is a test text that we want to summarize. It contains multiple sentences and demonstrates the basic functionality of the AI-Task package. The package allows us to process text using AI models and create reusable task definitions." > input.txtRun the task:
python -m ai_task.task run summarize.ai --input input.txt --output summary.txtCheck the results:
cat summary.txt
Using Templates
Create a templates directory:
mkdir templatesCreate a template file
templates/summarize.j2:SYSTEM: You are a helpful AI assistant that summarizes text. USER: Please summarize this text: {{ pipein_text }} A: Here is the summary:Update your task file to use the template:
name: "Text Summarizer" description: "Summarizes input text" template_dir: "templates" pipe: - type: "llm" tmpl: "summarize" model: "claude-3-7-sonnet-latest"Run the task again:
python -m ai_task.task run summarize.ai --input input.txt --output summary.txt
Adding More Steps
Update your task to include file operations:
name: "Text Summarizer" description: "Summarizes input text" template_dir: "templates" pipe: - type: "function" function: "aisource" params: file: "input.txt" - type: "llm" tmpl: "summarize" model: "claude-3-7-sonnet-latest" - type: "function" function: "airesult" params: file: "summary.txt"Run the task:
python -m ai_task.task run summarize.ai
Next Steps
Now that you’ve created your first pipeline, you can:
- Learn about the core concepts of AI Task
- Explore more complex examples
- Customize templates for different tasks
- Create custom functions for your specific needs
- Check the API Reference for detailed documentation