Skip to content

Commit

Permalink
Adopt tool API changes (#6487)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexr00 authored Nov 18, 2024
1 parent 84b7387 commit 322b4e7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"version": "0.100.1",
"publisher": "GitHub",
"engines": {
"vscode": "^1.95.0"
"vscode": "^1.96.0"
},
"categories": [
"Other",
Expand Down Expand Up @@ -3164,7 +3164,7 @@
"modelDescription": "Get a GitHub issue/PR's details as a JSON object.",
"icon": "$(info)",
"canBeReferencedInPrompt": true,
"parametersSchema": {
"inputSchema": {
"type": "object",
"properties": {
"repo": {
Expand Down Expand Up @@ -3207,7 +3207,7 @@
"modelDescription": "Get a GitHub notification's details as a JSON object.",
"icon": "$(info)",
"canBeReferencedInPrompt": true,
"parametersSchema": {
"inputSchema": {
"type": "object",
"properties": {
"thread_id": {
Expand All @@ -3233,7 +3233,7 @@
"modelDescription": "Summarizes a GitHub issue or pull request. A summary is a great way to describe an issue or pull request.",
"icon": "$(info)",
"canBeReferencedInPrompt": true,
"parametersSchema": {
"inputSchema": {
"type": "object",
"properties": {
"title": {
Expand Down Expand Up @@ -3308,7 +3308,7 @@
"modelDescription": "Summarizes a GitHub notification. A summary is a great way to describe a notification.",
"icon": "$(info)",
"canBeReferencedInPrompt": true,
"parametersSchema": {
"inputSchema": {
"type": "object",
"properties": {
"lastReadAt": {
Expand Down Expand Up @@ -3420,7 +3420,7 @@
"modelDescription": "Summarize and suggest a fix for a GitHub issue.",
"icon": "$(info)",
"canBeReferencedInPrompt": true,
"parametersSchema": {
"inputSchema": {
"type": "object",
"properties": {
"repo": {
Expand Down Expand Up @@ -3467,7 +3467,7 @@
"modelDescription": "Converts natural language to a GitHub search query. Should ALWAYS be called before doing a search.",
"icon": "$(search)",
"canBeReferencedInPrompt": true,
"parametersSchema": {
"inputSchema": {
"type": "object",
"properties": {
"repo": {
Expand Down Expand Up @@ -3511,7 +3511,7 @@
"modelDescription": "Execute a GitHub search given a well formed GitHub search query. Call github-pull-request_formSearchQuery first to get good search syntax and pass the exact result in as the 'query'.",
"icon": "$(search)",
"canBeReferencedInPrompt": true,
"parametersSchema": {
"inputSchema": {
"type": "object",
"properties": {
"repo": {
Expand Down Expand Up @@ -3557,7 +3557,7 @@
"modelDescription": "Render issue items from an issue search in a markdown table. The markdown table will be displayed directly to the user by the tool. No further display should be done after this!",
"icon": "$(paintcan)",
"canBeReferencedInPrompt": false,
"parametersSchema": {
"inputSchema": {
"type": "object",
"properties": {
"arrayOfIssues": {
Expand Down
3 changes: 2 additions & 1 deletion src/lm/tools/fetchIssueTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ export class FetchIssueTool extends RepoToolBase<FetchIssueToolParameters> {
}
const { owner, name } = await this.getRepoInfo({ owner: options.input.repo?.owner, name: options.input.repo?.name });
const url = (owner && name) ? `https://github.com/${owner}/${name}/issues/${options.input.issueNumber}` : undefined;
const message = url ? new vscode.MarkdownString(vscode.l10n.t('Fetching item [#{0}]({1}) from GitHub', options.input.issueNumber, url)) : vscode.l10n.t('Fetching item #{0} from GitHub', options.input.issueNumber);
return {
invocationMessage: url ? vscode.l10n.t('Fetching item [#{0}]({1}) from GitHub', options.input.issueNumber, url) : vscode.l10n.t('Fetching item #{0} from GitHub', options.input.issueNumber),
invocationMessage: message,
};
}
}
5 changes: 4 additions & 1 deletion src/lm/tools/searchTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,12 @@ export class SearchTool extends RepoToolBase<SearchToolParameters> {

async prepareInvocation(options: vscode.LanguageModelToolInvocationPrepareOptions<SearchToolParameters>): Promise<vscode.PreparedToolInvocation> {
const parameterQuery = options.input.query;
const message = new vscode.MarkdownString();
message.appendText(vscode.l10n.t('Searching for issues with "{0}".', parameterQuery));
message.appendMarkdown(vscode.l10n.t('[Open on GitHub.com]({0})', escapeMarkdown(this.toGitHubUrl(parameterQuery))));

return {
invocationMessage: vscode.l10n.t('Searching for issues with "{0}". [Open on GitHub.com]({1})', escapeMarkdown(parameterQuery), escapeMarkdown(this.toGitHubUrl(parameterQuery)))
invocationMessage: message
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/lm/tools/summarizeNotificationsTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class NotificationSummarizationTool implements vscode.LanguageModelTool<F
const type = parameters.itemType === 'issue' ? 'issues' : 'pull';
const url = `https://github.com/${parameters.owner}/${parameters.repo}/${type}/${parameters.itemNumber}`;
return {
invocationMessage: vscode.l10n.t('Summarizing item [#{0}]({1})', parameters.itemNumber, url)
invocationMessage: new vscode.MarkdownString(vscode.l10n.t('Summarizing item [#{0}]({1})', parameters.itemNumber, url))
};
}

Expand Down

0 comments on commit 322b4e7

Please sign in to comment.