File size: 1,105 Bytes
b623e6c
 
 
583f6dd
b623e6c
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from .utils.prompts import budgeting_prompt
from langchain_core.messages import SystemMessage , ToolMessage, FunctionMessage
from.utils.tools import cost_table,budget_tiers_schema
from src.genai.utils.models_loader import llm
from .utils.state import json_schema, VideoIdeasBudgetSchema

def budget_calculator(business_details, final_ideation):
    print('The final ideation is:',final_ideation)
    print('type:',type(final_ideation))
    template = budgeting_prompt(final_ideation,business_details)
    messages = [SystemMessage(content=template),
                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'),
                # 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')]
                ]
    response = llm.with_structured_output(VideoIdeasBudgetSchema).invoke(messages)
    print('Budget Calculator Response:\n',response)
    return response