Skip to content

fix: pass EXTRA_BODY through to LlamaCppLLM + detect GFM tables without leading/trailing pipes - #3400

Closed
handnewb wants to merge 1 commit into
vectorize-io:mainfrom
handnewb:fix/llamacpp-extra-body-and-markdown-table-collapse
Closed

fix: pass EXTRA_BODY through to LlamaCppLLM + detect GFM tables without leading/trailing pipes#3400
handnewb wants to merge 1 commit into
vectorize-io:mainfrom
handnewb:fix/llamacpp-extra-body-and-markdown-table-collapse

Conversation

@handnewb

Copy link
Copy Markdown
Contributor

Summary

Two independent fixes for issues discovered during contribution analysis.

Fix 1: llamacpp provider silently ignores HINDSIGHT_API_LLM_EXTRA_BODY (closes #3326)

The create_llm_provider() factory accepted extra_body but never passed it to LlamaCppLLM. Every other provider (Bedrock, Fireworks, OpenAI-compatible, LiteLLM, Gemini, Anthropic) receives extra_body — only llamacpp was missing.

Changes (2 files, +4 lines):

  • llm_wrapper.py: Pass extra_body=extra_body to LlamaCppLLM constructor
  • llamacpp_llm.py: Accept extra_body in init, store it, forward to OpenAICompatibleLLM delegate

Fix 2: Delta refresh collapses GFM tables without leading/trailing pipes (closes #3361)

The table parser required pipes at both start AND end of every row. GFM-compliant tables without outer pipes fell through to ParagraphBlock which joins lines with spaces, destroying table structure permanently.

Changes (1 file, +11 lines):

  • structured_doc.py: Lenient fallback — if chunk has a separator line AND every non-separator line contains |, treat as table

…nAICompatibleLLM delegate

Fixes vectorize-io#3326: The create_llm_provider() factory accepted extra_body but never
passed it to LlamaCppLLM, so HINDSIGHT_API_LLM_EXTRA_BODY was silently
ignored for the llamacpp provider while working for every other provider
(Bedrock, Fireworks, OpenAI-compatible, LiteLLM, etc.).

The fix threads extra_body from the factory → LlamaCppLLM.__init__ →
OpenAICompatibleLLM delegate, which already supports the parameter.

fix(structured-doc): detect markdown tables without leading/trailing pipes

Fixes vectorize-io#3361: The table parser required pipes at both start AND end of every
row (^\s*\|.*\|\s*$), so GFM-compliant tables like "Col1 | Col2\n--- | ---"
fell through to ParagraphBlock which joins all lines with spaces, permanently
destroying table structure during delta refresh.

The fix adds a lenient fallback: if a chunk contains a separator line AND every
non-separator line contains at least one pipe character, it is treated as a
table. This covers the common GFM shorthand without false-positiving on
non-table content.
@handnewb
handnewb force-pushed the fix/llamacpp-extra-body-and-markdown-table-collapse branch from 6276a88 to bbfc9f9 Compare August 11, 2026 21:28

@nicoloboschi nicoloboschi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

please make 2 separated prs

@handnewb

Copy link
Copy Markdown
Contributor Author

Split into two separate PRs as requested: #3431 (llamacpp EXTRA_BODY) and #3432 (GFM table parsing)

@handnewb handnewb closed this Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants