Skip to content

Commit 3b61b03

Browse files
committed
SimpleChatTC:FetchPdfAsText: Renamed function call
Some ai's dont seem to be prefering to use this direct helper provided for fetching pdf as text, on its own. Instead ai (gptoss) seems to be keen on fetching raw pdf and extract text etal, so now renaming the function call to try and make its semantic more readily obivious hopefully. It sometimes (not always) seem to assum fetch_web_url_text, can convert pdf to text and return it. Maybe I need to place the specific fetch pdf as text before the generic fetch web url text and so... With the rename, the pdf specific fetch seems to be getting used more.
1 parent 685c6ea commit 3b61b03

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

tools/server/public_simplechat/readme.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ Either way always remember to cross check the tool requests and generated respon
458458
* search_web_text - search for the specified words using the configured search engine and return the
459459
plain textual content from the search result page.
460460

461-
* pdf_to_text - fetch/read specified pdf file and extract its textual content
461+
* fetch_pdf_as_text - fetch/read specified pdf file and extract its textual content
462462
* this depends on the pypdf python based open source library
463463

464464
the above set of web related tool calls work by handshaking with a bundled simple local web proxy
@@ -626,6 +626,8 @@ sliding window based drop off or even before they kick in, this can help in many
626626

627627
* UI - add ClearChat button and logic. Also add unicode icons for same as well as for Settings.
628628

629+
* renamed pdf_to_text to fetch_pdf_as_text so that ai model can understand the semantic better.
630+
629631

630632
#### ToDo
631633

tools/server/public_simplechat/toolweb.mjs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -280,21 +280,21 @@ async function searchwebtext_setup(tcs) {
280280

281281

282282
//
283-
// PdfText
283+
// FetchPdfText
284284
//
285285

286286

287-
let pdftext_meta = {
287+
let fetchpdftext_meta = {
288288
"type": "function",
289289
"function": {
290-
"name": "pdf_to_text",
291-
"description": "Read pdf from requested local file path / web url through a proxy server and return its text content after converting pdf to text, in few seconds. One is allowed to get a part of the pdf by specifying the starting and ending page numbers",
290+
"name": "fetch_pdf_as_text",
291+
"description": "Fetch pdf from requested local file path / web url through a proxy server and return its text content after converting pdf to text, in few seconds. One is allowed to get a part of the pdf by specifying the starting and ending page numbers",
292292
"parameters": {
293293
"type": "object",
294294
"properties": {
295295
"url":{
296296
"type":"string",
297-
"description":"local file path (file://) / web (http/https) based url of the pdf that will be got and inturn converted to text to an extent"
297+
"description":"local file path (file://) / web (http/https) based url of the pdf that will be got and inturn converted to text"
298298
},
299299
"startPageNumber":{
300300
"type":"integer",
@@ -312,7 +312,7 @@ let pdftext_meta = {
312312

313313

314314
/**
315-
* Implementation of the pdf to text logic.
315+
* Implementation of the fetch pdf as text logic.
316316
* Expects a simple minded proxy server to be running locally
317317
* * listening on a configured port
318318
* * expecting http requests
@@ -325,20 +325,20 @@ let pdftext_meta = {
325325
* @param {string} toolname
326326
* @param {any} obj
327327
*/
328-
function pdftext_run(chatid, toolcallid, toolname, obj) {
328+
function fetchpdftext_run(chatid, toolcallid, toolname, obj) {
329329
return proxyserver_get_anyargs(chatid, toolcallid, toolname, obj, 'pdftext');
330330
}
331331

332332

333333
/**
334-
* Setup pdftext for tool calling
334+
* Setup fetchpdftext for tool calling
335335
* NOTE: Currently the logic is setup for the bundled simpleproxy.py
336336
* @param {Object<string, Object<string, any>>} tcs
337337
*/
338-
async function pdftext_setup(tcs) {
339-
return proxyserver_tc_setup('PdfText', 'pdftext', 'pdf_to_text', {
340-
"handler": pdftext_run,
341-
"meta": pdftext_meta,
338+
async function fetchpdftext_setup(tcs) {
339+
return proxyserver_tc_setup('FetchPdfAsText', 'pdftext', 'fetch_pdf_as_text', {
340+
"handler": fetchpdftext_run,
341+
"meta": fetchpdftext_meta,
342342
"result": ""
343343
}, tcs);
344344
}
@@ -359,6 +359,6 @@ export async function init(toolsWorker) {
359359
await fetchweburlraw_setup(tc_switch)
360360
await fetchweburltext_setup(tc_switch)
361361
await searchwebtext_setup(tc_switch)
362-
await pdftext_setup(tc_switch)
362+
await fetchpdftext_setup(tc_switch)
363363
return tc_switch
364364
}

0 commit comments

Comments
 (0)