File size: 703 Bytes
6b61df1
 
 
 
 
 
 
 
 
 
 
9275e34
6b61df1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import requests
from langchain_core.messages import SystemMessage,HumanMessage
from ..utils.schemas import PeakCommentHourFormatter
from ..utils.prompts import peak_comment_hour_prompt
from ..utils.utils import process_query

def get_peak_comment_hour(state,llm_gpt,url):
    messages = [SystemMessage(content=peak_comment_hour_prompt), 
    HumanMessage(content=str(state['messages']))]
    parameters=llm_gpt.with_structured_output(PeakCommentHourFormatter , 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