Skip to content
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
0a77a9d
feat: implement documents embed CLI command
priyankeshh Aug 24, 2025
400b067
demo: add comprehensive demonstration of embed command functionality
priyankeshh Aug 24, 2025
93c7d02
refactor: organize test files and create integration testing suite
priyankeshh Aug 24, 2025
2f63419
docs: add comprehensive testing documentation and instructions
priyankeshh Aug 24, 2025
b5b1d33
test: complete end-to-end validation of embed functionality with real…
priyankeshh Aug 24, 2025
b06f6df
feat: implement configurable embedding system with random vectors
priyankeshh Aug 24, 2025
8fc7d08
feat: enhance embedding functionality and improve document processing
JonnyTran Aug 24, 2025
b1ffa82
Apply ruff formatting
priyankeshh Aug 27, 2025
95dd534
Add PyMuPDF integration with document metadata in extralit-server
priyankeshh Aug 27, 2025
dcf53e0
fix: address review feedback - proper dataset creation, remove test f…
priyankeshh Aug 27, 2025
8138efd
refactor: minimize code and remove llama-index dependency
priyankeshh Aug 29, 2025
7a765d2
style: apply pre-commit formatting
priyankeshh Aug 29, 2025
d875219
fix: simplify RQ job to use HF space service for margin lookup
priyankeshh Aug 29, 2025
eb415ee
fix: remove redundant PyMuPDF job definition from extralit-server
priyankeshh Sep 1, 2025
1b39f1f
fix: simplify table context to follow existing workflow patterns
priyankeshh Sep 1, 2025
7321381
fix: fetch analysis metadata from document for table extraction
priyankeshh Sep 1, 2025
fd1b9e9
Merge branch 'develop' into feat/document-embedding-cli
priyankeshh Sep 1, 2025
9faff49
chore: remove redundant ocr/tables.py (functionality already in workf…
priyankeshh Sep 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,5 @@ extralit/site
**/*.db
**/*.pdf
.claude/
output/
output/

58 changes: 58 additions & 0 deletions extralit-server/src/extralit_server/contexts/ocr/tables.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be deleted since it's just calling extralit_ocr.jobs.pymupdf_to_markdown_job, which is already called in the workflows/documents.py file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@priyankeshh Please also address this comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @JonnyTran ,

I've completed the 2 tasks you assigned this week:
However, I'm running into issues with the embed CLI testing flow and could use your guidance:
Problem: Unable to run the embed CLI command successfully to test the full workflow (markdown-processed PDF → segments/chunks → Dataset records → annotation interface → similarity search)

Command I'm trying:

extralit documents add --workspace priyankesh-test --reference paper-001 --file .\document.md

Error encountered:

Error adding document: Server disconnected without sending a response.

What I've tried following your environment advice:

  • Installed and configured micromamba (as you recommended for single environment across repos)
  • Tried with fresh venv setup
  • Tested in GitHub Codespace environment

Current blocker: The server connection issue is preventing me from testing the complete flow: embed CLI → create records → annotation interface → Extralit SDK similarity search.

Could you help me troubleshoot this server connectivity issue? I want to ensure the development environment and server setup are correct before proceeding with the full workflow testing.

Thanks!

@JonnyTran JonnyTran Sep 6, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @priyankeshh,

I think the extralit documents add command is not working and it's not the preferred way to add documents. It only support PDF files upload and not .md files anyways. (I just made a PR #152 to fix it)

The preferred way is the bulk upload documents on the web interface or the extralit documents import CLI function where you provide the bib file and a directory to the PDF files. I sent some example files to you awhile ago on Slack.

You can test if the CLI cmds like extralit documents list -w priyankesh-test works to check connection to the server, and if not connected, use extralit login --api-url first.

Let me know if you have other issues setting up the server

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @priyankeshh, I just fixed the extralit documents add CLI function in this commit. Upon upload it will run the document workflows so it'll be easy to test it this way

Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,61 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Table processing context for PDF documents using existing PyMuPDF workflow.
"""

import logging
from uuid import UUID

from sqlalchemy.ext.asyncio import AsyncSession

from extralit_server.jobs.queues import OCR_QUEUE
from extralit_server.models.database import Document

_LOGGER = logging.getLogger(__name__)


async def prepare_table_extraction_job(
db: AsyncSession, document_id: UUID, s3_url: str, filename: str, workspace_name: str, workflow_id: str
) -> dict:
"""
Prepare table extraction job data using existing PyMuPDF workflow.

Fetches margins from stored document metadata (from analysis_and_preprocess_job)
and passes them to the existing pymupdf_to_markdown_job in extralit-hf-space.

Args:
db: Database session
document_id: UUID of document to process
s3_url: S3 URL of the PDF file
filename: Original filename
workspace_name: Workspace name
workflow_id: Workflow ID for tracking

Returns:
Job data prepared for OCR queue
"""
# Fetch stored analysis metadata from document
document = await db.get(Document, document_id)
analysis_metadata = {}

if document and document.metadata_:
# Extract analysis metadata that contains margin analysis
stored_metadata = document.metadata_
analysis_metadata = stored_metadata.get("analysis_metadata", {})
_LOGGER.info(f"Retrieved analysis metadata for document {document_id} with margin data")
else:
_LOGGER.warning(f"No stored analysis metadata found for document {document_id}")

return OCR_QUEUE.prepare_data(
"extralit_ocr.jobs.pymupdf_to_markdown_job",
(document_id, s3_url, filename, analysis_metadata, workspace_name),
timeout=900,
job_id=f"table_extraction_{document_id}",
meta={
"document_id": str(document_id),
"workflow_step": "table_extraction",
"workflow_id": workflow_id,
},
)
2 changes: 2 additions & 0 deletions extralit/src/extralit/cli/documents/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from extralit.cli.documents.add import add_document
from extralit.cli.documents.delete import delete_document
from extralit.cli.documents.embed import embed_documents
from extralit.cli.documents.import_bib import import_bib
from extralit.cli.documents.import_history import list_import_histories
from extralit.cli.documents.list import list_documents
Expand All @@ -28,6 +29,7 @@
app.command(name="add")(add_document)
app.command(name="import")(import_bib)
app.command(name="delete")(delete_document)
app.command(name="embed")(embed_documents)

# Import history commands - new structure
app.command(name="history")(list_import_histories)
Expand Down
Loading
Loading