Spaces:
Sleeping
Sleeping
Commit
·
b623e6c
1
Parent(s):
c636895
Updated commit
Browse files- __pycache__/main.cpython-312.pyc +0 -0
- business_interaction_agent/__pycache__/agent.cpython-312.pyc +0 -0
- business_interaction_agent/agent.py +6 -4
- business_interaction_agent/utils/__pycache__/prompts.cpython-312.pyc +0 -0
- business_interaction_agent/utils/nodes.py +2 -2
- business_interaction_agent/utils/prompts.py +10 -29
- context_analysis_agent/__pycache__/agent.cpython-312.pyc +0 -0
- idea_to_budget_agent/__init__.py +0 -0
- idea_to_budget_agent/agent.py +18 -0
- idea_to_budget_agent/utils/nodes.py +0 -0
- idea_to_budget_agent/utils/prompts.py +43 -0
- idea_to_budget_agent/utils/state.py +45 -0
- idea_to_budget_agent/utils/tools.py +101 -0
- idea_to_budget_agent/utils/utils.py +0 -0
- ideation_agent/utils/__pycache__/nodes.cpython-312.pyc +0 -0
- ideation_agent/utils/__pycache__/prompts.cpython-312.pyc +0 -0
- ideation_agent/utils/__pycache__/state.cpython-312.pyc +0 -0
- ideation_agent/utils/nodes.py +10 -18
- ideation_agent/utils/prompts.py +165 -110
- ideation_agent/utils/state.py +8 -1
- main.py +30 -5
- utils/__pycache__/models_loader.cpython-312.pyc +0 -0
- utils/models_loader.py +25 -22
__pycache__/main.cpython-312.pyc
CHANGED
|
Binary files a/__pycache__/main.cpython-312.pyc and b/__pycache__/main.cpython-312.pyc differ
|
|
|
business_interaction_agent/__pycache__/agent.cpython-312.pyc
CHANGED
|
Binary files a/business_interaction_agent/__pycache__/agent.cpython-312.pyc and b/business_interaction_agent/__pycache__/agent.cpython-312.pyc differ
|
|
|
business_interaction_agent/agent.py
CHANGED
|
@@ -5,7 +5,7 @@ from langgraph.prebuilt import create_react_agent
|
|
| 5 |
from .utils.state import State,StateUpdateFormatter
|
| 6 |
# from .utils.nodes import business_interaction_node, cleanup_messages
|
| 7 |
from utils.models_loader import llm
|
| 8 |
-
from langchain_core.messages import SystemMessage
|
| 9 |
from .utils.prompts import business_retrieval_prompt, check_state_update_prompt
|
| 10 |
from .utils.utils import manual_retrieval
|
| 11 |
from context_analysis_agent.utils.utils import save_to_db
|
|
@@ -42,8 +42,8 @@ class BusinessInteractionChatbot:
|
|
| 42 |
def _call_model(self, state):
|
| 43 |
print('Entered into callmodel')
|
| 44 |
retrievals = manual_retrieval(str([msg['content'] for msg in self.messages if msg['role'] == 'user']),business_state.business_details)
|
| 45 |
-
template = business_retrieval_prompt(str([msg['content'] for msg in self.messages if msg['role'] == 'user']),
|
| 46 |
-
messages = [SystemMessage(content=template)] + state["messages"]
|
| 47 |
print('The message is:',messages)
|
| 48 |
backup_response = self.react_agent.invoke({'messages':messages})['messages'][-1]
|
| 49 |
print('Backup response:',backup_response.content)
|
|
@@ -57,7 +57,7 @@ class BusinessInteractionChatbot:
|
|
| 57 |
messages = [SystemMessage(content=template)]
|
| 58 |
response = llm.with_structured_output(StateUpdateFormatter).invoke(messages)
|
| 59 |
# response= llm.invoke(messages)
|
| 60 |
-
print('Response of state check:',response)
|
| 61 |
return response.model_dump()
|
| 62 |
|
| 63 |
|
|
@@ -66,6 +66,8 @@ class BusinessInteractionChatbot:
|
|
| 66 |
business_state.business_details=business_details
|
| 67 |
self.messages.append({"role": "user", "content": f'{user_input}'})
|
| 68 |
checked_details = self.check_state_update()
|
|
|
|
|
|
|
| 69 |
if checked_details!= business_state.business_details:
|
| 70 |
save_to_db(checked_details)
|
| 71 |
print('Database Updated as the state changed....')
|
|
|
|
| 5 |
from .utils.state import State,StateUpdateFormatter
|
| 6 |
# from .utils.nodes import business_interaction_node, cleanup_messages
|
| 7 |
from utils.models_loader import llm
|
| 8 |
+
from langchain_core.messages import SystemMessage, ToolMessage
|
| 9 |
from .utils.prompts import business_retrieval_prompt, check_state_update_prompt
|
| 10 |
from .utils.utils import manual_retrieval
|
| 11 |
from context_analysis_agent.utils.utils import save_to_db
|
|
|
|
| 42 |
def _call_model(self, state):
|
| 43 |
print('Entered into callmodel')
|
| 44 |
retrievals = manual_retrieval(str([msg['content'] for msg in self.messages if msg['role'] == 'user']),business_state.business_details)
|
| 45 |
+
template = business_retrieval_prompt(str([msg['content'] for msg in self.messages if msg['role'] == 'user']),str(business_state.business_details))
|
| 46 |
+
messages = [SystemMessage(content=template),ToolMessage(content="Tool's response:\n"+retrievals,tool_call_id='call_business_interaction')] + state["messages"]
|
| 47 |
print('The message is:',messages)
|
| 48 |
backup_response = self.react_agent.invoke({'messages':messages})['messages'][-1]
|
| 49 |
print('Backup response:',backup_response.content)
|
|
|
|
| 57 |
messages = [SystemMessage(content=template)]
|
| 58 |
response = llm.with_structured_output(StateUpdateFormatter).invoke(messages)
|
| 59 |
# response= llm.invoke(messages)
|
| 60 |
+
# print('Response of state check:',response)
|
| 61 |
return response.model_dump()
|
| 62 |
|
| 63 |
|
|
|
|
| 66 |
business_state.business_details=business_details
|
| 67 |
self.messages.append({"role": "user", "content": f'{user_input}'})
|
| 68 |
checked_details = self.check_state_update()
|
| 69 |
+
print('Checked details:',checked_details)
|
| 70 |
+
print('Business details:',business_state.business_details)
|
| 71 |
if checked_details!= business_state.business_details:
|
| 72 |
save_to_db(checked_details)
|
| 73 |
print('Database Updated as the state changed....')
|
business_interaction_agent/utils/__pycache__/prompts.cpython-312.pyc
CHANGED
|
Binary files a/business_interaction_agent/utils/__pycache__/prompts.cpython-312.pyc and b/business_interaction_agent/utils/__pycache__/prompts.cpython-312.pyc differ
|
|
|
business_interaction_agent/utils/nodes.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from langchain_core.messages import SystemMessage
|
| 2 |
from .prompts import business_retrieval_prompt
|
| 3 |
from .utils import manual_retrieval
|
| 4 |
|
|
@@ -8,7 +8,7 @@ def business_interaction_node(state, llm, react_agent, messages, business_detail
|
|
| 8 |
user_inputs = str([msg['content'] for msg in messages if msg['role'] == 'user'])
|
| 9 |
retrievals = manual_retrieval(user_inputs, business_details)
|
| 10 |
template = business_retrieval_prompt(user_inputs, retrievals)
|
| 11 |
-
formatted_messages = [SystemMessage(content=template)] + state["messages"]
|
| 12 |
response = react_agent.invoke({'messages': formatted_messages})['messages'][-1]
|
| 13 |
print('Backup response:', response.content)
|
| 14 |
return {"messages": [response.content]}
|
|
|
|
| 1 |
+
from langchain_core.messages import SystemMessage, ToolMessage
|
| 2 |
from .prompts import business_retrieval_prompt
|
| 3 |
from .utils import manual_retrieval
|
| 4 |
|
|
|
|
| 8 |
user_inputs = str([msg['content'] for msg in messages if msg['role'] == 'user'])
|
| 9 |
retrievals = manual_retrieval(user_inputs, business_details)
|
| 10 |
template = business_retrieval_prompt(user_inputs, retrievals)
|
| 11 |
+
formatted_messages = [SystemMessage(content=template) , ToolMessage(content="Tool's response:\n"+retrievals)] + state["messages"]
|
| 12 |
response = react_agent.invoke({'messages': formatted_messages})['messages'][-1]
|
| 13 |
print('Backup response:', response.content)
|
| 14 |
return {"messages": [response.content]}
|
business_interaction_agent/utils/prompts.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
-
def business_retrieval_prompt(user_message,
|
| 2 |
return f'''
|
| 3 |
-
You are a professional AI assistant helping users understand how influencers can support their business. You will be given:
|
| 4 |
|
| 5 |
- A **user message**
|
| 6 |
-
-
|
| 7 |
-
- The **business details** provided by the user
|
| 8 |
|
| 9 |
Your job is to:
|
| 10 |
1. **First**, analyze the user message and decide if it is actually a business-related question or query that could be answered using influencer content.
|
|
@@ -14,7 +14,7 @@ Your job is to:
|
|
| 14 |
a. Analyze the **business details** and check if the user message aligns with the type of business.
|
| 15 |
- If there is a mismatch (e.g., business is a restaurant but the user asks about clothing), politely **alert the user** about the mismatch.
|
| 16 |
- Still, go ahead and provide a helpful answer using relevant influencer data if available.
|
| 17 |
-
b. Analyze the influencer data and explain how each influencer might support the business based only on the
|
| 18 |
|
| 19 |
--- USER MESSAGE ---
|
| 20 |
{user_message}
|
|
@@ -22,29 +22,26 @@ Your job is to:
|
|
| 22 |
--- BUSINESS DETAILS ---
|
| 23 |
{business_details}
|
| 24 |
|
| 25 |
-
--- START OF RETRIEVALS ---
|
| 26 |
-
{retrievals}
|
| 27 |
-
--- END OF RETRIEVALS ---
|
| 28 |
|
| 29 |
Rules:
|
| 30 |
-
- If the user message is **not relevant to influencer or business help**, politely respond in a general helpful way and ignore the
|
| 31 |
- If the message **is relevant**, then:
|
| 32 |
- First verify if the user’s business type matches the context of their message.
|
| 33 |
- If not, display a short alert to the user like: “Note: Your query seems to focus on [X], but your business is about [Y].”
|
| 34 |
- Then analyze the influencer stories:
|
| 35 |
- Identify which influencer content is relevant.
|
| 36 |
- Explain what they are promoting and how it might help the business.
|
| 37 |
-
- You **must mention influencer usernames** and only use what is in the
|
| 38 |
-
- Do NOT invent or assume any information beyond what is explicitly provided in the
|
| 39 |
|
| 40 |
Keep your response:
|
| 41 |
- Context-aware, direct and short as possible
|
| 42 |
-
- Grounded only in the
|
| 43 |
- Helpful, concise, and user-friendly
|
| 44 |
'''.strip()
|
| 45 |
|
| 46 |
|
| 47 |
-
def
|
| 48 |
return f"""
|
| 49 |
You are an expert business assistant tasked with updating business details by thoroughly analyzing user messages. Your goal is to identify and apply changes to the business details only when the user message explicitly provides new or conflicting information relevant to the business details. Follow these guidelines:
|
| 50 |
|
|
@@ -72,23 +69,7 @@ Output:
|
|
| 72 |
Return the updated business details in the same dictionary format as provided. If no changes are warranted, return the original business details unchanged.
|
| 73 |
"""
|
| 74 |
|
| 75 |
-
def check_state_update_prompt(business_details: dict, user_messages: str):
|
| 76 |
-
return f"""
|
| 77 |
-
You are a business assistant. Your job is to check if the user's message changes any of the current business details.
|
| 78 |
-
|
| 79 |
-
Rules:
|
| 80 |
-
1. Only change details if the user gives **clear new or different information**.
|
| 81 |
-
2. If the message does **not change anything**, return the same business details.
|
| 82 |
-
3. **Never return empty values.** If you can't update something, keep the current value.
|
| 83 |
-
4. Keep the **same format** as the original business details (same keys and data types).
|
| 84 |
-
|
| 85 |
-
Input:
|
| 86 |
-
Current business details: {str(business_details)}
|
| 87 |
-
User message: {user_messages}
|
| 88 |
|
| 89 |
-
Output:
|
| 90 |
-
Return the updated business details in the same dictionary format. If nothing changed, return the original business details.
|
| 91 |
-
""".strip()
|
| 92 |
|
| 93 |
|
| 94 |
|
|
|
|
| 1 |
+
def business_retrieval_prompt(user_message, business_details):
|
| 2 |
return f'''
|
| 3 |
+
You are a professional AI assistant helping users understand how influencers can support their business but only on the basis of the tool's response provided to you. You will be given:
|
| 4 |
|
| 5 |
- A **user message**
|
| 6 |
+
- The response of the tool. The tool's response contains the video stories of the influencers.
|
| 7 |
+
- The **business details** provided by the user.
|
| 8 |
|
| 9 |
Your job is to:
|
| 10 |
1. **First**, analyze the user message and decide if it is actually a business-related question or query that could be answered using influencer content.
|
|
|
|
| 14 |
a. Analyze the **business details** and check if the user message aligns with the type of business.
|
| 15 |
- If there is a mismatch (e.g., business is a restaurant but the user asks about clothing), politely **alert the user** about the mismatch.
|
| 16 |
- Still, go ahead and provide a helpful answer using relevant influencer data if available.
|
| 17 |
+
b. Analyze the influencer data and explain how each influencer might support the business based only on the tool's response.
|
| 18 |
|
| 19 |
--- USER MESSAGE ---
|
| 20 |
{user_message}
|
|
|
|
| 22 |
--- BUSINESS DETAILS ---
|
| 23 |
{business_details}
|
| 24 |
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
Rules:
|
| 27 |
+
- If the user message is **not relevant to influencer or business help**, politely respond in a general helpful way and ignore the tool's response and business details.
|
| 28 |
- If the message **is relevant**, then:
|
| 29 |
- First verify if the user’s business type matches the context of their message.
|
| 30 |
- If not, display a short alert to the user like: “Note: Your query seems to focus on [X], but your business is about [Y].”
|
| 31 |
- Then analyze the influencer stories:
|
| 32 |
- Identify which influencer content is relevant.
|
| 33 |
- Explain what they are promoting and how it might help the business.
|
| 34 |
+
- You **must mention influencer usernames** and only use what is in the tool's response.
|
| 35 |
+
- Do NOT invent or assume any information beyond what is explicitly provided in the tool's response and business details.
|
| 36 |
|
| 37 |
Keep your response:
|
| 38 |
- Context-aware, direct and short as possible
|
| 39 |
+
- Grounded only in the tool's response.
|
| 40 |
- Helpful, concise, and user-friendly
|
| 41 |
'''.strip()
|
| 42 |
|
| 43 |
|
| 44 |
+
def check_state_update_prompt(business_details: dict, user_messages: str):
|
| 45 |
return f"""
|
| 46 |
You are an expert business assistant tasked with updating business details by thoroughly analyzing user messages. Your goal is to identify and apply changes to the business details only when the user message explicitly provides new or conflicting information relevant to the business details. Follow these guidelines:
|
| 47 |
|
|
|
|
| 69 |
Return the updated business details in the same dictionary format as provided. If no changes are warranted, return the original business details unchanged.
|
| 70 |
"""
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
|
| 75 |
|
context_analysis_agent/__pycache__/agent.cpython-312.pyc
CHANGED
|
Binary files a/context_analysis_agent/__pycache__/agent.cpython-312.pyc and b/context_analysis_agent/__pycache__/agent.cpython-312.pyc differ
|
|
|
idea_to_budget_agent/__init__.py
ADDED
|
File without changes
|
idea_to_budget_agent/agent.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .utils.prompts import budgeting_prompt
|
| 2 |
+
from langchain_core.messages import SystemMessage , ToolMessage, FunctionMessage
|
| 3 |
+
from.utils.tools import cost_table,budget_tiers_schema
|
| 4 |
+
from utils.models_loader import llm
|
| 5 |
+
from .utils.state import json_schema, VideoIdeasBudgetSchema
|
| 6 |
+
|
| 7 |
+
def budget_calculator(business_details, final_ideation):
|
| 8 |
+
print('The final ideation is:',final_ideation)
|
| 9 |
+
print('type:',type(final_ideation))
|
| 10 |
+
template = budgeting_prompt(final_ideation,business_details)
|
| 11 |
+
messages = [SystemMessage(content=template),
|
| 12 |
+
ToolMessage(content="The cost table is:\n"+ str(cost_table) + "\n" + "The budget tier schema is:\n"+ str(budget_tiers_schema) ,tool_call_id='call_cost_table'),
|
| 13 |
+
# FunctionMessage(name="cost_and_budget",content="The cost table is:\n"+ str(cost_table) + "\n" + "The budget tier schema is:\n"+ str(budget_tiers_schema) ,tool_call_id='call_cost_table')]
|
| 14 |
+
]
|
| 15 |
+
response = llm.with_structured_output(VideoIdeasBudgetSchema).invoke(messages)
|
| 16 |
+
print('Budget Calculator Response:\n',response)
|
| 17 |
+
return response
|
| 18 |
+
|
idea_to_budget_agent/utils/nodes.py
ADDED
|
File without changes
|
idea_to_budget_agent/utils/prompts.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
def budgeting_prompt(ideas_block,business_details) -> str:
|
| 3 |
+
return f"""
|
| 4 |
+
You are a video production strategist for Instagram and TikTok reels. You will receive a list of 4 creative short-form video ideas. These ideas are designed to promote businesses from various industries (e.g., fitness, fashion, tech, finance, food, etc.).
|
| 5 |
+
|
| 6 |
+
Your task is to analyze each video idea and assign them to the most appropriate budget range, based on the **cost table** and **budget tiers schema** which is provided to you as a tool.
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
Instructions: (For each video idea)
|
| 10 |
+
1. Evaluate what it would realistically take to produce each video idea.
|
| 11 |
+
2. Assign a suitable budget range and label to each.
|
| 12 |
+
3. Provide a justification for your choice, based on production complexity.
|
| 13 |
+
4. Output your answer in the following format:
|
| 14 |
+
|
| 15 |
+
Output Format: (For each video idea, Give the result in the following format)
|
| 16 |
+
"idea": "Display the video idea as it is.",
|
| 17 |
+
"mapped_budget_range": "The best suitable budget range from budget tiers schema. Include the price range mentioned too.",
|
| 18 |
+
"budget_label": "The best fit budget label from the budget tiers schema.",
|
| 19 |
+
"justification": "Clean and precise reason why this idea can be mapped in this budget range and budget label.",
|
| 20 |
+
"recommended_team_and_tools": "Display the cost detailing by deeply analyzing the cost table. You have to give a clear response that which portion needs how much money. Remember, the cost detailing don't have to exceed the fitted budget range."
|
| 21 |
+
|
| 22 |
+
🎬 Here are the video ideas to evaluate along with the business_details:
|
| 23 |
+
**4 video ideas**
|
| 24 |
+
1. **First Idea**
|
| 25 |
+
{ideas_block[0]}
|
| 26 |
+
|
| 27 |
+
2. **Second Idea**
|
| 28 |
+
{ideas_block[1]}
|
| 29 |
+
|
| 30 |
+
3. **Third Idea**
|
| 31 |
+
{ideas_block[2]}
|
| 32 |
+
|
| 33 |
+
4. **Fourth Idea**
|
| 34 |
+
{ideas_block[3]}
|
| 35 |
+
|
| 36 |
+
**Business Details**:
|
| 37 |
+
{business_details}
|
| 38 |
+
|
| 39 |
+
📝 Notes:
|
| 40 |
+
- Be objective and realistic in budget assessment.
|
| 41 |
+
- Do not assign high-end budgets unless absolutely necessary.
|
| 42 |
+
- Assume the creator wants maximum value with minimal overspending.
|
| 43 |
+
"""
|
idea_to_budget_agent/utils/state.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
json_schema = {
|
| 2 |
+
"idea1":{
|
| 3 |
+
"idea": "Display the first video idea as it is.",
|
| 4 |
+
"mapped_budget_range": "The best suitable budget range from budget tiers schema. Include the price range mentioned too.",
|
| 5 |
+
"budget_label": "The best fit budget label from the budget tiers schema.",
|
| 6 |
+
"justification": "Clean and precise reason why this idea can be mapped in this budget range and budget label.",
|
| 7 |
+
"recommended_team_and_tools": "Display the cost detailing by deeply analyzing the cost table. You have to give a clear response that which portion needs how much money. Remember, the cost detailing don't have to exceed the fitted budget range."
|
| 8 |
+
},
|
| 9 |
+
|
| 10 |
+
"idea2":{
|
| 11 |
+
"idea": "Display the second video idea as it is.",
|
| 12 |
+
"mapped_budget_range": "The best suitable budget range from budget tiers schema. Include the price range mentioned too.",
|
| 13 |
+
"budget_label": "The best fit budget label from the budget tiers schema.",
|
| 14 |
+
"justification": "Clean and precise reason why this idea can be mapped in this budget range and budget label.",
|
| 15 |
+
"recommended_team_and_tools": "Display the cost detailing by deeply analyzing the cost table. You have to give a clear response that which portion needs how much money. Remember, the cost detailing don't have to exceed the fitted budget range."
|
| 16 |
+
},
|
| 17 |
+
|
| 18 |
+
"idea3":{
|
| 19 |
+
"idea": "Display the third video idea as it is.",
|
| 20 |
+
"mapped_budget_range": "The best suitable budget range from budget tiers schema. Include the price range mentioned too.",
|
| 21 |
+
"budget_label": "The best fit budget label from the budget tiers schema.",
|
| 22 |
+
"justification": "Clean and precise reason why this idea can be mapped in this budget range and budget label.",
|
| 23 |
+
"recommended_team_and_tools": "Display the cost detailing by deeply analyzing the cost table. You have to give a clear response that which portion needs how much money. Remember, the cost detailing don't have to exceed the fitted budget range."
|
| 24 |
+
},
|
| 25 |
+
|
| 26 |
+
"idea4":{
|
| 27 |
+
"idea": "Display the fourth video idea as it is.",
|
| 28 |
+
"mapped_budget_range": "The best suitable budget range from budget tiers schema. Include the price range mentioned too.",
|
| 29 |
+
"budget_label": "The best fit budget label from the budget tiers schema.",
|
| 30 |
+
"justification": "Clean and precise reason why this idea can be mapped in this budget range and budget label.",
|
| 31 |
+
"recommended_team_and_tools": "Display the cost detailing by deeply analyzing the cost table. You have to give a clear response that which portion needs how much money. Remember, the cost detailing don't have to exceed the fitted budget range."
|
| 32 |
+
},
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
from pydantic import BaseModel, Field
|
| 36 |
+
|
| 37 |
+
class IdeaMapping(BaseModel):
|
| 38 |
+
idea: str = Field(..., description="The video idea as it is.")
|
| 39 |
+
mapped_budget_range: str = Field(..., description="Best suitable budget range from budget tiers schema. Include price range.")
|
| 40 |
+
budget_label: str = Field(..., description="Best fit budget label from the budget tiers schema.")
|
| 41 |
+
justification: str = Field(..., description="Reason why this idea fits in the given budget.")
|
| 42 |
+
recommended_team_and_tools: str = Field(..., description="Detailed cost breakdown. Must not exceed budget.")
|
| 43 |
+
|
| 44 |
+
class VideoIdeasBudgetSchema(BaseModel):
|
| 45 |
+
ideas: list[IdeaMapping] = Field(..., description="List of 4 video ideas mapped with budget, justification, and cost breakdown.")
|
idea_to_budget_agent/utils/tools.py
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cost_table={
|
| 2 |
+
"production_cost_table": [
|
| 3 |
+
{
|
| 4 |
+
"item": "camera_rent_daily",
|
| 5 |
+
"label": "Camera Rental (Daily)",
|
| 6 |
+
"price_range_npr": "2,000 – 5,000",
|
| 7 |
+
"description": "Depends on camera quality – DSLR to semi-pro cinema cams"
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"item": "lighting_kit",
|
| 11 |
+
"label": "Lighting Kit Rental",
|
| 12 |
+
"price_range_npr": "1,000 – 3,000",
|
| 13 |
+
"description": "Basic LED lights to full 3-point lighting kits"
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"item": "editor_per_reel",
|
| 17 |
+
"label": "Video Editing (per reel)",
|
| 18 |
+
"price_range_npr": "2,000 – 6,000",
|
| 19 |
+
"description": "Includes transitions, sound sync, color grading"
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"item": "actor_per_day",
|
| 23 |
+
"label": "Actor Cost (per day)",
|
| 24 |
+
"price_range_npr": "1,500 – 4,000",
|
| 25 |
+
"description": "Based on experience and role complexity"
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
"item": "voiceover_artist",
|
| 29 |
+
"label": "Voiceover Artist",
|
| 30 |
+
"price_range_npr": "1,000 – 3,000",
|
| 31 |
+
"description": "For narration or character lines in the reel"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"item": "location_per_day",
|
| 35 |
+
"label": "Location Rental (per day)",
|
| 36 |
+
"price_range_npr": "1,000 – 5,000",
|
| 37 |
+
"description": "Standard gym, studio, or unique outdoor location"
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"item": "props_and_set",
|
| 41 |
+
"label": "Props and Set Design",
|
| 42 |
+
"price_range_npr": "500 – 3,000",
|
| 43 |
+
"description": "Includes small items, backdrops, thematic decoration"
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"item": "costume_and_makeup",
|
| 47 |
+
"label": "Costume and Makeup",
|
| 48 |
+
"price_range_npr": "1,000 – 3,500",
|
| 49 |
+
"description": "If any character styling or transformation is needed"
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"item": "background_music_license",
|
| 53 |
+
"label": "Background Music License",
|
| 54 |
+
"price_range_npr": "0 – 1,500",
|
| 55 |
+
"description": "Royalty-free or platform-safe music use"
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"item": "sound_engineering",
|
| 59 |
+
"label": "Sound Mixing & Sync",
|
| 60 |
+
"price_range_npr": "1,000 – 2,500",
|
| 61 |
+
"description": "Cleans background noise, balances music/voice"
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"item": "crew_support",
|
| 65 |
+
"label": "Crew Support (Assistant, Director)",
|
| 66 |
+
"price_range_npr": "2,000 – 6,000",
|
| 67 |
+
"description": "Helps with camera, lighting, direction during shoot"
|
| 68 |
+
}
|
| 69 |
+
]
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
budget_tiers_schema = {
|
| 73 |
+
"budget_tiers": [
|
| 74 |
+
{
|
| 75 |
+
"range_npr": "< 5,000",
|
| 76 |
+
"label": "Ultra-Low"
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"range_npr": "5,000 – 10,000",
|
| 80 |
+
"label": "Low Budget"
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"range_npr": "10,000 – 15,000",
|
| 84 |
+
"label": "Moderate Budget"
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"range_npr": "15,000 – 20,000",
|
| 88 |
+
"label": "Enhanced"
|
| 89 |
+
},
|
| 90 |
+
{
|
| 91 |
+
"range_npr": "20,000 – 25,000",
|
| 92 |
+
"label": "Premium"
|
| 93 |
+
},
|
| 94 |
+
{
|
| 95 |
+
"range_npr": "25,000+",
|
| 96 |
+
"label": "High-End"
|
| 97 |
+
}
|
| 98 |
+
]
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
|
idea_to_budget_agent/utils/utils.py
ADDED
|
File without changes
|
ideation_agent/utils/__pycache__/nodes.cpython-312.pyc
CHANGED
|
Binary files a/ideation_agent/utils/__pycache__/nodes.cpython-312.pyc and b/ideation_agent/utils/__pycache__/nodes.cpython-312.pyc differ
|
|
|
ideation_agent/utils/__pycache__/prompts.cpython-312.pyc
CHANGED
|
Binary files a/ideation_agent/utils/__pycache__/prompts.cpython-312.pyc and b/ideation_agent/utils/__pycache__/prompts.cpython-312.pyc differ
|
|
|
ideation_agent/utils/__pycache__/state.cpython-312.pyc
CHANGED
|
Binary files a/ideation_agent/utils/__pycache__/state.cpython-312.pyc and b/ideation_agent/utils/__pycache__/state.cpython-312.pyc differ
|
|
|
ideation_agent/utils/nodes.py
CHANGED
|
@@ -26,7 +26,6 @@ def ideator(state:State):
|
|
| 26 |
template = ideator_prompt(state)
|
| 27 |
messages = [SystemMessage(content=template),
|
| 28 |
HumanMessage(content=f'''The topic of the video is:\n{state.topic[-1]}\n''')]
|
| 29 |
-
print('Ideator prompt:', messages)
|
| 30 |
try:
|
| 31 |
response = ideator_agent.invoke({'messages':messages})
|
| 32 |
response = response['messages'][-1].content
|
|
@@ -45,7 +44,6 @@ def critic(state:State):
|
|
| 45 |
template = critic_prompt(state)
|
| 46 |
messages = [SystemMessage(content=template),
|
| 47 |
HumanMessage(content=f'''The topic of the video is:\n{state.topic[-1]}\n. The business_details is\n{state.business_details[-1]}\n''')]
|
| 48 |
-
print('Critic prompt:', messages)
|
| 49 |
|
| 50 |
try:
|
| 51 |
response = critic_agent.invoke({'messages':messages})
|
|
@@ -63,29 +61,23 @@ def critic(state:State):
|
|
| 63 |
|
| 64 |
|
| 65 |
def improver(state:State):
|
|
|
|
| 66 |
template = improver_prompt(state)
|
| 67 |
messages = [SystemMessage(content=template),
|
| 68 |
HumanMessage(content=f'''The topic of the video is:\n{state.topic[-1]}\n The business_details is:\n{state.business_details[-1]}''')]
|
| 69 |
-
print('
|
| 70 |
response = improver_llm.with_structured_output(ImproverResponseFormatter).invoke(messages)
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
state.critic_fault.append(response.faults)
|
| 73 |
-
print('Improver response:',
|
| 74 |
return state
|
| 75 |
|
| 76 |
-
|
| 77 |
-
# response = improver_agent.invoke({'messages':messages})
|
| 78 |
-
# response = response['messages'][-1].content
|
| 79 |
-
# print('Improver Response:',response)
|
| 80 |
-
# state.improver_response.append(response)
|
| 81 |
-
# print('Improver Improved the story')
|
| 82 |
-
# return state
|
| 83 |
-
|
| 84 |
-
# except:
|
| 85 |
-
# response = improver_llm.invoke(messages)
|
| 86 |
-
# print('Improver backup Response:',response.content)
|
| 87 |
-
# state.improver_response.append(response.content)
|
| 88 |
-
# return state
|
| 89 |
|
| 90 |
def validator1(state:State):
|
| 91 |
template = validator_prompt(state)
|
|
|
|
| 26 |
template = ideator_prompt(state)
|
| 27 |
messages = [SystemMessage(content=template),
|
| 28 |
HumanMessage(content=f'''The topic of the video is:\n{state.topic[-1]}\n''')]
|
|
|
|
| 29 |
try:
|
| 30 |
response = ideator_agent.invoke({'messages':messages})
|
| 31 |
response = response['messages'][-1].content
|
|
|
|
| 44 |
template = critic_prompt(state)
|
| 45 |
messages = [SystemMessage(content=template),
|
| 46 |
HumanMessage(content=f'''The topic of the video is:\n{state.topic[-1]}\n. The business_details is\n{state.business_details[-1]}\n''')]
|
|
|
|
| 47 |
|
| 48 |
try:
|
| 49 |
response = critic_agent.invoke({'messages':messages})
|
|
|
|
| 61 |
|
| 62 |
|
| 63 |
def improver(state:State):
|
| 64 |
+
response_list = []
|
| 65 |
template = improver_prompt(state)
|
| 66 |
messages = [SystemMessage(content=template),
|
| 67 |
HumanMessage(content=f'''The topic of the video is:\n{state.topic[-1]}\n The business_details is:\n{state.business_details[-1]}''')]
|
| 68 |
+
print('Improver Prompt:',messages)
|
| 69 |
response = improver_llm.with_structured_output(ImproverResponseFormatter).invoke(messages)
|
| 70 |
+
response_list.append(response.improved_idea1)
|
| 71 |
+
response_list.append(response.improved_idea2)
|
| 72 |
+
response_list.append(response.improved_idea3)
|
| 73 |
+
response_list.append(response.improved_idea4)
|
| 74 |
+
|
| 75 |
+
state.improver_response.append(str(response_list))
|
| 76 |
state.critic_fault.append(response.faults)
|
| 77 |
+
print('Improver response:',response_list)
|
| 78 |
return state
|
| 79 |
|
| 80 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
def validator1(state:State):
|
| 83 |
template = validator_prompt(state)
|
ideation_agent/utils/prompts.py
CHANGED
|
@@ -1,42 +1,49 @@
|
|
| 1 |
-
example = '''
|
| 2 |
-
**To better understand the expected tone, depth, and style, here are two sample ideas with their exact business contexts**:
|
| 3 |
|
| 4 |
-
---
|
| 5 |
-
|
| 6 |
-
**Example 1: Restaurant Business**
|
| 7 |
-
**Business Details**:
|
| 8 |
-
"business_type": "restaurant", "platform": "instagram", "target_audience": "youths", "business_goals": "to go global", "offerings": "nepali foods", "Challenges_faced": "finding new customers, attracting large customers"
|
| 9 |
|
| 10 |
-
**Core Idea (100 words)**:
|
| 11 |
-
The influencer challenges the chef: “Can your food impress people from 5 different countries?” The restaurant serves the same Nepali dish (like momo or gundruk soup) to five diverse international students/youths without telling them it’s Nepali. Each gives raw reactions and ratings. Once they fall in love with it, the reveal hits. Final line: “If the world loves it—why isn’t it global yet?” This idea plays on suspense, universal taste appeal, and social proof—turning traditional Nepali food into an underdog hero.
|
| 12 |
-
|
| 13 |
-
---
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
|
| 19 |
-
**
|
| 20 |
-
The influencer opens with: “What if your drip had 1,000 years of history behind it?” They showcase traditional Nepali garments reimagined with modern streetwear styling—hoodies with Dhaka patterns, joggers inspired by daura suruwal. Youths on the street try them on and react: “I’d totally wear this!” The story ends with: “Nepali fashion isn’t old—it’s timeless. And now, it’s global.” A core idea blending heritage with youth-driven reinvention, sparking both pride and curiosity.
|
| 21 |
|
| 22 |
---
|
| 23 |
-
'''
|
| 24 |
|
| 25 |
|
|
|
|
| 26 |
|
| 27 |
-
|
| 28 |
-
return f'''
|
| 29 |
-
You are a highly imaginative and strategic **video ideator** with a reputation for crafting unforgettable promotional video **core ideas** that go viral — all in **exactly 100 words**.
|
| 30 |
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
|
| 34 |
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
---
|
| 39 |
|
|
|
|
|
|
|
| 40 |
**Video Topic**:
|
| 41 |
{state.topic[-1]}
|
| 42 |
|
|
@@ -45,155 +52,203 @@ Use the response of the provided tool (which includes video stories from influen
|
|
| 45 |
|
| 46 |
---
|
| 47 |
|
| 48 |
-
|
| 49 |
-
- Output must be **one paragraph** only — not a list or outline.
|
| 50 |
-
- Do **not** use headers, titles, sections, or formatting like bullet points.
|
| 51 |
-
- The idea must be **exactly 100 words** — no more, no less.
|
| 52 |
-
- Prioritize originality, emotional engagement, and shareability.
|
| 53 |
-
- Keep it firmly grounded in the business details provided — product, audience, platform, challenge, and goal.
|
| 54 |
-
- Imagine this idea being executed by a top influencer with millions of views.
|
| 55 |
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
-
**
|
| 59 |
|
| 60 |
-
|
| 61 |
|
| 62 |
-
|
| 63 |
-
**Business Details**:
|
| 64 |
-
"business_type": "restaurant", "platform": "instagram", "target_audience": "youths", "business_goals": "to go global", "offerings": "nepali foods", "Challenges_faced": "finding new customers, attracting large customers"
|
| 65 |
|
| 66 |
-
|
| 67 |
-
The influencer challenges the chef: “Can your food impress people from 5 different countries?” The restaurant serves the same Nepali dish (like momo or gundruk soup) to five diverse international students/youths without telling them it’s Nepali. Each gives raw reactions and ratings. Once they fall in love with it, the reveal hits. Final line: “If the world loves it—why isn’t it global yet?” This idea plays on suspense, universal taste appeal, and social proof—turning traditional Nepali food into an underdog hero.
|
| 68 |
|
| 69 |
---
|
| 70 |
|
| 71 |
-
**
|
| 72 |
-
|
| 73 |
-
"business_type": "clothing business", "platform": "instagram", "target_audience": "youths", "business_goals": "to go global", "offerings": "nepali clothing products", "Challenges_faced": "finding new customers, attracting large customers"
|
| 74 |
|
| 75 |
-
**Core Idea (100 words)**:
|
| 76 |
-
The influencer opens with: “What if your drip had 1,000 years of history behind it?” They showcase traditional Nepali garments reimagined with modern streetwear styling—hoodies with Dhaka patterns, joggers inspired by daura suruwal. Youths on the street try them on and react: “I’d totally wear this!” The story ends with: “Nepali fashion isn’t old—it’s timeless. And now, it’s global.” A core idea blending heritage with youth-driven reinvention, sparking both pride and curiosity.
|
| 77 |
|
| 78 |
-
---
|
| 79 |
|
| 80 |
-
Now, generate your **core idea paragraph**.
|
| 81 |
-
'''
|
| 82 |
|
|
|
|
|
|
|
|
|
|
| 83 |
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
-
|
| 86 |
-
return f'''
|
| 87 |
-
You are an expert **video content strategist and creative critic**.
|
| 88 |
|
| 89 |
-
|
| 90 |
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
-
Also, you have to check whether the given idea is scattered in several dimensions or not. If it's scattered or bit vague, you have to mainrtain it at the root idea flowing smoothly in a core concept.
|
| 94 |
|
| 95 |
-
|
| 96 |
|
| 97 |
-
|
|
|
|
| 98 |
|
| 99 |
-
|
| 100 |
-
|
| 101 |
|
| 102 |
-
|
| 103 |
-
|
| 104 |
|
| 105 |
-
|
| 106 |
-
{state.ideator_response[-1]}
|
| 107 |
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
-
**Your Task as the Critic**:
|
| 111 |
-
1. List the **key faults** or weak areas in the original idea.
|
| 112 |
-
2. Provide a **revised version** of the idea that improves upon the original, maintains high creativity, and stays within 100 words.
|
| 113 |
|
| 114 |
-
{example}
|
| 115 |
-
'''
|
| 116 |
|
| 117 |
|
| 118 |
def improver_prompt(state):
|
| 119 |
disagreement_note = (
|
| 120 |
-
f"**Note:**
|
| 121 |
if len(state.disagreement_reason) > 0 else ""
|
| 122 |
)
|
| 123 |
-
|
| 124 |
-
return f'''
|
| 125 |
-
You are a master-level **video concept developer** known for turning creative ideas into standout, refined gems.
|
| 126 |
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
-
1. **
|
| 130 |
-
2. **
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
|
| 132 |
-
|
| 133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
---
|
| 135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
**Video Topic**:
|
| 137 |
{state.topic[-1]}
|
| 138 |
|
| 139 |
**Business Details**:
|
| 140 |
{state.business_details[-1]}
|
| 141 |
|
| 142 |
-
|
| 143 |
-
{state.critic_response[-1]}
|
| 144 |
|
| 145 |
-
|
|
|
|
| 146 |
|
| 147 |
---
|
| 148 |
|
| 149 |
-
**
|
| 150 |
-
|
| 151 |
-
**B. Write a final improved idea (100 words exactly). If no faults found, repeat the critic’s version.**
|
| 152 |
|
| 153 |
-
{
|
| 154 |
-
'''
|
| 155 |
|
|
|
|
| 156 |
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
You are a strict and unbiased judge responsible for evaluating whether a promotional video idea is ready for publishing.
|
| 160 |
|
| 161 |
-
You will be given the video topic, business details, and the final version of the video idea (after improvement). Your task is to assess if this idea meets all necessary standards in terms of:
|
| 162 |
|
| 163 |
-
- Relevance to the video topic
|
| 164 |
-
- Alignment with the business context
|
| 165 |
-
- Tone matching the business type
|
| 166 |
-
- Creativity and clarity
|
| 167 |
|
| 168 |
-
You can also use the tool's response as your reference to make the validation. The tool's response includes existing influencer-style stories or content for reference.
|
| 169 |
|
| 170 |
-
---
|
| 171 |
|
|
|
|
|
|
|
|
|
|
| 172 |
|
| 173 |
-
|
| 174 |
-
{state.topic[-1]}
|
| 175 |
|
| 176 |
-
|
| 177 |
-
{state.business_details[-1]}
|
| 178 |
|
| 179 |
-
|
| 180 |
-
|
|
|
|
|
|
|
|
|
|
| 181 |
|
| 182 |
-
|
|
|
|
| 183 |
|
| 184 |
-
|
| 185 |
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
|
| 190 |
-
---
|
| 191 |
|
| 192 |
-
|
|
|
|
| 193 |
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
|
| 198 |
-
2. Give a short reason of 30 words why the idea is validated or not validated.
|
| 199 |
-
'''
|
|
|
|
|
|
|
|
|
|
| 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
+
def ideator_prompt(state):
|
| 5 |
+
return f"""
|
| 6 |
+
You are a **bold, imaginative, and culturally-attuned video ideator** trusted by top global brands to craft **crisp, original, and high-impact video concepts** for social platforms like TikTok, Instagram, and YouTube.
|
| 7 |
|
| 8 |
+
Your task is to create **exactly 4 highly original video ideas**, each in **exactly 40 words**. These are not scripts or taglines — they are **powerful conceptual seeds**: short, visual, emotionally charged ideas that can spark full videos. Your ideas should feel fresh, scroll-stopping, and deeply resonant with today’s audiences.
|
|
|
|
| 9 |
|
| 10 |
---
|
|
|
|
| 11 |
|
| 12 |
|
| 13 |
+
### What is a 40-word video idea?
|
| 14 |
|
| 15 |
+
A video idea is a **standalone, high-concept creative spark**. It hints at a compelling moment, scenario, or transformation — not the full story. It’s short, but strong enough to fuel the entire video direction.
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
This differs from a full story in that:
|
| 18 |
+
- You’re generating **4 completely distinct mini-concepts**, not one long arc.
|
| 19 |
+
- Each idea stands alone — a unique emotional core.
|
| 20 |
+
- Think in **cinematic micro-moments**, full of emotion, surprise, or visual contrast.
|
| 21 |
|
| 22 |
+
---
|
| 23 |
|
| 24 |
+
### Output & Formatting Guidelines:
|
| 25 |
+
- Provide **exactly 4 ideas**, each in **exactly 40 words** .
|
| 26 |
+
- Do **not** number or label the ideas.
|
| 27 |
+
- Each idea should be a **self-contained, cinematic pitch** — visual, emotionally compelling, and easily translatable into video.
|
| 28 |
+
- Avoid lists, taglines, or instructions. Focus on **visually-driven storytelling**.
|
| 29 |
+
- Be **creative with characters, symbols, or twists** — do not simply rephrase the business info.
|
| 30 |
+
- Start from **an unexpected or abstract scene**, character, or event — then subtly anchor it to the business concept in the conclusion.
|
| 31 |
+
- Ensure every idea is **platform-native**, emotionally viral, and rooted in **the business details provided**.
|
| 32 |
|
| 33 |
+
---
|
| 34 |
+
### Very Important Reminder:
|
| 35 |
+
- Do not start or potray the idea directly by context of the topic and business details. Start from entirely different plot , event or character and conclude to the topic and details at last making it creative and unique just like in the example that includes coffee slipping before the date , earthquake surviving , security guard in the luxury mall etc. These starting plots differs from the clothing business but they creatively concluded at the end.
|
| 36 |
+
- Every 4 ideas must be very diverse. They have to be completely different from each other.
|
| 37 |
+
- NEVER use the contexts of topics as opening scenarios - Begin with completely unrelated situations like accidents, mysteries, competitions, discoveries, or social experiments. For eg: If the context is about restaurant don't start with chef, restaurant or related things directly.
|
| 38 |
+
- Avoid repeating similar character types - **Do not use same characters , or same workplace scenarios, or same situations etc across the 4 ideas**.
|
| 39 |
+
- Please think **Out of the box** ideas. Surprise like a creative genius. Your idea can never be thought by a simple human.
|
| 40 |
+
|
| 41 |
+
---
|
| 42 |
|
| 43 |
---
|
| 44 |
|
| 45 |
+
### Your Assignment:
|
| 46 |
+
|
| 47 |
**Video Topic**:
|
| 48 |
{state.topic[-1]}
|
| 49 |
|
|
|
|
| 52 |
|
| 53 |
---
|
| 54 |
|
| 55 |
+
### Example Reference:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
+
**Business Details**:
|
| 58 |
+
"business_type": "women’s ethnic fashion brand",
|
| 59 |
+
"platform": "Instagram and TikTok",
|
| 60 |
+
"target_audience": "young Nepali women (ages 18–35) who value tradition with a modern twist",
|
| 61 |
+
"business_goals": "to grow a loyal, style-forward female customer base and expand across all major cities in Nepal",
|
| 62 |
+
"offerings": "authentic Nepali ethnic wear reimagined with bold colors, modern cuts, and cultural pride — from dhaka dresses to fusion kurtis and handcrafted accessories",
|
| 63 |
+
"Challenges_faced": "struggling to break into urban youth markets and stand out in a saturated online fashion scene"
|
| 64 |
|
| 65 |
+
**Video Ideas (each exactly 40 words):**
|
| 66 |
|
| 67 |
+
A woman accidentally spills coffee on her modern outfit before a date. Panicking, she raids her grandmother’s trunk and pieces together a fusion look using dhaka fabrics. Her date is mesmerized. Twist: he’s also in traditional wear. The moment is magical — a perfect blend of heritage and attraction.
|
| 68 |
|
| 69 |
+
An earthquake survivor finds her childhood home in ruins. Among the debris, she discovers her mother’s preserved ethnic dress. She wears it to job interviews, her graduation, and eventually her wedding. The same outfit evolves into her symbol of survival, growth, and deep cultural pride.
|
|
|
|
|
|
|
| 70 |
|
| 71 |
+
A security guard watches a woman silently admire expensive western outfits daily. One day, she walks in wearing a vibrant dhaka fusion kurti. Cameras click, people stare. A luxury brand manager approaches her. The message: true style doesn’t come with a price tag — it comes with roots.
|
|
|
|
| 72 |
|
| 73 |
---
|
| 74 |
|
| 75 |
+
Now, based on the video topic and business details above, generate **four original, 40-word promotional video ideas** that can inspire unforgettable video content.
|
| 76 |
+
"""
|
|
|
|
| 77 |
|
|
|
|
|
|
|
| 78 |
|
|
|
|
| 79 |
|
|
|
|
|
|
|
| 80 |
|
| 81 |
+
def critic_prompt(state):
|
| 82 |
+
return f"""
|
| 83 |
+
You are a sharp, imaginative, and detail-oriented **video idea critic**. You’ve been assigned to **critique 4 video ideas** created by another ideator and then **refine or improve** them.
|
| 84 |
|
| 85 |
+
Your job is twofold:
|
| 86 |
+
1. **Identify flaws** (if any) in one or more of the ideas — repetition, weak twist, boring start, lack of connection to business, etc.
|
| 87 |
+
2. **Generate a better version** of each idea — keeping it true to the core if it’s already good, or replacing it if needed.
|
| 88 |
|
| 89 |
+
---
|
|
|
|
|
|
|
| 90 |
|
| 91 |
+
### Very Important Creative Guidelines:
|
| 92 |
|
| 93 |
+
- **Each idea must be exactly 40 words**.
|
| 94 |
+
- Ideas must start with an **unrelated or abstract plot, character, or situation** — never directly with the business context.
|
| 95 |
+
- Please **Don't potray the topic and business details in the beginning of the idea**. The topic and business details have to come into picture as the main conclusion of the idea.
|
| 96 |
+
- Every 4 ideas must be very diverse. They have to be completely different from each other.
|
| 97 |
+
- Each idea must **creatively conclude** by connecting to the business.
|
| 98 |
+
- **Avoid repeating** characters, locations, or similar scenarios across the four ideas.
|
| 99 |
+
- **Refine only when needed**. If an original idea is already great, make light edits — don’t change it completely.
|
| 100 |
+
- Make ideas **scroll-stopping**, emotional, and suitable for Instagram/TikTok/YouTube.
|
| 101 |
+
- Do **not output critique per idea**. Instead, summarize faults collectively in one section if any.
|
| 102 |
|
|
|
|
| 103 |
|
| 104 |
+
---
|
| 105 |
|
| 106 |
+
### Video Topic:
|
| 107 |
+
{state.topic[-1]}
|
| 108 |
|
| 109 |
+
### Business Details:
|
| 110 |
+
{state.business_details[-1]}
|
| 111 |
|
| 112 |
+
### Original Ideas by Ideator:
|
| 113 |
+
{state.ideator_response[-1]}
|
| 114 |
|
| 115 |
+
---
|
|
|
|
| 116 |
|
| 117 |
+
**Format your response like this:**
|
| 118 |
+
|
| 119 |
+
---
|
| 120 |
+
Faults: Faults in any of the 4 ideas of ideator
|
| 121 |
+
|
| 122 |
+
---
|
| 123 |
+
Improved Ideas from Critic:
|
| 124 |
+
**improved_first idea of 40 words**
|
| 125 |
+
**improved_second idea of 40 words**
|
| 126 |
+
**improved_third idea of 40 words**
|
| 127 |
+
|
| 128 |
+
---
|
| 129 |
+
"""
|
| 130 |
|
|
|
|
|
|
|
|
|
|
| 131 |
|
|
|
|
|
|
|
| 132 |
|
| 133 |
|
| 134 |
def improver_prompt(state):
|
| 135 |
disagreement_note = (
|
| 136 |
+
f"**Note:** The previous version was not validated because:\n{state.disagreement_reason[-1]}\n"
|
| 137 |
if len(state.disagreement_reason) > 0 else ""
|
| 138 |
)
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
+
return f"""
|
| 141 |
+
You are a highly skilled, creative, and discerning **video concept improver**. Two previous agents — the *Ideator* and the *Critic* — have worked on this task. Now, it’s your job to **analyze both**, identify any faults in the *critic's refinements*, and deliver the **final, most powerful version** of the 4 video ideas.
|
| 142 |
+
|
| 143 |
+
---
|
| 144 |
+
|
| 145 |
+
### Your Responsibilities:
|
| 146 |
|
| 147 |
+
1. **Read the original 4 ideas from the Ideator.**
|
| 148 |
+
2. **Read the improved 4 ideas from the Critic.**
|
| 149 |
+
4. Identify any issues in the *critic’s version*, such as:
|
| 150 |
+
- Loss of originality from ideator's idea
|
| 151 |
+
- Overcorrection or unnecessary replacement
|
| 152 |
+
- Weak twists, lack of emotional resonance, dull opening
|
| 153 |
+
- Repetition of themes, settings, characters across the 4 ideas
|
| 154 |
|
| 155 |
+
You do **not need to critique the ideator again** — focus **only on identifying the issues in the critic's improved ideas**.
|
| 156 |
|
| 157 |
+
4. Then, write **your final improved version of the 4 ideas**, using the best elements from both versions (or inventing better ones).
|
| 158 |
+
- Stick to **exactly 40 words per idea**
|
| 159 |
+
- Start with a surprising or unrelated event/character/symbol
|
| 160 |
+
- Conclude creatively with the business offering or mission
|
| 161 |
+
- Ensure **diversity** between the 4 ideas — no repetition of theme, tone, or character
|
| 162 |
+
- Refine only when needed. If the improved idea of critic is already great, make light edits or no edits — don’t change it completely.
|
| 163 |
+
-
|
| 164 |
+
|
| 165 |
+
---
|
| 166 |
+
|
| 167 |
+
### Very Important Reminder:
|
| 168 |
+
- Do not start or potray the idea directly by context of the topic and business details. Start from entirely different plot , event or character and conclude to the topic and details at last making it creative and unique just like in the example that includes coffee slipping before the date , earthquake surviving , security guard in the luxury mall etc. These starting plots differs from the clothing business but they creatively concluded at the end.
|
| 169 |
+
- Every 4 ideas must be very diverse. They have to be completely different from each other.
|
| 170 |
+
- NEVER use the contexts of topics as opening scenarios - Begin with completely unrelated situations like accidents, mysteries, competitions, discoveries, or social experiments. For eg: If the context is about restaurant don't start with chef, restaurant or related things directly.
|
| 171 |
+
- Avoid repeating similar character types - **Do not use same characters , or same workplace scenarios, or same situations etc across the 4 ideas**.
|
| 172 |
+
- Please **Don't potray the topic and business details in the beginning of the idea**. The topic and business details have to come into picture as the main conclusion of the idea.
|
| 173 |
+
- Please think **Out of the box** ideas. Surprise like a creative genius. Your idea can never be thought by a simple human.
|
| 174 |
---
|
| 175 |
|
| 176 |
+
### Output Format (Strict):
|
| 177 |
+
|
| 178 |
+
---
|
| 179 |
+
Faults: Faults in any of the 4 ideas of critic
|
| 180 |
+
|
| 181 |
+
---
|
| 182 |
+
Improved Ideas from Improver:
|
| 183 |
+
**improved_final_first idea of 40 words**
|
| 184 |
+
**improved_final_second idea of 40 words**
|
| 185 |
+
**improved_final_third idea of 40 words**
|
| 186 |
+
|
| 187 |
+
---
|
| 188 |
+
|
| 189 |
+
### Input:
|
| 190 |
+
|
| 191 |
**Video Topic**:
|
| 192 |
{state.topic[-1]}
|
| 193 |
|
| 194 |
**Business Details**:
|
| 195 |
{state.business_details[-1]}
|
| 196 |
|
| 197 |
+
---
|
|
|
|
| 198 |
|
| 199 |
+
**Ideas from Ideator**:
|
| 200 |
+
{state.ideator_response[-1]}
|
| 201 |
|
| 202 |
---
|
| 203 |
|
| 204 |
+
**Faults of ideator and improved Ideas from Critic**:
|
| 205 |
+
{state.critic_response[-1]}
|
|
|
|
| 206 |
|
| 207 |
+
**{disagreement_note}**
|
|
|
|
| 208 |
|
| 209 |
+
---
|
| 210 |
|
| 211 |
+
Now begin your final analysis and output your improved 4 ideas in the required format.
|
| 212 |
+
"""
|
|
|
|
| 213 |
|
|
|
|
| 214 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
|
|
|
|
| 216 |
|
|
|
|
| 217 |
|
| 218 |
+
def validator_prompt(state):
|
| 219 |
+
return f'''
|
| 220 |
+
You are reviewing 4 short video ideas meant for a social media promotional campaign.
|
| 221 |
|
| 222 |
+
Each idea creatively tells a short story that connects indirectly to the business details — starting from an unrelated or surprising scenario and ending with a clever link back to the business theme.
|
|
|
|
| 223 |
|
| 224 |
+
---
|
|
|
|
| 225 |
|
| 226 |
+
**Video Topic**:
|
| 227 |
+
{state.topic[-1]}
|
| 228 |
+
|
| 229 |
+
**Business Details**:
|
| 230 |
+
{state.business_details[-1]}
|
| 231 |
|
| 232 |
+
**Final 4 Ideas from Improver**:
|
| 233 |
+
{state.improver_response[-1]}
|
| 234 |
|
| 235 |
+
---
|
| 236 |
|
| 237 |
+
### Friendly Review Guidelines:
|
| 238 |
+
- Each idea should begin with an **unusual or imaginative scenario** (like a mystery, surprise, or random event) and **end by cleverly connecting to the business details** (like goals, services, or audience).
|
| 239 |
+
- The ideas should be **visually different** and **emotionally engaging**, avoiding repetition of characters or scenes across all four.
|
| 240 |
+
- It's okay if the ideas are metaphorical, humorous, or slightly abstract — as long as the **final message feels connected to the business**.
|
| 241 |
+
- Only mark “not validated” if one or more ideas:
|
| 242 |
+
• start too obviously with the business context,
|
| 243 |
+
• never connect to the business at all,
|
| 244 |
+
• or feel almost identical to each other.
|
| 245 |
+
---
|
| 246 |
|
|
|
|
| 247 |
|
| 248 |
+
### Output Instructions:
|
| 249 |
+
Return exactly 2 things:
|
| 250 |
|
| 251 |
+
1. **Validation status** — Only respond with `validated` or `not validated`.
|
| 252 |
+
2.**If not validated**, give a short, kind explanation (under 40 words) of what could be improved, or why isn't it validated.
|
| 253 |
+
'''
|
| 254 |
|
|
|
|
|
|
ideation_agent/utils/state.py
CHANGED
|
@@ -22,7 +22,14 @@ class QueryFormatter(BaseModel):
|
|
| 22 |
|
| 23 |
class ImproverResponseFormatter(BaseModel):
|
| 24 |
faults: str= Field(description="Returns the faults of the critic's response if any.")
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
class ValidationFormatter(BaseModel):
|
| 28 |
result: str = Field(description="Returns **validated** if the story is validated. Returns **not validated** if story is not validated.")
|
|
|
|
| 22 |
|
| 23 |
class ImproverResponseFormatter(BaseModel):
|
| 24 |
faults: str= Field(description="Returns the faults of the critic's response if any.")
|
| 25 |
+
improved_idea1: str = Field(description="Returns the first improved idea of exactly 40 words. If no faults found, repeat the critic's version.")
|
| 26 |
+
improved_idea2: str = Field(description="Returns the second improved idea of exactly 40 words. If no faults found, repeat the critic's version.")
|
| 27 |
+
improved_idea3: str = Field(description="Returns the third improved idea of exactly 40 words. If no faults found, repeat the critic's version.")
|
| 28 |
+
improved_idea4: str = Field(description="Returns the fourth improved idea of exactly 40 words. If no faults found, repeat the critic's version.")
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
| 33 |
|
| 34 |
class ValidationFormatter(BaseModel):
|
| 35 |
result: str = Field(description="Returns **validated** if the story is validated. Returns **not validated** if story is not validated.")
|
main.py
CHANGED
|
@@ -9,6 +9,7 @@ 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 ideation_agent.agent import ideation_graph
|
| 13 |
from langgraph.errors import GraphRecursionError
|
| 14 |
|
|
@@ -23,8 +24,22 @@ idea_graph = ideation_graph()
|
|
| 23 |
brainstrom_graph = brainstroming_graph()
|
| 24 |
|
| 25 |
stored_data={}
|
| 26 |
-
stored_data['business_details']={"business_type": "
|
| 27 |
-
stored_data['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
class UserMessage(BaseModel):
|
| 29 |
message: str
|
| 30 |
@app.post("/context-analysis")
|
|
@@ -56,7 +71,7 @@ class IdeationRequest(BaseModel):
|
|
| 56 |
|
| 57 |
@app.post("/ideation")
|
| 58 |
def ideation_endpoint(request:IdeationRequest):
|
| 59 |
-
config={"recursion_limit":
|
| 60 |
try:
|
| 61 |
result = idea_graph.invoke(
|
| 62 |
{
|
|
@@ -66,12 +81,20 @@ def ideation_endpoint(request:IdeationRequest):
|
|
| 66 |
config=config,
|
| 67 |
)
|
| 68 |
stored_data['final_ideation'] = result['improver_response'][-1]
|
|
|
|
|
|
|
| 69 |
return {'response':result}
|
| 70 |
except GraphRecursionError:
|
| 71 |
result = idea_graph.get_state({"configurable": {"thread_id": "ideation_thread123"}})
|
| 72 |
return {'response': result[0]}
|
| 73 |
|
|
|
|
|
|
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
|
| 77 |
class BrainstormRequest(BaseModel):
|
|
@@ -84,7 +107,7 @@ def brainstroming_endpoint(
|
|
| 84 |
request: BrainstormRequest, # 🔥 Full JSON body here
|
| 85 |
):
|
| 86 |
result = brainstrom_graph.invoke({
|
| 87 |
-
'topic': [stored_data['final_ideation']],
|
| 88 |
'images': request.image_base64_list,
|
| 89 |
'latest_preferred_topics': request.preferred_topics,
|
| 90 |
'business_details': (lambda d: d['business_details'] if 'business_details' in d else {})(stored_data)
|
|
@@ -104,7 +127,9 @@ def generate_final_story_endpoint():
|
|
| 104 |
return {
|
| 105 |
'response': final_story
|
| 106 |
}
|
| 107 |
-
|
|
|
|
|
|
|
| 108 |
@app.post("/generate-image")
|
| 109 |
def generate_image_endpoint():
|
| 110 |
image = generate_image(str(stored_data['final_story']))
|
|
|
|
| 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 |
|
|
|
|
| 24 |
brainstrom_graph = brainstroming_graph()
|
| 25 |
|
| 26 |
stored_data={}
|
| 27 |
+
# 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"}
|
| 28 |
+
stored_data['business_details'] = {
|
| 29 |
+
"business_type": "fitness and gym",
|
| 30 |
+
"platform": "Instagram, TikTok",
|
| 31 |
+
"target_audience": "young Nepali adults (ages 18–40) who are health-conscious and active on social media",
|
| 32 |
+
"business_goals": "to expand gym branches across all major cities of Nepal and build a strong fitness community",
|
| 33 |
+
"offerings": "personal training, group fitness classes, modern workout equipment, nutrition guidance, and wellness programs",
|
| 34 |
+
"Challenges_faced": "attracting loyal members, standing out in a competitive market, and promoting consistent engagement"
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
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''',
|
| 40 |
+
'''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.''',
|
| 41 |
+
'''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''',
|
| 42 |
+
'''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.''']
|
| 43 |
class UserMessage(BaseModel):
|
| 44 |
message: str
|
| 45 |
@app.post("/context-analysis")
|
|
|
|
| 71 |
|
| 72 |
@app.post("/ideation")
|
| 73 |
def ideation_endpoint(request:IdeationRequest):
|
| 74 |
+
config={"recursion_limit":15, "configurable": {"thread_id": "ideation_thread123"}}
|
| 75 |
try:
|
| 76 |
result = idea_graph.invoke(
|
| 77 |
{
|
|
|
|
| 81 |
config=config,
|
| 82 |
)
|
| 83 |
stored_data['final_ideation'] = result['improver_response'][-1]
|
| 84 |
+
stored_data['final_ideation']=ast.literal_eval(stored_data['final_ideation'])
|
| 85 |
+
|
| 86 |
return {'response':result}
|
| 87 |
except GraphRecursionError:
|
| 88 |
result = idea_graph.get_state({"configurable": {"thread_id": "ideation_thread123"}})
|
| 89 |
return {'response': result[0]}
|
| 90 |
|
| 91 |
+
class BudgetMappingRequest(BaseModel):
|
| 92 |
+
pass
|
| 93 |
|
| 94 |
+
@app.post("/budget-mapping")
|
| 95 |
+
def budget_mapping_endpoint():
|
| 96 |
+
result = budget_calculator(stored_data["business_details"],stored_data['final_ideation'])
|
| 97 |
+
return {'response':result}
|
| 98 |
|
| 99 |
|
| 100 |
class BrainstormRequest(BaseModel):
|
|
|
|
| 107 |
request: BrainstormRequest, # 🔥 Full JSON body here
|
| 108 |
):
|
| 109 |
result = brainstrom_graph.invoke({
|
| 110 |
+
'topic': [stored_data['final_ideation'][0]],
|
| 111 |
'images': request.image_base64_list,
|
| 112 |
'latest_preferred_topics': request.preferred_topics,
|
| 113 |
'business_details': (lambda d: d['business_details'] if 'business_details' in d else {})(stored_data)
|
|
|
|
| 127 |
return {
|
| 128 |
'response': final_story
|
| 129 |
}
|
| 130 |
+
stored_data['final_story']= '''A cinematic journey follows a street magician\'s
|
| 131 |
+
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
|
| 132 |
+
backdrop of urban grandeur and pulsing energy.'''
|
| 133 |
@app.post("/generate-image")
|
| 134 |
def generate_image_endpoint():
|
| 135 |
image = generate_image(str(stored_data['final_story']))
|
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
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from langchain_groq import ChatGroq
|
| 2 |
from langchain_openai import ChatOpenAI
|
| 3 |
-
from sentence_transformers import SentenceTransformer
|
| 4 |
-
from huggingface_hub import InferenceClient
|
| 5 |
from huggingface_hub import login
|
| 6 |
from dotenv import load_dotenv
|
| 7 |
load_dotenv()
|
|
@@ -17,14 +17,12 @@ os.environ['GROQ_API_KEY']=os.getenv('GROQ_API_KEY')
|
|
| 17 |
llm = ChatGroq(
|
| 18 |
model="llama3-8b-8192",
|
| 19 |
temperature=0.3,
|
| 20 |
-
max_tokens=500,
|
| 21 |
|
| 22 |
)
|
| 23 |
|
| 24 |
# llm = ChatOpenAI(
|
| 25 |
# model="gpt-4o-mini",
|
| 26 |
# temperature=0.3,
|
| 27 |
-
# max_tokens=500,
|
| 28 |
# )
|
| 29 |
|
| 30 |
|
|
@@ -55,37 +53,42 @@ ST = HFEmbeddingAPI(
|
|
| 55 |
|
| 56 |
# Initiated the models for ideation
|
| 57 |
|
| 58 |
-
ideator_llm = ChatGroq(
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
|
| 63 |
-
)
|
| 64 |
|
| 65 |
-
critic_llm = ChatGroq(
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
|
| 70 |
-
)
|
| 71 |
|
| 72 |
# improver_llm = ChatOpenAI(
|
| 73 |
# model="gpt-4o-mini",
|
| 74 |
-
# temperature=0.
|
| 75 |
# max_tokens=500,
|
| 76 |
# )
|
| 77 |
|
| 78 |
improver_llm = ChatGroq(
|
| 79 |
-
model="
|
| 80 |
-
temperature=0.
|
| 81 |
max_tokens=500,
|
| 82 |
|
| 83 |
)
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
max_tokens=500,
|
| 88 |
|
| 89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
|
|
|
|
| 1 |
from langchain_groq import ChatGroq
|
| 2 |
from langchain_openai import ChatOpenAI
|
| 3 |
+
# from sentence_transformers import SentenceTransformer
|
| 4 |
+
# from huggingface_hub import InferenceClient
|
| 5 |
from huggingface_hub import login
|
| 6 |
from dotenv import load_dotenv
|
| 7 |
load_dotenv()
|
|
|
|
| 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 |
|
|
|
|
| 53 |
|
| 54 |
# Initiated the models for ideation
|
| 55 |
|
| 56 |
+
# ideator_llm = ChatGroq(
|
| 57 |
+
# model="llama-3.1-8b-instant",
|
| 58 |
+
# temperature=0.7,
|
| 59 |
+
# max_tokens=500,
|
| 60 |
|
| 61 |
+
# )
|
| 62 |
|
| 63 |
+
# critic_llm = ChatGroq(
|
| 64 |
+
# model="llama-3.3-70b-versatile",
|
| 65 |
+
# temperature=0.7,
|
| 66 |
+
# max_tokens=500,
|
| 67 |
|
| 68 |
+
# )
|
| 69 |
|
| 70 |
# improver_llm = ChatOpenAI(
|
| 71 |
# model="gpt-4o-mini",
|
| 72 |
+
# temperature=0.7,
|
| 73 |
# max_tokens=500,
|
| 74 |
# )
|
| 75 |
|
| 76 |
improver_llm = ChatGroq(
|
| 77 |
+
model="llama3-8b-8192",
|
| 78 |
+
temperature=0.7,
|
| 79 |
max_tokens=500,
|
| 80 |
|
| 81 |
)
|
| 82 |
+
ideator_llm = improver_llm
|
| 83 |
+
critic_llm = improver_llm
|
| 84 |
+
validator_llm = improver_llm
|
|
|
|
| 85 |
|
| 86 |
+
|
| 87 |
+
# validator_llm = ChatGroq(
|
| 88 |
+
# model="llama-3.3-70b-versatile",
|
| 89 |
+
# temperature=0.7,
|
| 90 |
+
# max_tokens=500,
|
| 91 |
+
|
| 92 |
+
# )
|
| 93 |
|
| 94 |
|