Working With Documents and Knowledge Sources in Lega


This guide explains how to upload documents, manage them, and use Enhanced Knowledge Sources with RAG. It reflects the latest platform capabilities.


Supported File Types

Lega supports:

  • PDF (.pdf)
  • Word (.docx)
  • Excel (.xlsx)
  • Powerpoint (.pptx)
  • Text (.txt)
  • CSV (.csv)
  • JSON (.json)

You can work with up to 10 documents at a time. The combined content must fit within the model’s context window. If you exceed the limit, Lega will warn you.


Document Manager

The Document Manager is your central hub for all documents you can access across Lega. It includes:

  • Your uploaded documents
  • Documents shared with you
  • Knowledge sources you have permission to view

Inside the Document Manager you can:

  • Upload, delete, and download documents
  • View details such as upload date, file size, and type
  • Search, filter, and sort
  • Select documents for prompts
  • Use documents inside knowledge sources for RAG

Any document you upload from your computer is added to the Document Manager and remains available for reuse.


Uploading Documents

You can upload or attach documents in three ways: inside an app, using parameters, or through knowledge sources.

1. Uploading Within an App

If an app supports document uploads, you will see a plus icon in the prompt box.

Selecting the icon gives you two options:

a. Select From Document Manager

Pick up to ten documents from:

  • My Documents
  • Shared repositories
  • Knowledge sources you can access

Check the files you want, click Select, and they appear in your prompt.

b. Upload From Your Computer

Upload up to three documents directly. They will be stored in the Document Manager for future use.


2. Using Prompt Parameters

You can attach documents through prompt parameters. Create a parameter such as {{contract}}       and set the parameter type to Document.

This works in:

  • Apps
  • Sandbox
  • Prompt Library

Parameters make prompts reusable and let you standardize document inputs.


3. Using Knowledge Sources (RAG)

Apps on Lega can draw on document libraries — collections of uploaded files that the AI searches when answering questions. Enhanced Knowledge Sources with RAG let the model search inside your documents instead of loading them directly into the chat’s context window. This feature gives admins and creators more control over how that search works, so you can tune it for your specific document collection and get more accurate results.

Where to Find It

Open a Knowledge Source in the Resource Library, click Edit, and look for Processing Settings     and Retrieval Settings    .

How RAG Works

  • The documents in a knowledge source are indexed securely.
  • When the model answers, it retrieves only the relevant sections.
  • This gives you grounded responses without consuming the full context window.
  • You also get citations pointing to the documents used.

RAG is enabled automatically when you assign a knowledge source to an app.

Limits and Capabilities

  • Up to 50 documents per knowledge source
  • Secure Azure-based indexing included in your Lega subscription
  • Knowledge sources can be permissioned to specific users or groups

Documents inside a knowledge source can also be selected manually or used with document parameters.

Settings

  • Chunk size (Processing Settings): Controls how finely documents are broken up before indexing. Smaller chunks improve precision for specific lookups; larger chunks preserve more context for open-ended questions.
  • Results count (Retrieval Settings): How many document sections are pulled back per query. Increase this if responses seem to be missing relevant content.
  • Relevance threshold (Retrieval Settings): How closely a section must match before it is included. Raise this to reduce noise in responses; lower it if too little content is being returned.

Tips

  • After changing chunking settings, you should re-index to ensure all changes are saved properly.
  • Test your settings with a few representative questions before rolling them out to users.
  • Default settings work well for most document libraries. Only adjust if you are seeing gaps or irrelevant results in AI responses.

Note: Advanced Knowledge Search Configuration is available on request via feature flag. Contact your Customer Success Manager to enable it or raise a support ticket.

4. Ad-hoc Knowledge Sources

Ad-hoc Knowledge Sources let you bring your own documents into a conversation without any setup in advance. Create a named document library directly from the chat, add your files, and the AI will draw on them straight away. Once created, the knowledge source is saved and available to reuse in future conversations.

Before You Begin

This feature must be enabled by an admin or the creator of the app you are using. In the Chat App settings, go to General Settings and turn on Allow Users to Add Knowledge Sources. Once enabled, the option will appear in the chat for all users of that app.

How to Create an Ad-hoc Knowledge Source

  1. Open a conversation in a Chat App where this feature has been enabled.
  2. Click the + button at the bottom of the chat input.
  3. Select Create Ad-hoc Knowledge Source from the menu.
    1. In the modal that appears, add your documents using one of these options:
    2. Drag and drop files directly onto the modal window.
  4. Click Add Files, then choose Select from document manager to use files already in Lega, or Upload from your computer to add new files.
  5. When you are done adding files, click Close.

The knowledge source is now active in your conversation. The AI will draw on your uploaded documents when generating responses.

Reusing Your Knowledge Source

Your ad-hoc knowledge source is saved as a standard knowledge source once created. You can find it and reuse it in future conversations from My Resources → Knowledge

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us