[PR #2825] [MERGED] Fix tool calling with local providers #5753

Closed
opened 2026-10-22 04:19:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2825
Author: @Sulphuratum
Created: 6/23/2026
Status: ✅ Merged
Merged: 6/23/2026
Merged by: @SpicyMarinara

Base: staging ← Head: staging


📝 Commits (2)

  • 3f98e3b Fix tool calling with local providers
  • 8905f20 Fix Gemma tool delimiter normalization scope

📊 Changes

4 files changed (+87 additions, -11 deletions)

View changed files

📝 packages/server/src/services/llm/base-provider.ts (+7 -0)
📝 packages/server/src/services/llm/providers/local-sidecar.provider.ts (+13 -1)
📝 packages/server/src/services/llm/providers/openai.provider.ts (+11 -6)
📝 packages/server/src/services/llm/textual-tool-call-parser.ts (+56 -4)

📄 Description

CONVERTING TO DRAFT - Tool calling for everything but professor Mari seems to not know what to call yet, working on a fix hopefully

Linked issue

Closes #2824

Why this change

Fix tool calling behaviour for local providers

What changed

Add some parsing for different tool call syntax, as well as fix a bug with detecting the end of a tool call block

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Ran sidecar and called a tool
  • Ran local model with llama.cpp and called a tool (Gemma and Qwen just in case)

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

sidecar gemma:
image

local qwen:
image

local gemma26ba4b, tried something with multiple calls required:
image

Ah, and just in case with GLM 5 on nanogpt to make sure there are no regressions elsewhere:
image


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/2825 **Author:** [@Sulphuratum](https://github.com/Sulphuratum) **Created:** 6/23/2026 **Status:** ✅ Merged **Merged:** 6/23/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `staging` --- ### 📝 Commits (2) - [`3f98e3b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3f98e3bb8ca76a422fbc4ec3c1da9bf023a03387) Fix tool calling with local providers - [`8905f20`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8905f2091beb9393d77d11a07d42e19bb78835cf) Fix Gemma tool delimiter normalization scope ### 📊 Changes **4 files changed** (+87 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/services/llm/base-provider.ts` (+7 -0) 📝 `packages/server/src/services/llm/providers/local-sidecar.provider.ts` (+13 -1) 📝 `packages/server/src/services/llm/providers/openai.provider.ts` (+11 -6) 📝 `packages/server/src/services/llm/textual-tool-call-parser.ts` (+56 -4) </details> ### 📄 Description CONVERTING TO DRAFT - Tool calling for everything but professor Mari seems to not know what to call yet, working on a fix hopefully ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> Closes #2824 ## Why this change Fix tool calling behaviour for local providers ## What changed Add some parsing for different tool call syntax, as well as fix a bug with detecting the end of a tool call block ## Validation <!-- Required: include commands run and/or manual checks performed --> - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Ran sidecar and called a tool - Ran local model with llama.cpp and called a tool (Gemma and Qwen just in case) ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) sidecar gemma: <img width="510" height="401" alt="image" src="https://github.com/user-attachments/assets/14d46edb-6290-48a5-a22b-19573b9670d7" /> local qwen: <img width="517" height="421" alt="image" src="https://github.com/user-attachments/assets/db6f5eb8-a7ff-48eb-b673-e7dc4b6f3012" /> local gemma26ba4b, tried something with multiple calls required: <img width="772" height="605" alt="image" src="https://github.com/user-attachments/assets/7970e43f-48e5-4b14-a534-557a870c4e16" /> Ah, and just in case with GLM 5 on nanogpt to make sure there are no regressions elsewhere: <img width="779" height="627" alt="image" src="https://github.com/user-attachments/assets/713eb48c-51f0-4e0c-914b-3d418e7e52bb" /> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:19:13 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#5753
No description provided.