ML-Learner / python_backend /src /Agents /nodes /question_generator_node.py
VashuTheGreat2's picture
Upload folder using huggingface_hub
c01955c verified
from utils.asyncHandler import asyncHandler
from src.Agents.prompts import QuestionGeneraterPrompt
from src.Agents.llm.llm_loader import llm
from src.Agents.tools.taivily_search_tool import Taivily_search
from src.Agents.models.interview_model import ChatState
from langsmith import traceable
taivily_search=Taivily_search()._tavily_search()
tools=[taivily_search]
@asyncHandler
@traceable(name="question_Generator",tags=["interview:question_generator"])
async def generate_questions(state:ChatState):
prompt = QuestionGeneraterPrompt.format(topic=state.topic)
llm_with_tools = llm.bind_tools(tools=tools)
res = llm_with_tools.invoke(prompt)
return {'questions_generated':res.content}