Spaces:
Sleeping
Sleeping
File size: 2,244 Bytes
0d47883 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
from crewai import Agent, Task, Crew, Process, LLM
import os
import json
from modules import llm_g
from schemas import IntroductionOutput
intro_agent = Agent(
role="Training Program Designer",
goal="\n".join(
[
"Design an introduction and training outcomes in Arabic for a training program based on the {topic}, outline {outlines} and outcomes {outcomes}.",
"The introduction must follow the DNA style that was defined and prepared in the Outline Agent:",
"- It can start with a question, fact, statistic, quote, or short story.",
"- Examples:",
" * Question: 'هل تعلم ما هو أكبر حيوان في العالم؟'.",
" * Fact: 'يعد الحوت الأزرق أكبر حيوان في العالم'.",
" * Statistic: 'وصل عدد سكان مدينة الرياض في عام 2021 إلى أكثر من عشر ملايين نسمة'.",
" * Quote: 'حكمة، مثل، قول مأثور'.",
" * Short story: 'محادثة بين شخصين، قصة نجاح، موقف شخصي'.",
"- It should be engaging, motivating, and clearly reflect the content.",
"- It must not exceed 300 words.",
]
),
backstory="\n".join(
[
"This agent acts as a training program designer specialized in writing impactful introductions.",
"It builds outcomes directly from the main units and subtopics generated by the Outline Agent.",
"The introduction uses DNA methodology as established by the Outline Agent to attract learners and link content to objectives.",
"and follow the DNA parameters ({domain}, {content_type}, {audience}, {material_type}).",
]
),
llm=llm_g,
verbose=True,
)
# ====== Task ======
intro_task = Task(
description="\n".join(
[
"Based on the outline (units + subtopics + their descriptions and purposes + objectives + outcomes):",
"Create a short Arabic introduction (≤ 300 words) in DNA style.",
]
),
expected_output="A JSON object in Arabic containing introduction.",
output_json=IntroductionOutput,
agent=intro_agent,
)
|