Spaces:
Sleeping
Sleeping
| from loggers.logger import logger | |
| from template.transform_prompt import QUERY_CHAIN | |
| import sys | |
| sys.dont_write_bytecode = True | |
| query_chain = QUERY_CHAIN | |
| def transform_query(state): | |
| """ | |
| Transform the user query to web search | |
| Args: | |
| state (dict): The current graph state | |
| Returns: | |
| state (dict): Appended search query | |
| """ | |
| logger.info("INSIDE QUERY TRANSFORMATION FOR WEB SEARCH") | |
| question = state['question'] | |
| gen_question = query_chain.invoke({"question": question}) | |
| search_query = gen_question['query'] | |
| return { | |
| "search_query": search_query | |
| } |