SimpleChatTCRV:ToolCalls Cleanup

Update the external ai tool call description to indicate that it
doesnt have access to internet or tool calls.

Update the sys_date_time description and avoid the confusion caused
to some ai wrt the template string as to whether it is optional or
required and wasting reasoning time around it. Now simply state that
it is a reqd argument, and suggest the internal default template as
a useful one to use.

Update the msg returned by data store tool calls, to make them less
verbose (ie avoid duplicating key list or got key data) while also
more informative (ie num of keys, data length)

Update the readme.
This commit is contained in:
hanishkvc 2025-11-22 22:39:08 +05:30
parent fe0e118a6b
commit 631d9ceec5
4 changed files with 21 additions and 19 deletions

View File

@ -857,13 +857,15 @@ Cleanup in general
* Allow user to load multiple images and submit to ai as part of a single user message.
* Use popover ui to allow user to view larger versions of loaded images as well as remove before submitting
to ai, if and when needed.
* add external_ai toolcall, user can see the response being generated by the external ai tool call,
as it is getting generated and recieved.
* maintain chat session specific DivStream elements, so that in future, if the logic is updated to allow
switching in the middle of a pending tool call or pending ai server response, things dont mess up wrt
ui, as they will be updating their respective DivStream and switching sessions will also take care of
making the right DivStream the currently active one, so that end user can see the streamed response
as it is occuring.
* Add external_ai toolcall with no access to internet or tool calls (helps avoid recursive ai tool calling).
User can see response generated by the external ai tool call, as and when it is recieved.
* Maintain chat session specific DivStream elements, and show live ai responses (through corresponding
DivStream) wrt the current chat session as well as any from the external ai tool call session.
In future, if the logic is updated to allow switching chat session ui in the middle of a pending tool call
or pending ai server response, things wont mess up ui, as they will be updating their respective DivStream.
Also switching sessions takes care of showing the right DivStream ie of currently switched to chat, so that
end user can see the streamed response from that chat session as it is occuring.
* Cleanup the tool call descriptions and verbose messages returned a bit.
#### ToDo

View File

@ -15,7 +15,7 @@ let externalai_meta = {
"type": "function",
"function": {
"name": "external_ai",
"description": "Delegates a task to another AI instance using a custom system prompt and user message, that you as the caller define. Useful for tasks like summarization, structured data generation, or any custom AI workflow.",
"description": "Delegates a task to another AI instance using a custom system prompt and user message, that you as the caller define. Useful for tasks like summarization, structured data generation, or any custom AI workflow. This external ai doesnt have access to internet or tool calls",
"parameters": {
"type": "object",
"properties": {

View File

@ -17,7 +17,7 @@ let sysdatetime_meta = {
"type": "function",
"function": {
"name": "sys_date_time",
"description": "Returns the current system date and time. One can optionally pass template to control what and all parts of date and time are returned",
"description": "Returns the current system date and time. The template argument helps control which parts of date and time are returned",
"parameters": {
"type": "object",
"properties": {
@ -27,10 +27,10 @@ let sysdatetime_meta = {
It can be any combination of Y,m,d,H,M,S,w. Here
Y - FullYear 4 digits, m - Month 2 digits, d - Day 2 digits,
H - hour 2 digits 24 hours format, M - minutes 2 digits, S - seconds 2 digits,
w - day of week (0(sunday)..6(saturday))
any other char will be returned as is.
w - day of week (0(sunday)..6(saturday)).
Any other char will be returned as is.
If no template is given, it defaults to YmdTHMS.
YmdTHMS is a useful date time template, which includes all the key parts.
Remember that the template characters are case sensitive.
`
}

View File

@ -30,7 +30,7 @@ self.onmessage = async function (ev) {
cid: ev.data.cid,
tcid: ev.data.tcid,
name: ev.data.name,
data: { 'status': 'ok', 'data': reqList.result, 'msg': `DataStoreList:Ok:${reqList.result}`}
data: { 'status': 'ok', 'data': reqList.result, 'msg': `DataStoreList:Ok:NumOfKeys:${reqList.result.length}`}
});
}
reqList.onerror = (evList) => {
@ -52,7 +52,7 @@ self.onmessage = async function (ev) {
cid: ev.data.cid,
tcid: ev.data.tcid,
name: ev.data.name,
data: { 'status': 'ok', 'data': reqGet.result, 'msg': `DataStoreGet:Ok:${args['key']}:${reqGet.result}`}
data: { 'status': 'ok', 'data': reqGet.result, 'msg': `DataStoreGet:Ok:Key:${args['key']}:DataLen:${reqGet.result.length}`}
});
}
reqGet.onerror = (evGet) => {
@ -61,7 +61,7 @@ self.onmessage = async function (ev) {
cid: ev.data.cid,
tcid: ev.data.tcid,
name: ev.data.name,
data: { 'status': 'error', 'msg': `DataStoreGet:Err:${args['key']}:${reqGet.error}`}
data: { 'status': 'error', 'msg': `DataStoreGet:Err:Key:${args['key']}:${reqGet.error}`}
});
}
break;
@ -74,7 +74,7 @@ self.onmessage = async function (ev) {
cid: ev.data.cid,
tcid: ev.data.tcid,
name: ev.data.name,
data: { 'status': 'error', 'msg': `DataStoreSet:Err:${args['key']}:${reqSet.error}`}
data: { 'status': 'error', 'msg': `DataStoreSet:Err:Key:${args['key']}:${reqSet.error}`}
});
}
reqSet.onsuccess = (evSet) => {
@ -83,7 +83,7 @@ self.onmessage = async function (ev) {
cid: ev.data.cid,
tcid: ev.data.tcid,
name: ev.data.name,
data: { 'status': 'ok', 'msg': `DataStoreSet:Ok:${args['key']}:${reqSet.result}`}
data: { 'status': 'ok', 'msg': `DataStoreSet:Ok:Key:${args['key']}:SetKey:${reqSet.result}`}
});
}
break;
@ -96,7 +96,7 @@ self.onmessage = async function (ev) {
cid: ev.data.cid,
tcid: ev.data.tcid,
name: ev.data.name,
data: { 'status': 'ok', 'msg': `DataStoreDelete:Ok:${args['key']}:${reqDel.result}`}
data: { 'status': 'ok', 'msg': `DataStoreDelete:Ok:Key:${args['key']}:${reqDel.result}`}
});
}
reqDel.onerror = (evDel) => {
@ -105,7 +105,7 @@ self.onmessage = async function (ev) {
cid: ev.data.cid,
tcid: ev.data.tcid,
name: ev.data.name,
data: { 'status': 'error', 'msg': `DataStoreDelete:Err:${args['key']}:${reqDel.error}`}
data: { 'status': 'error', 'msg': `DataStoreDelete:Err:Key:${args['key']}:${reqDel.error}`}
});
}
break;