Spaces:
Sleeping
Sleeping
Download src/genai/analytics_chatbot/handlers/comment_quality.py from DvorakInnovationAI/GenAI-FASTAPI: direct link, hf CLI and curl.
- Browser
- Download file 740 Bytes
-
https://huggingface.co/spaces/DvorakInnovationAI/GenAI-FASTAPI/resolve/main/src/genai/analytics_chatbot/handlers/comment_quality.py
- Command line
-
hf download hf://spaces/DvorakInnovationAI/GenAI-FASTAPI/src/genai/analytics_chatbot/handlers/comment_quality.py
-
curl -L -o comment_quality.py https://huggingface.co/spaces/DvorakInnovationAI/GenAI-FASTAPI/resolve/main/src/genai/analytics_chatbot/handlers/comment_quality.py
740 Bytes
| import requests | |
| from langchain_core.messages import SystemMessage,HumanMessage | |
| from ..utils.schemas import CommentQualityFormatter | |
| from ..utils.prompts import comment_quality_prompt | |
| from ..utils.utils import process_query | |
| def get_comment_quality(state,llm_gpt,url): | |
| messages = [SystemMessage(content=comment_quality_prompt), | |
| HumanMessage(content=str(state['messages']))] | |
| parameters=llm_gpt.with_structured_output(CommentQualityFormatter , method='function_calling').invoke(messages) | |
| print(parameters) | |
| response = requests.get(url, params={ 'start_date': parameters.start_date , 'end_date':parameters.end_date,'influencer_username':process_query(parameters.influencer_name)}) | |
| print(response) | |
| return response | |