subashpoudel commited on
Commit
3c1150c
·
1 Parent(s): a0929ab

New commit

Browse files
__pycache__/main.cpython-312.pyc CHANGED
Binary files a/__pycache__/main.cpython-312.pyc and b/__pycache__/main.cpython-312.pyc differ
 
brainstroming_agent/utils/__pycache__/nodes.cpython-312.pyc CHANGED
Binary files a/brainstroming_agent/utils/__pycache__/nodes.cpython-312.pyc and b/brainstroming_agent/utils/__pycache__/nodes.cpython-312.pyc differ
 
brainstroming_agent/utils/__pycache__/prompts.cpython-312.pyc CHANGED
Binary files a/brainstroming_agent/utils/__pycache__/prompts.cpython-312.pyc and b/brainstroming_agent/utils/__pycache__/prompts.cpython-312.pyc differ
 
brainstroming_agent/utils/__pycache__/tools.cpython-312.pyc CHANGED
Binary files a/brainstroming_agent/utils/__pycache__/tools.cpython-312.pyc and b/brainstroming_agent/utils/__pycache__/tools.cpython-312.pyc differ
 
brainstroming_agent/utils/__pycache__/utils.cpython-312.pyc CHANGED
Binary files a/brainstroming_agent/utils/__pycache__/utils.cpython-312.pyc and b/brainstroming_agent/utils/__pycache__/utils.cpython-312.pyc differ
 
brainstroming_agent/utils/nodes.py CHANGED
@@ -26,7 +26,7 @@ def caption_image(state: State) -> State:
26
  {
27
  "role": "user",
28
  "content": [
29
- {"type": "text", "text": image_captioning_prompt},
30
  {
31
  "type": "image_url",
32
  "image_url": {
 
26
  {
27
  "role": "user",
28
  "content": [
29
+ {"type": "text", "text": image_captioning_prompt(state.idea,state.business_details)},
30
  {
31
  "type": "image_url",
32
  "image_url": {
brainstroming_agent/utils/prompts.py CHANGED
@@ -1,17 +1,44 @@
1
- story_to_prompt = '''
2
- You are an expert in crafting vivid, cinematic prompts for image generation models like Midjourney, DALL·E, or Stable Diffusion.
 
3
 
4
- Given a paragraph describing a visual scene, rewrite it as a single, detailed sentence that captures the atmosphere, key visual elements, emotions, and composition as if directing a high-quality cinematic image.
 
 
 
 
 
 
5
 
6
- Example input:
7
- "A bustling street scene sets the tone for a culinary journey, as the camera pans across the exterior of a cozy vegetarian restaurant, with the sign 'Vegetarian Delights' prominently displayed. The camera takes us inside, where the warm and inviting atmosphere is filled with the aroma of spices and the soft glow of lighting, highlighting the menu and the chefs expertly preparing a variety of vegetarian dishes. A satisfied customer takes a bite of their meal, with a look of delight on their face, as the camera zooms in on the flavors and textures of the dish, evoking a sense of joy and contentment."
8
 
9
- Desired output:
10
- "A cinematic street scene reveals the charming exterior of 'Vegetarian Delights,' then glides into a warmly lit, spice-scented interior where skilled chefs craft vibrant vegetarian dishes and a delighted diner savors each flavorful bite in glowing ambiance."
11
- '''
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
- image_captioning_prompt = '''
14
- Analyze the image deeply and give the story of the image what it potraits in just 50 words.
 
15
  '''
16
 
17
 
 
1
+ def story_to_prompt():
2
+ return """
3
+ You are a professional prompt engineer for image generation models.
4
 
5
+ Your task is to read a full scene-by-scene video story and generate a **single, vivid, high-quality visual prompt** that captures the **overall essence and identity** of the video. The goal is to produce an image that would represent the story's core themes, mood, and style as a **display image or visual thumbnail**.
6
+ The scene-by-scene video story will be passed to you by the human.
7
+ 🎯 Instructions:
8
+ - Summarize the key visual themes, characters, mood, setting, and action from across the entire story.
9
+ - Focus on the most visually iconic or emotionally powerful moment.
10
+ - Avoid generic phrases. Be specific about details like setting, time of day, lighting, colors, characters, and mood.
11
+ - The output should be a **one-line image generation prompt**, rich in visual cues.
12
 
13
+ **Important Reminder**
14
+ You have to give very special focus on the **idea** and the **business details** which will be provided to you through the tool.
15
 
16
+ This prompt will be used with an image model like DALL·E, Midjourney, or SDXL, so make it detailed and descriptive, but not too long. Avoid repeating the full story — just translate it into a powerful visual scene.
17
+
18
+ Respond with only the final image generation prompt.
19
+ """
20
+
21
+ def image_captioning_prompt(state):
22
+ return f'''
23
+ You are a highly skilled video strategist and visual storyteller.
24
+
25
+ Your task is to analyze the uploaded image in the context of the provided **business details** and **video idea**, and generate a detailed, creative caption that also helps define the most suitable type of **video story** to be created from it.
26
+
27
+ 🎯 Your objective:
28
+ - Describe the image vividly and meaningfully in exactly **100 words**.
29
+ - Reflect on what emotions, visual tone, and setting the image conveys.
30
+ - Use this insight to **recommend the best direction** for a video story (e.g., emotional journey, behind-the-scenes, fast-paced montage, cinematic lifestyle story, etc.).
31
+ - Strongly align your caption and recommendation with the **brand’s identity** and the **purpose of the video idea**.
32
+
33
+ Only use the visual cues from the image to inspire your caption, but ensure it fits within the world of the business and supports the human-provided idea.
34
+
35
+ Here are the provided **business details** and **video idea** for you. Strongly focus on these two contexts too.
36
+ 1. Business details: {state.business_details}
37
+ 2. Video idea: {state.video_idea}
38
 
39
+ Now generate:
40
+ - A rich 100-word image caption, and
41
+ - A 1-line recommendation for the most suitable video storytelling direction based on your analysis.
42
  '''
43
 
44
 
brainstroming_agent/utils/tools.py CHANGED
@@ -39,7 +39,7 @@ def retrieve_tool(video_topic):
39
 
40
  # === Encode the query and search ===
41
  query_embedding = ST.encode(str(video_topic)).reshape(1, -1).astype('float32')
42
- top_k=3
43
  distances, indices = index.search(query_embedding, top_k)
44
 
45
 
 
39
 
40
  # === Encode the query and search ===
41
  query_embedding = ST.encode(str(video_topic)).reshape(1, -1).astype('float32')
42
+ top_k=10
43
  distances, indices = index.search(query_embedding, top_k)
44
 
45
 
brainstroming_agent/utils/utils.py CHANGED
@@ -50,21 +50,19 @@ def process_image(base64_str: str) -> Image.Image:
50
  return Image.open(BytesIO(image_data))
51
 
52
 
53
- def generate_prompt(final_story):
54
  print('************Entering prompt generator****************')
55
- messages = [
56
- (
57
- "system",
58
- story_to_prompt,
59
- ),
60
- ("human", final_story),
61
- ]
62
  prompt = llm.invoke(messages)
63
  print('The prompt is:',prompt)
64
  return prompt.content
65
 
66
- def generate_image(final_story):
67
- prompt = generate_prompt(final_story)
68
  print('************Finished prompt generator****************')
69
 
70
  client = InferenceClient(
@@ -82,9 +80,16 @@ def generate_image(final_story):
82
  )
83
  print('*****************Image Created*******************')
84
 
85
- image.save('image.png')
86
- print('*****************Image Saved*******************')
87
- return "Image Created"
 
 
 
 
 
 
 
88
 
89
 
90
  def save_to_db(business_details):
 
50
  return Image.open(BytesIO(image_data))
51
 
52
 
53
+ def generate_prompt(final_story,business_details,refined_ideation):
54
  print('************Entering prompt generator****************')
55
+ messages = [SystemMessage(content=story_to_prompt()),
56
+ HumanMessage(content=f'''The scene-by-scene video story is {final_story}'''),
57
+ ToolMessage(content=f'''The business details is:\n{business_details}\nThe idea is{refined_ideation}''',tool_call_id='prompt_generation_id')
58
+ ]
59
+
 
 
60
  prompt = llm.invoke(messages)
61
  print('The prompt is:',prompt)
62
  return prompt.content
63
 
64
+ def generate_image(final_story, business_details, refined_ideation):
65
+ prompt = generate_prompt(final_story, business_details, refined_ideation)
66
  print('************Finished prompt generator****************')
67
 
68
  client = InferenceClient(
 
80
  )
81
  print('*****************Image Created*******************')
82
 
83
+ # Convert image to BytesIO buffer
84
+ buffered = BytesIO()
85
+ image.save(buffered, format="PNG") # you can also use "JPEG" if preferred
86
+ buffered.seek(0)
87
+
88
+ # Encode to base64 string
89
+ img_base64 = base64.b64encode(buffered.read()).decode("utf-8")
90
+ print('*****************Image Encoded to Base64*******************')
91
+
92
+ return img_base64
93
 
94
 
95
  def save_to_db(business_details):
context_analysis_agent/utils/__pycache__/nodes.cpython-312.pyc CHANGED
Binary files a/context_analysis_agent/utils/__pycache__/nodes.cpython-312.pyc and b/context_analysis_agent/utils/__pycache__/nodes.cpython-312.pyc differ
 
context_analysis_agent/utils/nodes.py CHANGED
@@ -16,6 +16,6 @@ def extract_business_details(interactions):
16
  messages = [SystemMessage(content=template)]
17
  response=llm.with_structured_output(DetailsFormatter).invoke(messages)
18
  return response
19
-
20
 
21
 
 
16
  messages = [SystemMessage(content=template)]
17
  response=llm.with_structured_output(DetailsFormatter).invoke(messages)
18
  return response
19
+
20
 
21
 
dummy_state.py ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ stored_data={}
2
+ # stored_data['business_details']={"business_type": "fitness and gym", "platform": "instagram, tiktok", "target_audience": "every software needed clients", "business_goals": "to expand in every cities of nepal", "offerings": "nepali cloths and products", "Challenges_faced": "finding new customers, attracting large customers"}
3
+ stored_data['business_details'] = {
4
+ "business_type": "fitness and gym",
5
+ "platform": "Instagram, TikTok",
6
+ "target_audience": "young Nepali adults (ages 18–40) who are health-conscious and active on social media",
7
+ "business_goals": "to expand gym branches across all major cities of Nepal and build a strong fitness community",
8
+ "offerings": "personal training, group fitness classes, modern workout equipment, nutrition guidance, and wellness programs",
9
+ "Challenges_faced": "attracting loyal members, standing out in a competitive market, and promoting consistent engagement"
10
+ }
11
+
12
+
13
+
14
+ stored_data['final_ideation']= ['''A street magician performs tricks, leaving a crowd awestruck. One trick falters, inspiring him to hit the gym. Months later, he fuses fitness with magic, showcasing strength through performance, proving that transformation can captivate and inspire a community''',
15
+ '''A group of strangers attends a quirky food festival, each trying bizarre dishes. One adventurer finds a fitness coach among them. They bond over health, sparking a weekly workout group that brings the community together, blending fun and fitness effortlessly.''',
16
+ '''A lost hiker discovers a hidden waterfall, but slips on the rocks, nearly falling. A passing fitness enthusiast helps him up, encouraging regular exercise for safety and strength. Together, they start a hiking club, uniting fitness and nature lovers in their city''',
17
+ '''A young Nepali woman discovers a hidden strength within herself while hiking the Himalayas. She returns home, and her fitness journey begins at our gym. With the help of our personal trainers, she transforms her body and mind. The gym becomes her sanctuary, and her transformation inspires others to find their inner strength.''']
18
+
19
+ stored_data['human_ideation_interactions'] = []
20
+ stored_data['refined_ideation'] = '''A street magician's trick fails, inspiring a fitness journey. Months later, he fuses magic with strength, showcasing transformation. Meanwhile, a fitness coach bonds with foodies over health, sparking a community workout group, blending fun and fitness.'''
21
+
22
+
23
+ stored_data['brainstroming_response']={
24
+ "carry_on": 'false',
25
+ "idea": [
26
+ "A street magician performs tricks that leave a crowd in awe, but one trick falters, leading him to hit the gym for strength training. While hiking to find inspiration, he slips near a hidden waterfall, but a fitness enthusiast saves him. This encounter sparks a friendship, and together they form a hiking and fitness club, blending magic with nature and strength. Their journey inspires the community to embrace fitness as a way to transform lives, showcasing how personal growth can captivate and unite people."
27
+ ],
28
+ "brainstroming_topics": [
29
+ {
30
+ "topic1": "Incorporate a time-lapse sequence showcasing the magician's transformation from a city performer to a nature-loving fitness enthusiast, highlighting the contrast between urban and natural environments.",
31
+ "topic2": "Introduce a subplot where the magician and the fitness enthusiast collaborate with local environmental organizations to promote eco-friendly fitness practices and community involvement.",
32
+ "topic3": "Add a dramatic twist where the magician must overcome a personal fear or phobia, such as acrophobia, to complete a challenging hike or fitness feat, emphasizing the emotional and mental aspects of personal growth.",
33
+ "topic4": "Develop a secondary character, a young and aspiring magician who joins the hiking and fitness club, allowing the story to explore mentorship, generational connections, and the passing of knowledge from one magician to the next."
34
+ },
35
+ {
36
+ "topic1": "Incorporate a 'Member of the Month' segment, where a club member shares their personal transformation story, highlighting the impact of the club on their life, and showcasing their achievements through a mix of interviews, workout footage, and before-and-after photos.",
37
+ "topic2": "Develop a 'Nature Escape' series, where the club organizes guided hikes and outdoor activities in unique, breathtaking locations, capturing the experiences through drone footage, time-lapses, and member testimonials, to inspire viewers to connect with nature and fitness.",
38
+ "topic3": "Create a 'Fitness Challenge' series, where club members participate in fun, themed workouts, such as a 'Mountain Madness' hike or a 'River Run' challenge, and share their progress on social media using a branded hashtag, encouraging viewers to join in and share their own fitness journeys.",
39
+ "topic4": "Produce a 'Behind-the-Scenes' documentary-style video, showcasing the club's community events, such as fitness festivals, charity runs, or wellness workshops, and highlighting the club's impact on the local community, to create an emotional connection with viewers and showcase the club's values and mission."
40
+ }
41
+ ],
42
+ "preferred_topics": [],
43
+ "stories": [
44
+ "**Promotional Video Storyline: \"Transforming Lives through Fitness and Nature\"**\n\n**Scene 1: Introduction to the Street Magician**\nThe video opens with a street magician performing mesmerizing tricks for a crowd in a bustling city square. The magician's skills and charisma leave the audience in awe, with people clapping and cheering for more. This scene showcases the magician's talent and sets the tone for the story.\n\n**Scene 2: The Faltering Trick**\nAs the magician attempts a particularly complex trick, it falters, and the crowd's enthusiasm wanes. The magician, feeling defeated, realizes the need to improve physical strength and endurance to perfect the craft. This scene introduces the idea that even the most skilled individuals can face challenges and require personal growth.\n\n**Scene 3: Hitting the Gym**\nThe magician decides to join a gym to enhance physical strength and endurance. The scene cuts to a modern gym setting, where the magician begins a rigorous strength training program. This scene highlights the importance of fitness in achieving personal goals.\n\n**Scene 4: The Encounter with the Fitness Enthusiast**\nWhile hiking to find inspiration, the magician slips near a hidden waterfall and is saved by a fitness enthusiast. This chance encounter sparks a friendship between the two, as they bond over their shared passion for fitness and nature. The scene showcases the beauty of the natural environment and the importance of human connections.\n\n**Scene 5: Forming the Hiking and Fitness Club**\nThe magician and the fitness enthusiast decide to form a hiking and fitness club, blending magic with nature and strength. The club attracts like-minded individuals who share a passion for fitness, nature, and personal growth. This scene highlights the power of community and the transformative impact of shared experiences.\n\n**Scene 6: Inspiring the Community**\nAs the club grows, its members inspire the community to embrace fitness as a way to transform lives. The video showcases heartwarming moments of club members supporting and motivating each other, as well as the positive impact on their physical and mental well-being. This scene emphasizes the potential for fitness to unite people and drive personal growth.\n\n**Scene 7: The Grand Finale**\nThe video concludes with a grand finale, where the magician performs an awe-inspiring trick, combining magic with fitness and nature. The crowd is mesmerized, and the magician's journey comes full circle. The final scene reinforces the message that personal growth, fitness, and community can lead to extraordinary achievements.\n\n**Visuals and Tone:**\nThroughout the video, the tone will be a mix of fun, emotional, and professional, reflecting the brand's personality. The visuals will be engaging, with a balance of close-ups, wide shots, and aerial footage to showcase the beauty of nature and the magic of the performances. The color palette will be vibrant, with a focus on blues and greens to represent fitness, nature, and growth.\n\n**Influencer Content Inspiration:**\nThe video will draw inspiration from influencer content, such as the scenic hiking videos and fitness journeys shared by **divyadhakal_** and **munachiya**. The video will incorporate similar visual elements, such as breathtaking landscapes, to create an immersive experience for the audience.\n\n**Core Message:**\nThe video will align with the business's core message, highlighting the importance of fitness, community, and personal growth. The story will showcase how the brand's offerings, such as personal training, group fitness classes, and wellness programs, can help individuals transform their lives and achieve their goals.",
45
+ "**Promotional Video Storyline: \"Transforming Lives through Fitness and Nature\"**\n\n**Scene 1: Introduction to the Street Magician**\nThe video opens with a street magician performing mesmerizing tricks for a crowd in a bustling city square. The magician's skills are impressive, leaving the audience in awe. However, during one trick, the magician falters, and the crowd gasps in disappointment.\n\n**Scene 2: The Magician's Journey to Self-Improvement**\nThe magician, determined to regain the crowd's admiration, decides to hit the gym for strength training. The scene cuts to the magician working out, sweating, and pushing themselves to improve their physical abilities.\n\n**Scene 3: Finding Inspiration in Nature**\nWhile hiking to find inspiration, the magician slips near a hidden waterfall. Just as they're about to fall, a fitness enthusiast, who is also an avid hiker, saves them. This encounter sparks a friendship between the two.\n\n**Scene 4: Forming a Hiking and Fitness Club**\nThe magician and the fitness enthusiast decide to form a hiking and fitness club, blending magic with nature and strength. The club's mission is to inspire others to transform their lives through fitness and outdoor activities.\n\n**Scene 5: Community Engagement and Growth**\nAs the club grows, the community becomes increasingly engaged. Members share their personal stories of transformation, and the club becomes a supportive network for people to achieve their fitness goals. The video showcases the club's activities, such as group hikes, fitness classes, and workshops.\n\n**Scene 6: Overcoming Challenges and Celebrating Successes**\nThe video highlights the challenges faced by the club members, such as overcoming fear, building confidence, and pushing past physical limitations. However, it also celebrates the successes, such as completing a difficult hike, achieving a personal best, or simply finding a sense of belonging.\n\n**Scene 7: The Power of Friendship and Community**\nThe magician and the fitness enthusiast's friendship is at the heart of the club's success. The video showcases their bond, as well as the connections formed among club members. The scene cuts to a montage of members supporting and encouraging each other, demonstrating the power of community and friendship.\n\n**Scene 8: Conclusion and Call to Action**\nThe video concludes with a shot of the magician performing a final, impressive trick, surrounded by the club members. The camera pans out to reveal the breathtaking natural scenery, symbolizing the transformative power of fitness and nature. The final shot is a call to action, encouraging viewers to join the club and start their own transformation journey.\n\n**Visuals and Tone:**\nThe video will feature a mix of urban and natural settings, with a vibrant color palette and an uplifting soundtrack. The tone will be inspirational, emotional, and fun, reflecting the brand's personality and core message. The visuals will be engaging, with a mix of close-ups, wide shots, and aerial footage to capture the beauty of nature and the energy of the club's activities.\n\n**Influencer Content Inspiration:**\nThe video will draw inspiration from influencer content, such as breathtaking outdoor scenery, fitness motivation, and personal stories of transformation. The tone and style will be similar to that of **divyadhakal_** and **munachiya**, with a focus on showcasing the beauty of nature and the power of community.\n\n**Image Insights:**\nAlthough there are no specific image insights provided, the video will incorporate stunning visuals of natural scenery, fitness activities, and community engagement. The images will be used to tell a story, evoke emotions, and inspire viewers to take action.\n\nThis promotional video storyline aligns with the business's core message, showcasing how personal growth can captivate and unite people. The video will drive engagement, inspire viewers to join the club, and promote the brand's offerings, ultimately contributing to the business's goals of expanding gym branches and building a strong fitness community."
46
+ ],
47
+ "final_story": [],
48
+ "retrievals": [
49
+ [
50
+ "[['[1]. The influencer name is: **divyadhakal_** — Likes: **704**, Comments: **9**', 'The story of that particular video is:\\nThe video opens with a breathtaking scene of a hiker trekking alongside a turquoise lake, set against a backdrop of majestic mountains and a bright blue sky dotted with fluffy white clouds. The scene sets a tone of serene adventure and personal reflection. The hiker moves steadily along the rocky shoreline, their pace deliberate and measured. The overall narrative encourages a reflective outlook on challenging times, suggesting they hold the potential for personal growth and future appreciation.', 'The branding or promotion done is:\\nThe video features one line of text overlayed on the scene \"One day you\\'ll look back on this time and all you\\'ll see is magic\"'], ['[2]. The influencer name is: **divyadhakal_** — Likes: **360**, Comments: **4**', 'The story of that particular video is:\\nThe video begins with a ground-level shot focusing on a pair of gray running shoes on a grassy, somewhat dry terrain. The view gradually elevates to reveal a landscape of brown hills and scattered trees. The shot then pans upwards, revealing a majestic, snow-capped mountain range in the distance against a cloudy sky. The visuals suggest a journey into a scenic, natural environment.', 'The branding or promotion done is:\\nThere are no visible texts or brandings in the video.'], ['[3]. The influencer name is: **divyadhakal_** — Likes: **256**, Comments: **5**', 'The story of that particular video is:\\nThe video opens with a scene set during the blue hour, indicating twilight, on a grassy hillside or tea plantation. The scene is peaceful but shrouded in mystery, creating a tranquil and reflective atmosphere. A person walks uphill, carrying a glowing cube-shaped lantern. The distant lights of a village and a road with moving vehicles hint at civilization nearby, juxtaposed against the natural, secluded setting.', 'The branding or promotion done is:\\nThere are no visible texts or brandings in the video.'], ['[4]. The influencer name is: **divyadhakal_** — Likes: **2366**, Comments: **32**', \"The story of that particular video is:\\nThe video opens with a shot of a person walking towards a massive waterfall. The environment is lush and green, with mist from the waterfall filling the air. The initial shots establish a sense of adventure, peace, and the beauty of nature. The focus quickly shifts to the individual's journey towards self-discovery. The main action is the person walking, then standing with arms outstretched, embracing the scenery. The waterfall is the dominant visual element, symbolizing power, renewal, and a grand sense of nature.\", 'The branding or promotion done is:\\nThe only visible text is a comment on the video saying \"Tyo waterfall chai Kun ho sts\"'], ['[5]. The influencer name is: **divyadhakal_** — Likes: **1181**, Comments: **37**', 'The story of that particular video is:\\nThe video presents a concise and inspirational story of recovery and rehabilitation. The storyline follows the progression from post-surgery immobility to active fitness, highlighting the character\\'s determination and the positive outcome of her efforts. The text \"5 months post-surgery\" frames the entire narrative, while the visual transitions and upbeat music reinforce the theme of progress and accomplishment. The video targets individuals interested in health, fitness, and overcoming physical challenges, offering a message of hope and motivation for anyone undergoing a similar journey.', 'The branding or promotion done is:\\n* \"5 months post-surgery\" is a recurring text overlay that provides context to the video.* The gym equipment visible at the end of the video has \"FITNESS\" visible on it.'], ['[6]. The influencer name is: **divyadhakal_** — Likes: **1644**, Comments: **8**', 'The story of that particular video is:\\nThe video begins with a scenic view of a hiker walking along a dirt path in a forest, accompanied by a voiceover expressing that journeys don’t always go as planned. The tone is thoughtful and adventurous. The visuals then shift to the hiker preparing gear, facing rain with an umbrella, and cooking food over an open fire during the hike. The video also showcases the hikers descending a hill on a forested slope.', 'The branding or promotion done is:\\n* “CAMP” is visible on the female hiker’s helmet.'], ['[7]. The influencer name is: **munachiya** — Likes: **1363**, Comments: **9**', 'The story of that particular video is:\\nThe scene opens with a person carrying a large bundle of greenery against the backdrop of snow-capped mountains. It is followed by two more people carrying greeneries and walking in the same path. The visual suggests a rural or mountainous region, with a focus on the natural landscape.', 'The branding or promotion done is:\\nThe video displays the texts “The world is not in your books and maps” and “It’s out there”.'], ['[8]. The influencer name is: **munachiya** — Likes: **495**, Comments: **4**', 'The story of that particular video is:\\nThe video depicts a humorous take on trekking as a solution to personal problems. It transitions from a forest path to a snow-covered mountain and concludes with a river crossing, visually representing a challenging journey.', 'The branding or promotion done is:\\n @munachiya (Instagram handle) Text overlay: My last two brain cells after manipulating me into thinking that trekking to a remote destination will fix all my problems'], ['[9]. The influencer name is: **munachiya** — Likes: **103**, Comments: **4**', 'The story of that particular video is:\\nThe scene opens with a person approaching a multi-tiered waterfall, expressing awe and freedom. Key visuals include the lush green landscape and cascading water. The person then spreading their arms.', 'The branding or promotion done is:\\nThe sweatshirt of the person has the text \"Surfer 81 Venice Beach\"'], ['[10]. The influencer name is: **divyadhakal_** — Likes: **561**, Comments: **3**', 'The story of that particular video is:\\nThe video opens with a shot of a lone hiker, seen from behind, facing a breathtaking mountain range under a clear blue sky. This immediately establishes a tone of adventure, solitude, and introspection. The hiker is positioned on a rocky path, suggesting a challenging journey. As the music starts, the hiker raises their arms, in a gesture of embracing the vastness of the nature. The visual focus is on the expansive landscape.', 'The branding or promotion done is:\\nThe text overlay \"Anyone will listen to people talk about you, but who will take the stand for you instead of listening is what counts...\" appears at the top of the screen.']]"
51
+ ],
52
+ [
53
+ "[['[1]. The influencer name is: **divyadhakal_** — Likes: **704**, Comments: **9**', 'The story of that particular video is:\\nThe video opens with a breathtaking scene of a hiker trekking alongside a turquoise lake, set against a backdrop of majestic mountains and a bright blue sky dotted with fluffy white clouds. The scene sets a tone of serene adventure and personal reflection. The hiker moves steadily along the rocky shoreline, their pace deliberate and measured. The overall narrative encourages a reflective outlook on challenging times, suggesting they hold the potential for personal growth and future appreciation.', 'The branding or promotion done is:\\nThe video features one line of text overlayed on the scene \"One day you\\'ll look back on this time and all you\\'ll see is magic\"'], ['[2]. The influencer name is: **divyadhakal_** — Likes: **360**, Comments: **4**', 'The story of that particular video is:\\nThe video begins with a ground-level shot focusing on a pair of gray running shoes on a grassy, somewhat dry terrain. The view gradually elevates to reveal a landscape of brown hills and scattered trees. The shot then pans upwards, revealing a majestic, snow-capped mountain range in the distance against a cloudy sky. The visuals suggest a journey into a scenic, natural environment.', 'The branding or promotion done is:\\nThere are no visible texts or brandings in the video.'], ['[3]. The influencer name is: **divyadhakal_** — Likes: **256**, Comments: **5**', 'The story of that particular video is:\\nThe video opens with a scene set during the blue hour, indicating twilight, on a grassy hillside or tea plantation. The scene is peaceful but shrouded in mystery, creating a tranquil and reflective atmosphere. A person walks uphill, carrying a glowing cube-shaped lantern. The distant lights of a village and a road with moving vehicles hint at civilization nearby, juxtaposed against the natural, secluded setting.', 'The branding or promotion done is:\\nThere are no visible texts or brandings in the video.'], ['[4]. The influencer name is: **divyadhakal_** — Likes: **2366**, Comments: **32**', \"The story of that particular video is:\\nThe video opens with a shot of a person walking towards a massive waterfall. The environment is lush and green, with mist from the waterfall filling the air. The initial shots establish a sense of adventure, peace, and the beauty of nature. The focus quickly shifts to the individual's journey towards self-discovery. The main action is the person walking, then standing with arms outstretched, embracing the scenery. The waterfall is the dominant visual element, symbolizing power, renewal, and a grand sense of nature.\", 'The branding or promotion done is:\\nThe only visible text is a comment on the video saying \"Tyo waterfall chai Kun ho sts\"'], ['[5]. The influencer name is: **divyadhakal_** — Likes: **1181**, Comments: **37**', 'The story of that particular video is:\\nThe video presents a concise and inspirational story of recovery and rehabilitation. The storyline follows the progression from post-surgery immobility to active fitness, highlighting the character\\'s determination and the positive outcome of her efforts. The text \"5 months post-surgery\" frames the entire narrative, while the visual transitions and upbeat music reinforce the theme of progress and accomplishment. The video targets individuals interested in health, fitness, and overcoming physical challenges, offering a message of hope and motivation for anyone undergoing a similar journey.', 'The branding or promotion done is:\\n* \"5 months post-surgery\" is a recurring text overlay that provides context to the video.* The gym equipment visible at the end of the video has \"FITNESS\" visible on it.'], ['[6]. The influencer name is: **divyadhakal_** — Likes: **1644**, Comments: **8**', 'The story of that particular video is:\\nThe video begins with a scenic view of a hiker walking along a dirt path in a forest, accompanied by a voiceover expressing that journeys don’t always go as planned. The tone is thoughtful and adventurous. The visuals then shift to the hiker preparing gear, facing rain with an umbrella, and cooking food over an open fire during the hike. The video also showcases the hikers descending a hill on a forested slope.', 'The branding or promotion done is:\\n* “CAMP” is visible on the female hiker’s helmet.'], ['[7]. The influencer name is: **munachiya** — Likes: **1363**, Comments: **9**', 'The story of that particular video is:\\nThe scene opens with a person carrying a large bundle of greenery against the backdrop of snow-capped mountains. It is followed by two more people carrying greeneries and walking in the same path. The visual suggests a rural or mountainous region, with a focus on the natural landscape.', 'The branding or promotion done is:\\nThe video displays the texts “The world is not in your books and maps” and “It’s out there”.'], ['[8]. The influencer name is: **munachiya** — Likes: **495**, Comments: **4**', 'The story of that particular video is:\\nThe video depicts a humorous take on trekking as a solution to personal problems. It transitions from a forest path to a snow-covered mountain and concludes with a river crossing, visually representing a challenging journey.', 'The branding or promotion done is:\\n @munachiya (Instagram handle) Text overlay: My last two brain cells after manipulating me into thinking that trekking to a remote destination will fix all my problems'], ['[9]. The influencer name is: **munachiya** — Likes: **103**, Comments: **4**', 'The story of that particular video is:\\nThe scene opens with a person approaching a multi-tiered waterfall, expressing awe and freedom. Key visuals include the lush green landscape and cascading water. The person then spreading their arms.', 'The branding or promotion done is:\\nThe sweatshirt of the person has the text \"Surfer 81 Venice Beach\"'], ['[10]. The influencer name is: **divyadhakal_** — Likes: **561**, Comments: **3**', 'The story of that particular video is:\\nThe video opens with a shot of a lone hiker, seen from behind, facing a breathtaking mountain range under a clear blue sky. This immediately establishes a tone of adventure, solitude, and introspection. The hiker is positioned on a rocky path, suggesting a challenging journey. As the music starts, the hiker raises their arms, in a gesture of embracing the vastness of the nature. The visual focus is on the expansive landscape.', 'The branding or promotion done is:\\nThe text overlay \"Anyone will listen to people talk about you, but who will take the stand for you instead of listening is what counts...\" appears at the top of the screen.']]"
54
+ ]
55
+ ],
56
+ "business_details": {
57
+ "business_type": "fitness and gym",
58
+ "platform": "Instagram, TikTok",
59
+ "target_audience": "young Nepali adults (ages 18–40) who are health-conscious and active on social media",
60
+ "business_goals": "to expand gym branches across all major cities of Nepal and build a strong fitness community",
61
+ "offerings": "personal training, group fitness classes, modern workout equipment, nutrition guidance, and wellness programs",
62
+ "Challenges_faced": "attracting loyal members, standing out in a competitive market, and promoting consistent engagement"
63
+ },
64
+ "latest_preferred_topics": [],
65
+ "images": [
66
+ 'null'
67
+ ],
68
+ "image_captions": [
69
+ 'null'
70
+ 'null'
71
+ ]
72
+ }
human_refined_ideation/utils/nodes.py CHANGED
@@ -1,16 +1,17 @@
1
  from .prompts import idea_refinement_prompt
2
- from langchain_core.messages import SystemMessage , HumanMessage, ToolMessage
3
- from utils.models_loader import llm
4
  from .state import State, IdeationFormatter
5
 
6
  def run_refiner(state:State):
7
  template = idea_refinement_prompt()
8
  messages = [
9
  SystemMessage(content=template),
10
- ToolMessage(content=f"The four ideas are:\n{state.final_ideation}.\nThe business details is:\n{state.business_details}", tool_call_id='refiner_tool'),
 
11
  HumanMessage(content=str(state.query))
12
  ]
13
- result = llm.with_structured_output(IdeationFormatter).invoke(messages)
14
  print(result.refined_idea)
15
  state.result = result.refined_idea
16
  return state
 
1
  from .prompts import idea_refinement_prompt
2
+ from langchain_core.messages import SystemMessage , HumanMessage, ToolMessage, FunctionMessage
3
+ from utils.models_loader import llm, llm_gpt
4
  from .state import State, IdeationFormatter
5
 
6
  def run_refiner(state:State):
7
  template = idea_refinement_prompt()
8
  messages = [
9
  SystemMessage(content=template),
10
+ # ToolMessage(content=f"The four ideas are:\n{state.final_ideation}.\nThe business details is:\n{state.business_details}", tool_call_id='refiner_tool'),
11
+ FunctionMessage(name='idea_refiner',content=f'''The four ideas are:\n{state.final_ideation}.\nThe business details is:\n{state.business_details}''',tool_call_id='refiner_tool'),
12
  HumanMessage(content=str(state.query))
13
  ]
14
+ result = llm_gpt.with_structured_output(IdeationFormatter).invoke(messages)
15
  print(result.refined_idea)
16
  state.result = result.refined_idea
17
  return state
human_refined_ideation/utils/prompts.py CHANGED
@@ -2,23 +2,23 @@ def idea_refinement_prompt():
2
  return """
3
  You are a creative idea refinement assistant. Your goal is to help the user finalize a single powerful short-form video idea for Instagram or TikTok by analyzing the four given ideas.
4
  The user will do some request to enhance their ideas. You have to creatively process their query analyzing the four given ideas and return the edited best idea.
 
5
 
6
  🎯 Your Rules:
7
  1. Clearly interpret the user's instruction.
8
  2. Modify or combine ideas strictly based on what the user says.
9
  3. If the user says "undo" or "go back", return the previous version exactly as it was.
10
  4. **NEVER ask the user questions.** You only act and respond with an idea.
11
- 5. Do not generate random or new ideas. Only improve, combine, or revert.
12
- 6. Maintain a strong, clear, creative narrative in every version.
13
- 7. Ensure each output is refined, realistic, and aligned with promotional goals.
14
- 9. If you're processing more than one idea, make sure the plot flows very smoothly relating them.
15
 
16
  📢 STRICT OUTPUT POLICY:
17
  - **Only return the current best idea as plain text.**
18
- - Stick with the **business details** provided to you as a tool message. The generated idea should conclude to the business details.
19
  - **No explanations, no headers, no labels.**
20
  - **Do not ask the user anything back.**
21
- - Remember, you have to give the response of your idea in **exactly 30 words**.
22
 
23
 
24
  You must function like a deterministic idea-refiner — each input must result in a single, story-rich output idea.
 
2
  return """
3
  You are a creative idea refinement assistant. Your goal is to help the user finalize a single powerful short-form video idea for Instagram or TikTok by analyzing the four given ideas.
4
  The user will do some request to enhance their ideas. You have to creatively process their query analyzing the four given ideas and return the edited best idea.
5
+ The four ideas will be provided to you through a tool.
6
 
7
  🎯 Your Rules:
8
  1. Clearly interpret the user's instruction.
9
  2. Modify or combine ideas strictly based on what the user says.
10
  3. If the user says "undo" or "go back", return the previous version exactly as it was.
11
  4. **NEVER ask the user questions.** You only act and respond with an idea.
12
+ 5. Maintain a strong, clear, creative narrative in every version.
13
+ 6. Ensure each output is refined, realistic, and aligned with promotional goals.
14
+ 7. If you're processing more than one idea, make sure the plot flows very smoothly relating them.
 
15
 
16
  📢 STRICT OUTPUT POLICY:
17
  - **Only return the current best idea as plain text.**
18
+ - Stick with the **business details** provided to you as a tool message. The generated idea **must conclude** to the business details.
19
  - **No explanations, no headers, no labels.**
20
  - **Do not ask the user anything back.**
21
+ - Remember, the length of your refined idea have to be **same as the length of other ideas**.
22
 
23
 
24
  You must function like a deterministic idea-refiner — each input must result in a single, story-rich output idea.
main.py CHANGED
@@ -8,12 +8,13 @@ from context_analysis_agent.agent import IntroductionChatbot
8
  from business_interaction_agent.agent import BusinessInteractionChatbot
9
  from context_analysis_agent.utils.utils import save_to_db
10
  import ast
 
11
  from brainstroming_agent.utils.utils import encode_image_to_base64 , generate_final_story, generate_image
12
  from idea_to_budget_agent.agent import budget_calculator
13
  from ideation_agent.agent import ideation_graph
14
  from langgraph.errors import GraphRecursionError
15
  from human_refined_ideation.agent import human_refined_idea
16
-
17
  import json
18
 
19
  # Store brainstorming results per thread_id
@@ -25,29 +26,38 @@ idea_graph = ideation_graph()
25
  brainstrom_graph = brainstroming_graph()
26
  human_refine_graph = human_refined_idea()
27
 
28
- stored_data={}
29
- # stored_data['business_details']={"business_type": "fitness and gym", "platform": "instagram, tiktok", "target_audience": "every software needed clients", "business_goals": "to expand in every cities of nepal", "offerings": "nepali cloths and products", "Challenges_faced": "finding new customers, attracting large customers"}
30
- stored_data['business_details'] = {
31
- "business_type": "fitness and gym",
32
- "platform": "Instagram, TikTok",
33
- "target_audience": "young Nepali adults (ages 18–40) who are health-conscious and active on social media",
34
- "business_goals": "to expand gym branches across all major cities of Nepal and build a strong fitness community",
35
- "offerings": "personal training, group fitness classes, modern workout equipment, nutrition guidance, and wellness programs",
36
- "Challenges_faced": "attracting loyal members, standing out in a competitive market, and promoting consistent engagement"
37
- }
38
 
39
 
40
 
41
- stored_data['final_ideation']= ['''A street magician performs tricks, leaving a crowd awestruck. One trick falters, inspiring him to hit the gym. Months later, he fuses fitness with magic, showcasing strength through performance, proving that transformation can captivate and inspire a community''',
42
- '''A group of strangers attends a quirky food festival, each trying bizarre dishes. One adventurer finds a fitness coach among them. They bond over health, sparking a weekly workout group that brings the community together, blending fun and fitness effortlessly.''',
43
- '''A lost hiker discovers a hidden waterfall, but slips on the rocks, nearly falling. A passing fitness enthusiast helps him up, encouraging regular exercise for safety and strength. Together, they start a hiking club, uniting fitness and nature lovers in their city''',
44
- '''A young Nepali woman discovers a hidden strength within herself while hiking the Himalayas. She returns home, and her fitness journey begins at our gym. With the help of our personal trainers, she transforms her body and mind. The gym becomes her sanctuary, and her transformation inspires others to find their inner strength.''']
45
 
46
- stored_data['human_ideation_interactions'] = []
47
- stored_data['refined_ideation'] = '''A street magician's trick fails, inspiring a fitness journey. Months later, he fuses magic with strength, showcasing transformation. Meanwhile, a fitness coach bonds with foodies over health, sparking a community workout group, blending fun and fitness.'''
48
 
49
  class UserMessage(BaseModel):
50
  message: str
 
 
 
 
 
 
 
 
 
51
  @app.post("/context-analysis")
52
  def context_analysis(msg: UserMessage):
53
  response = context_analysis_graph.chat(msg.message)
@@ -59,7 +69,7 @@ def context_analysis(msg: UserMessage):
59
  if isinstance(details, str):
60
  details= ast.literal_eval(details)
61
  print('Details Type:',type(details))
62
- save_to_db(details)
63
  stored_data['business_details'] = details
64
  return {"response": response, "business_details": details, "complete": True}
65
  return {"response": response, "complete": False}
@@ -125,7 +135,7 @@ class BrainstormRequest(BaseModel):
125
  image_base64_list: Optional[list] = []
126
  thread_id: Optional[str]="default-session"
127
 
128
- @app.post("/brainstrom")
129
  def brainstroming_endpoint(
130
  request: BrainstormRequest, # 🔥 Full JSON body here
131
  ):
@@ -153,9 +163,13 @@ def generate_final_story_endpoint():
153
  stored_data['final_story']= '''A cinematic journey follows a street magician\'s
154
  metamorphosis from a mere trickster to a powerful performer, as he transforms his act with newfound physical strength, effortlessly executing death-defying stunts, and inspiring a captivated crowd to take action, all set against a
155
  backdrop of urban grandeur and pulsing energy.'''
 
 
156
  @app.post("/generate-image")
157
  def generate_image_endpoint():
158
- image = generate_image(str(stored_data['final_story']))
 
 
159
  stored_data['generated_image']=image
160
  return {
161
  'response':image
 
8
  from business_interaction_agent.agent import BusinessInteractionChatbot
9
  from context_analysis_agent.utils.utils import save_to_db
10
  import ast
11
+ from orchestration_agent.agent import orchestration_chat
12
  from brainstroming_agent.utils.utils import encode_image_to_base64 , generate_final_story, generate_image
13
  from idea_to_budget_agent.agent import budget_calculator
14
  from ideation_agent.agent import ideation_graph
15
  from langgraph.errors import GraphRecursionError
16
  from human_refined_ideation.agent import human_refined_idea
17
+ from dummy_state import stored_data
18
  import json
19
 
20
  # Store brainstorming results per thread_id
 
26
  brainstrom_graph = brainstroming_graph()
27
  human_refine_graph = human_refined_idea()
28
 
29
+ # stored_data={}
30
+ # # stored_data['business_details']={"business_type": "fitness and gym", "platform": "instagram, tiktok", "target_audience": "every software needed clients", "business_goals": "to expand in every cities of nepal", "offerings": "nepali cloths and products", "Challenges_faced": "finding new customers, attracting large customers"}
31
+ # stored_data['business_details'] = {
32
+ # "business_type": "fitness and gym",
33
+ # "platform": "Instagram, TikTok",
34
+ # "target_audience": "young Nepali adults (ages 18–40) who are health-conscious and active on social media",
35
+ # "business_goals": "to expand gym branches across all major cities of Nepal and build a strong fitness community",
36
+ # "offerings": "personal training, group fitness classes, modern workout equipment, nutrition guidance, and wellness programs",
37
+ # "Challenges_faced": "attracting loyal members, standing out in a competitive market, and promoting consistent engagement"
38
+ # }
39
 
40
 
41
 
42
+ # stored_data['final_ideation']= ['''A street magician performs tricks, leaving a crowd awestruck. One trick falters, inspiring him to hit the gym. Months later, he fuses fitness with magic, showcasing strength through performance, proving that transformation can captivate and inspire a community''',
43
+ # '''A group of strangers attends a quirky food festival, each trying bizarre dishes. One adventurer finds a fitness coach among them. They bond over health, sparking a weekly workout group that brings the community together, blending fun and fitness effortlessly.''',
44
+ # '''A lost hiker discovers a hidden waterfall, but slips on the rocks, nearly falling. A passing fitness enthusiast helps him up, encouraging regular exercise for safety and strength. Together, they start a hiking club, uniting fitness and nature lovers in their city''',
45
+ # '''A young Nepali woman discovers a hidden strength within herself while hiking the Himalayas. She returns home, and her fitness journey begins at our gym. With the help of our personal trainers, she transforms her body and mind. The gym becomes her sanctuary, and her transformation inspires others to find their inner strength.''']
46
 
47
+ # stored_data['human_ideation_interactions'] = []
48
+ # stored_data['refined_ideation'] = '''A street magician's trick fails, inspiring a fitness journey. Months later, he fuses magic with strength, showcasing transformation. Meanwhile, a fitness coach bonds with foodies over health, sparking a community workout group, blending fun and fitness.'''
49
 
50
  class UserMessage(BaseModel):
51
  message: str
52
+
53
+
54
+ @app.post("/orchestration")
55
+ def orchestration_endpoint(msg:UserMessage):
56
+ response = orchestration_chat(msg.message)
57
+ return {'tool_response': response.tool, 'message_response':response.message}
58
+
59
+
60
+
61
  @app.post("/context-analysis")
62
  def context_analysis(msg: UserMessage):
63
  response = context_analysis_graph.chat(msg.message)
 
69
  if isinstance(details, str):
70
  details= ast.literal_eval(details)
71
  print('Details Type:',type(details))
72
+ # save_to_db(details)
73
  stored_data['business_details'] = details
74
  return {"response": response, "business_details": details, "complete": True}
75
  return {"response": response, "complete": False}
 
135
  image_base64_list: Optional[list] = []
136
  thread_id: Optional[str]="default-session"
137
 
138
+ @app.post("/brainstorm")
139
  def brainstroming_endpoint(
140
  request: BrainstormRequest, # 🔥 Full JSON body here
141
  ):
 
163
  stored_data['final_story']= '''A cinematic journey follows a street magician\'s
164
  metamorphosis from a mere trickster to a powerful performer, as he transforms his act with newfound physical strength, effortlessly executing death-defying stunts, and inspiring a captivated crowd to take action, all set against a
165
  backdrop of urban grandeur and pulsing energy.'''
166
+
167
+
168
  @app.post("/generate-image")
169
  def generate_image_endpoint():
170
+ image = generate_image(str(stored_data['final_story'])
171
+ ,str(stored_data['business_details'])
172
+ ,str(stored_data['refined_ideation']))
173
  stored_data['generated_image']=image
174
  return {
175
  'response':image
langgraph.json → orchestration_agent/__init__.py RENAMED
File without changes
orchestration_agent/agent.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langgraph.graph import StateGraph, MessagesState, START, END
2
+ from langgraph.checkpoint.memory import MemorySaver
3
+ from .utils.nodes import orchestration_node
4
+ from utils.models_loader import llm
5
+ from .utils.state import ValidationFormatter
6
+ import re
7
+ memory = MemorySaver()
8
+
9
+
10
+ def initialize_workflow():
11
+ workflow = StateGraph(MessagesState)
12
+ workflow.add_node("chatbot", orchestration_node)
13
+ workflow.add_edge(START, "chatbot")
14
+ workflow.add_edge("chatbot", END)
15
+ return workflow.compile(checkpointer=memory)
16
+
17
+ def orchestration_chat(user_input: str):
18
+ agent = initialize_workflow()
19
+ config = {"configurable": {"thread_id": "orchestration-thread"}}
20
+ response = agent.invoke({"messages": [user_input]}, config)['messages'][-1].content
21
+ response=llm.with_structured_output(ValidationFormatter).invoke(response)
22
+ return response
23
+
24
+
25
+
26
+
orchestration_agent/utils/__init__.py ADDED
File without changes
orchestration_agent/utils/nodes.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from .prompts import orchestration_prompt
2
+ from langchain_core.messages import SystemMessage
3
+ from utils.models_loader import llm
4
+ from .state import ValidationFormatter
5
+
6
+ def orchestration_node(state):
7
+ prompt = orchestration_prompt
8
+ history = state["messages"]
9
+ full_prompt = [SystemMessage(content=prompt)] + history
10
+ response = llm.with_structured_output(ValidationFormatter).invoke(full_prompt)
11
+ return {"messages": [str(response)]}
orchestration_agent/utils/prompts.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ orchestration_prompt = """
2
+ You are an AI orchestration agent that reads the user's message and decides which one of the following tools should be called next. You're perfect at analyzing the intention of the user.
3
+
4
+ Your job is to analyze the user's input and return a JSON object with:
5
+ 1. `tool`: the most appropriate tool name from the list below (or `null` if not applicable)
6
+ 2. `message`: a clear, helpful message to show to the user. This can be a question, guidance or even an action confirmation depending on the tool.
7
+
8
+ ---
9
+
10
+
11
+ ### Available Tools:
12
+ 1. **ideation** → Use if the user wants to create marketing video ideas.
13
+ 2. **human-idea-refining** → Use if the user gives feedback or asks to improve/change ideas.
14
+ 3. **brainstorm** → Use if the user talks about specific themes, topics, or wants to go deeper into storytelling along with brainstorming.
15
+ 4. **generate-final-story** → Use if the user is ready for a final story/script based on ideas and already brainstormed topics.
16
+ 5. **generate-image** → Use if the user wants a visual or image based on the story.
17
+
18
+ ---
19
+
20
+ ### Rules:
21
+ - If the query clearly maps to a tool, return the tool name and a relevant message.
22
+ - If the query is unclear or irrelevant, set `tool` to `null` and return a helpful question in `message`.
23
+ - Your output must ALWAYS be in JSON format like this:
24
+
25
+ ### Output Format:
26
+ "tool": "the exact name of the tool",
27
+ "message": "Sure! Here are some creative campaign ideas based on your business."
28
+
29
+ """
orchestration_agent/utils/state.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ from pydantic import BaseModel, Field
2
+
3
+
4
+ class ValidationFormatter(BaseModel):
5
+ tool: str = Field(description="Returns the name of the tool.")
6
+ message: str = Field(description="Returns the message or response of the user query.")
orchestration_agent/utils/tools.py ADDED
File without changes
utils/__pycache__/models_loader.cpython-312.pyc CHANGED
Binary files a/utils/__pycache__/models_loader.cpython-312.pyc and b/utils/__pycache__/models_loader.cpython-312.pyc differ
 
utils/models_loader.py CHANGED
@@ -15,15 +15,15 @@ os.environ['GROQ_API_KEY']=os.getenv('GROQ_API_KEY')
15
 
16
 
17
  llm = ChatGroq(
18
- model="llama3-8b-8192",
19
- temperature=0.3,
20
 
21
  )
22
 
23
- # llm = ChatOpenAI(
24
- # model="gpt-4o-mini",
25
- # temperature=0.3,
26
- # )
27
 
28
 
29
  class HFEmbeddingAPI:
 
15
 
16
 
17
  llm = ChatGroq(
18
+ model="llama-3.3-70b-versatile",
19
+ temperature=0.7,
20
 
21
  )
22
 
23
+ llm_gpt = ChatOpenAI(
24
+ model="gpt-4o-mini",
25
+ temperature=0.3,
26
+ )
27
 
28
 
29
  class HFEmbeddingAPI: