Configuring a local documents workspace for LLM prompts

ClaimMaster LLM patent drafting tools can use a local database of documents to perform Retrieval Augmented Generation (RAG) when generating text.  Specifically, RAG is the process of retrieving relevant contextual information from a database of document snippets and passing that information to the LLM alongside the user’s prompt. This information is used to improve the LLM’s generated output by augmenting the model’s base knowledge. 


The RAG architecture in ClaimMaster uses semantic searching to find contextually relevant data based on the conceptual similarity of the input prompt. Semantic searches go beyond standard keyword searches, which rely on the occurrence of specific index words in the search input.  Instead, semantic searches convert search queries to their mathematical vector format (i.e., called vector embeddings) and use those vectors to search the vector database for the closest conceptual matches.  As a result, when you send a prompt to LLM, ClaimMaster will first query its local vector database that contains your workspaces to find the most similar text snippets for your prompt and will then add those snippets to the final prompt of the configured LLM source to improve its output results. 


Basic ClaimMaster RAG workflow 


The use of RAG is very useful for GenAI-enhanced patent drafting, as it allows you to pass specific document sections from previous applications (e.g., Background, claims, etc.) to the LLM to get better output results from the model. For example, if you are drafting a patent application for a specific client in semiconductor industry, the default LLM is able to draft text using its base knowledge of semiconductors, but it might not know enough about the client's niche area and it also doesn't have access to the examples or specific term definitions used in the previous applications for the same client. With RAG, you can get much better results by setting up a document workspace that includes sections of your client's previous applications, enabling the LLM to use that context to generate more relevant output for this client. When you use the document workspaces feature with ClaimMaster, RAG is being performed automatically for each prompt that is configured to use that document workspace.



To edit GPT prompt templates, perform the following steps inside the Patent Drafting Preferences window:



  1. Switch Template Type to "Document Workspace" option:

       


  1. Select one of the configured document workspace templates and then click on the Edit button in the lower right corner of the preferences window  (if you don't have any such templates configured or need to make a copy, create a new one using the Add or Duplicate buttons shown above):


       

  1. Edit the selected document workspace settings, then click on Accept Edits to save:



The following options are available from the General Settings window:

    1. Specifies the name of the workspace.
    2. Specifies the LLM source for generating embeddings (i.e., vectors) for the text snippets in the vector database and also of the user's prompts. The source could be OpenAI, Azure OpenAI, or Ollama. The same source should be used for filling out the database and prompts, as different models produce different embeddings.  
    3. Specifies the LLM model for generating embeddings (i.e., vectors) for the text snippets in the vector database and also of the user's prompts. The same model should be used for filling out the database and prompts, as different LLMs produce different embeddings.
    4. If this checkbox is selected, when a new document is added to the workspace, ClaimMaster will generate new embeddings for all sections of this document, even if they already appear in the database. 
    5. Click this button to add new items to the workspace.  You can add text from a single Word file, an entire directory of Word files, or text from the currently open Word document.
    6. Click this button to remove the file from the workspace list.  Doing so does not automatically remove the contents of the file from the database.
    7. This table shows the list of all files configured for a particular workspace.
    8. Click this button to reload the contents of all files selected in table above (item 7) into the document workspace.  This operation may take some time.  It opens each selected file, generates a set of embeddings for that file using the specified source, and then stores these vector embeddings in the vector database.  As part of generating embeddings, ClaimMaster will also identify specific document sections of each document, making it easier to retrieve these sections when performing RAG for LLM prompts. 
    9. Pressing this button will remove the contents of the selected files from the vector database.
    10. Switch to this tab to view the current contents of the configured workspace in the database.  You can press on the "View stored workspace snippets" button to see the contents of the workspace, including the source of each text snippet.