-
Notifications
You must be signed in to change notification settings - Fork 8
Better format tool calls that need approval #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jtpio, it works well on my side.
I just have a comment, mostly about consistency.
src/chat-model.ts
Outdated
* @param input The tool input to format (object or string) | ||
* @returns Pretty-printed JSON string | ||
*/ | ||
private _formatToolInput(input: string | object): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, let's try to clean that up in this PR too 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jtpio, if this is ready, it looks good to me.
} | ||
} | ||
// If it's an object, stringify it with formatting | ||
return JSON.stringify(input, null, 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that it is serializable, or should we try/except it ?
We use this function to format, for example, RunToolApprovalItem.rawItem
, which contains at least one any
type, according to the documentation.
Improve the formatting of tool calls.
Single tool call
Multiple tool calls