-
Notifications
You must be signed in to change notification settings - Fork 118
Open
Description
Describe the bug
When an LLM calls the web_search function (either perplexity or tavily) with a query that contains quotes, the variable doesn't expand properly and the resulting json is malformed. This is because argc/bash drops the backslashes in the query. When this malformed json is sent to the respective API, a 400 code is returned and the query fails.
To Reproduce
Link either the perplexity or tavily search tools and have your LLM of choice search a query with quotation marks. Claude Sonnet 4 seems to do this frequently.
Expected behavior
I expect the query to be successfully templated into json and dispatched.
Screenshots/Logs
This example uses the tavily web search function.
temp) search this query (enclosed in brackets) [test \"test\"] 0
I'll search for the query "test \"test\"" using web search.
Call web_search {"query":"test \"test\""}
curl: (22) The requested URL returned error: 400
temp) .info
model claude:claude-sonnet-4-20250514
temperature null
top_p null
use_tools web
max_output_tokens 8192 (current model)
save_session null
compress_threshold 4000
rag_reranker_model jina:jina-reranker-v2-base-multilingual
rag_top_k 5
dry_run false
function_calling true
stream true
save falseEnvironment
Linux asmara 6.12.44_1 #1 SMP PREEMPT_DYNAMIC Tue Sep 2 01:06:37 UTC 2025 x86_64 GNU/Linux
aichat 0.30.0
argc 1.22.0
jq-1.8.1
ls (GNU coreutils) 9.4
/usr/bin/bash GNU bash, version 5.3.0(1)-release (x86_64-unknown-linux-gnu)
/usr/bin/node v22.15.0
/usr/bin/python Python 3.13.7Metadata
Metadata
Assignees
Labels
No labels