githubEdit

Quick Start: Knowledge Table

1. Introduction

This guide demonstrates how to use JamAI Base TypeScript SDK to upload and embed files into Knowledge Tables for AI-powered document processing and retrieval.

What are Knowledge Tables?

Knowledge Tables are specialized tables in JamAI Base that provide hybrid-search capabilities through both full-text search (FTS) and vector embeddings:

  • Search Capabilities:

    • Full-Text Search (FTS): Traditional keyword-based search for exact and partial matches

    • Semantic Search: Vector embedding-based search for meaning and context

  • Document Processing:

    • Automatically chunks documents into manageable segments

    • Generates vector embeddings for semantic understanding

    • Indexes content for full-text search

    • Preserves document structure (tables, layouts, etc) and metadata

  • Use Cases:

    • Document retrieval using both keywords and semantic meaning

    • Question-answering agent

    • Content recommendation

    • Knowledge base search and discovery

Supported File Types

The following file formats are supported:

  • Text files: .txt, .md, .csv, .tsv

  • Documents: .doc, .docx, .pdf

  • Presentations: .ppt, .pptx

  • Spreadsheets: .xls, .xlsx

  • Markup/Data: .xml, .html, .json, .jsonl

Prerequisites

Before starting, you'll need:

  • Node.js 16.x or higher

  • Project ID and Personal Access Token (PAT)

  • Documents to process

2. Installation and Setup

Installing Required Packages

Basic Configuration

3. Creating Your Knowledge Table

1

Create a new table

Navigate to your JamAI Base knowledge tables tab and create a new knowledge table.

2

Note table ID

After creating the table, note down the table ID for later use.

4. Implementation

4.1 Complete Document Uploader Class

5. Complete Standalone Script

Save this as knowledge_uploader.ts:

6. Usage Examples

6.1 Single File Upload

6.2 Batch Folder Upload

6.3 Custom Chunk Settings

7. Best Practices

7.1 Chunking Strategy

Recommended Settings by Document Type:

Document Type
Chunk Size
Overlap
Reasoning

PDFs

1500

300

Preserves paragraph context

Text Files

1000

200

Balanced for general text

Spreadsheets

800

150

Smaller for structured data

JSON/JSONL

800

150

Maintains object boundaries

7.2 Error Handling

7.3 Batch Processing with Rate Limiting

8. Running the Script

Using Environment Variables

  1. Create .env file:

  2. Run the script:

Using Command Line (modify script to accept args)

9. Troubleshooting

Common Issues

  1. File not found error

    • Verify file path is correct

    • Use absolute paths for reliability

  2. Unsupported file format

    • Check file extension against supported types

    • Verify file is not corrupted

  3. Upload timeout

    • Check internet connection

    • For large files, consider increasing timeout settings

    • Verify file size is reasonable

  4. Chunk size errors

    • Ensure chunk size > chunk overlap

    • Try default settings first

    • Adjust based on document structure

10. Next Steps

1

Query Your Knowledge Base

  • Use hybrid search to find relevant documents.

  • Combine with Action Tables for RAG applications.

2

Create RAG Applications

  • Link Knowledge Tables to Action Tables.

  • Build question-answering systems.

  • Develop intelligent document assistants.

3

Monitor and Optimize

  • Review search quality.

  • Adjust chunk settings if needed.

  • Add more documents to improve coverage.

Was this helpful?