File size: 707 Bytes
6b61df1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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