ContiAI / agents /analysis_phase /Introduction.py
ziadsameh32's picture
final-version
0d47883
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,
)