Skip to content

Support for tool/function calling #131

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

Conversation

FrankLi-MSFT
Copy link
Contributor

@FrankLi-MSFT FrankLi-MSFT commented Jun 20, 2025

This CL is from the proposal of #7 (comment). It places the declaration of tools into LanguageModelCreateCoreOptions dictionary so as to let the tools to be declared in the system prompt.


Preview | Diff

index.bs Outdated
@@ -75,6 +75,16 @@ interface LanguageModelParams {
readonly attribute float maxTemperature;
};

// A description of a funnction call that a language model can invoke.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// A description of a funnction call that a language model can invoke.
// A description of a tool call that a language model can invoke.

index.bs Outdated
// JSON schema for the input parameters.
required object inputSchema;
// The function to be invoked by user agent on behalf of language model.
required Function execute;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's define this to return a promise for a string, as it will make the bindings slightly nicer.

Define a callback type like

callback LanguageModelToolFunction = Promise<DOMString> (any... arguments);

and then use LanguageModelToolFunction instead of Function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@domenic - thank you for the review. Updated the CL.

@anssiko
Copy link
Member

anssiko commented Jun 23, 2025

@FrankLi-MSFT thanks for the contribution! Please join the Community Group to turn the IPR check green.

Frank Li (IE) and others added 2 commits June 23, 2025 12:31
Copy link
Collaborator

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Let me know when you've joined the Community Group, and we can merge.

@anssiko
Copy link
Member

anssiko commented Jun 24, 2025

@FrankLi-MSFT to make sure this lands smoothly, after joining the Community Group, check you've connected your GitHub nickname with your W3C account (via https://www.w3.org/account/ > Edit your account information > Connected accounts). If good, then hit revalidate in repo manager. That should trigger a new CI run that'll pass. 🤞

@FrankLi-MSFT
Copy link
Contributor Author

LGTM. Let me know when you've joined the Community Group, and we can merge.

@domenic, I think it is done. Can you merge it. Thanks!

@domenic domenic merged commit af717e8 into webmachinelearning:main Jun 25, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants