Skip to main content

Document QA

Build a question-and-answer chatbot with a document loaded from local memory.

Prerequisitesā€‹


Document QAā€‹


Create the Document QA projectā€‹

  1. From the Langflow dashboard, clickĀ New Project.
  2. SelectĀ Document QA.
  3. TheĀ Document QAĀ project is created.

This flow is composed of a standard chatbot with theĀ Chat Input,Ā Prompt,Ā OpenAI, andĀ Chat OutputĀ components, but it also incorporates a File component, which loads a file from your local machine. Parse Data is used to convert the data from File into theĀ PromptĀ component asĀ {Document}. TheĀ PromptĀ component is instructed to answer questions based on the contents ofĀ {Document}. This gives theĀ OpenAIĀ component context it would not otherwise have access to.

Run the Document QAā€‹

  1. To select a document to load, in theĀ FileĀ component, click theĀ PathĀ field. Select a local file, and then clickĀ Open. The file name appears in the field.

  1. Click theĀ PlaygroundĀ button. Here you can chat with the AI that has access to your document's content.

  2. Type in a question about the document content and press Enter. You should see a contextual response.

Hi, how can I help you?