Spaces:
Sleeping
Sleeping
| 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 | |