Spaces:
Sleeping
Sleeping
| 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, | |
| ) | |