subashpoudel's picture
next commit
6b61df1
import requests
from langchain_core.messages import SystemMessage,HumanMessage
from ..utils.schemas import PostingTimeFormatter
from ..utils.prompts import posting_time_analysis_prompt
from ..utils.utils import process_query
def get_posting_time(state,llm_gpt,url):
messages = [SystemMessage(content=posting_time_analysis_prompt),
HumanMessage(content=str(state['messages']))]
parameters=llm_gpt.with_structured_output(PostingTimeFormatter , method='function_calling').invoke(messages)
response = requests.get(url, params={'start_date': parameters.start_date , 'end_date':parameters.end_date, 'influencer_username':process_query(parameters.influencer_name)})
return response