Spaces:
Sleeping
Sleeping
File size: 697 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 EmojiCountFormater
from ..utils.prompts import emoji_count_prompt
from ..utils.utils import process_query
def get_emoji_count(state,llm_gpt , url):
messages = [SystemMessage(content=emoji_count_prompt),
HumanMessage(content=str(state['messages']))]
parameters=llm_gpt.with_structured_output(EmojiCountFormater , method='function_calling').invoke(messages)
print(parameters)
response = requests.get(url, params={'top_n': parameters.top_n, 'influencer_username':process_query(parameters.influencer_name)})
print('The response is:', response)
return response
|