RAG Agent uses Claude-2.1 LLM model with CoT prompting for enhanced reasoning and performance

Overview
No input available.

Notes

RAG Agent

This RAG Agent uses  Claude 2.1 LLM model with CoT prompting, optimizing dynamic reasoning and action planning.

Chain of Thought (CoT)

What is CoT?

Chain-of-thought prompting is a prompt engineering technique to make LLMs answer complex questions or follow elaborate instructions by first generating a sequence of intermediate reasoning steps in natural language. You can combine it with few-shot prompting to get better results on more complex tasks that require reasoning before responding.

How it Works?

The main idea of CoT is that by showing the LLM some few shot exemplars where the reasoning process is explained in the exemplars, the LLM will also show the reasoning process when answering the prompt. This explanation of reasoning often leads to more accurate results.

How to Use this RAG Agent? 

Using Clarifai SDK

Export your PAT as an environment variable. Then, import and initialize the API Client.

Find your PAT in your security settings.

export CLARIFAI_PAT={your personal access token}

Upload your Data 

Upload you data in the Clarifai App to chat with RAG Agent.

from clarifai.rag import RAG

rag_agent = RAG.setup(
app_url= "https://clarifai.com/clarifai/rag-template",)
rag_agent.upload(folder_path = "/app/files", chunk_size= 512, chunk_overlap= 50)

folder_path  Folder path to the documents.

chunk_size: Chunk size for splitting the document.

chunk_overlap: The token overlap of each chunk when splitting.

Chat with the your Data  using RAG Agent

from clarifai.rag import RAG

rag_agent = RAG(workflow_url='https://clarifai.com/clarifai/rag-template/workflows/rag-agent-claude2-1-CoT-few-shot')
rag_agent.chat(messages=[{"role":"human", "content":"What is Clarifai"}])

Using Workflow

To utilize RAG Agents, you can input a query through the Blue Plus Try your own Input button. This incorporates all the documents in the Inputs as external data in RAG.

  • Workflow ID
    rag-agent-claude2-1-CoT-few-shot
  • Description
    RAG Agent uses Claude-2.1 LLM model with CoT prompting for enhanced reasoning and performance
  • Last Updated
    Mar 20, 2024
  • Privacy
    PUBLIC
  • Share