grep pattern\nThis will find all plain files that match a given pattern, then sort the listically and filter it for only the matches.\n\nAnswer: `find` is pretty with its search. The should work as well:\n\n\\begin{code}\nls -l $(find . -mtime +28)\n\\end{code}\n\n(It\'s a bad idea to parse output from `ls`, though, as you may'from langchain.chains.question_answering import load_qa_chain# Prompttemplate = """Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer. Use three sentences maximum and keep the answer as concise as possible. {context}Question: {question}Helpful Answer:"""QA_CHAIN_PROMPT = PromptTemplate(    input_variables=["context", "question"],    template=template,)We can also use the LangChain Prompt Hub to store and fetch prompts.This will work with your LangSmith API key.Let's try with a default RAG prompt, here.from langchain import hubQA_CHAIN_PROMPT = hub.pull("rlm/rag-prompt-default")# Docsquestion = "How can I initialize a ReAct agent?"docs = retriever.get_relevant_documents(question)# Chainchain = load_qa_chain(llm, chain_type="stuff", prompt=QA_CHAIN_PROMPT)# Runchain({"input_documents": docs, "question": question}, return_only_outputs=True)    Llama.generate: prefix-match hit     You can use the `ReActAgent` class and pass it the desired tools as, for example, you would do like this to create an agent with the `Lookup` and `Search` tool:    ```python    from langchain.agents.react import ReActAgent    from langchain.tools.lookup import Lookup    from langchain.tools.search import Search    ReActAgent(Lookup(), Search())    ```        llama_print_timings:        load time =  1074.43 ms    llama_print_timings:      sample time =    65.46 ms /    94 runs   (    0.70 ms per token,  1435.95 tokens per second)    llama_print_timings: prompt eval time = 15975.57 ms /  1408 tokens (   11.35 ms per token,    88.13 tokens per second)
Open In Collab
Open In Collab ->: grep pattern\nThis will find all plain files that match a given pattern, then sort the listically and filter it for only the matches.\n\nAnswer: `find` is pretty with its search. The should work as well:\n\n\\begin{code}\nls -l $(find . -mtime +28)\n\\end{code}\n\n(It\'s a bad idea to parse output from `ls`, though, as you may'from langchain.chains.question_answering import load_qa_chain# Prompttemplate = """Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer. Use three sentences maximum and keep the answer as concise as possible. {context}Question: {question}Helpful Answer:"""QA_CHAIN_PROMPT = PromptTemplate(    input_variables=["context", "question"],    template=template,)We can also use the LangChain Prompt Hub to store and fetch prompts.This will work with your LangSmith API key.Let's try with a default RAG prompt, here.from langchain import hubQA_CHAIN_PROMPT = hub.pull("rlm/rag-prompt-default")# Docsquestion = "How can I initialize a ReAct agent?"docs = retriever.get_relevant_documents(question)# Chainchain = load_qa_chain(llm, chain_type="stuff", prompt=QA_CHAIN_PROMPT)# Runchain({"input_documents": docs, "question": question}, return_only_outputs=True)    Llama.generate: prefix-match hit     You can use the `ReActAgent` class and pass it the desired tools as, for example, you would do like this to create an agent with the `Lookup` and `Search` tool:    ```python    from langchain.agents.react import ReActAgent    from langchain.tools.lookup import Lookup    from langchain.tools.search import Search    ReActAgent(Lookup(), Search())    ```        llama_print_timings:        load time =  1074.43 ms    llama_print_timings:      sample time =    65.46 ms /    94 runs   (    0.70 ms per token,  1435.95 tokens per second)    llama_print_timings: prompt eval time = 15975.57 ms /  1408 tokens (   11.35 ms per token,    88.13 tokens per second)