Spaces:
Sleeping
Sleeping
Download agentic_rag/generation.py from Datamind23/AI_Research_Assis: direct link, hf CLI and curl.
- Browser
- Download file 869 Bytes
-
https://huggingface.co/spaces/Datamind23/AI_Research_Assis/resolve/main/agentic_rag/generation.py
- Command line
-
hf download hf://spaces/Datamind23/AI_Research_Assis/agentic_rag/generation.py
-
curl -L -o generation.py https://huggingface.co/spaces/Datamind23/AI_Research_Assis/resolve/main/agentic_rag/generation.py
869 Bytes
| from langchain_core.prompts import PromptTemplate | |
| from agentic_rag.llm_config import llm | |
| # Prompt template for generating the final answer from the retrieved document context | |
| generator_template = """You are an intelligent assistant that answers user queries based solely on the information provided in the given document context. | |
| Instructions: | |
| - Treat the input “{document}” as your sole context (it may be from internal docs or web search). | |
| - If the context answers the question, answer directly—do not mention where it came from. | |
| - If it still doesn’t, reply: “I’m sorry, I couldn’t find an answer.” | |
| - Do not include reasoning or explanation unless explicitly asked. | |
| --- | |
| Document Context: | |
| {document} | |
| User Query: | |
| {query} | |
| --- | |
| Answer: | |
| """ | |
| generator_prompt = PromptTemplate.from_template(generator_template) | |
| generator_chain = generator_prompt | llm |