copilot: Add support for tool_calls for gpt-4.1, gpt-4o, o4-mini (#29369)

Github Copilot currently supports following models for agent mode with
tool calls. Currently we are only supporting anthropic models and not
openai and gemini. This PR add support for the openai models. I have
tested it and it works for all of them. For gemini models it seems there
is a issues from copilot side so not adding that in this PR as enabling
gemini model breaks it in the ask mode as well.

<img width="392" alt="image"
src="https://github.com/user-attachments/assets/fb7a4148-e48c-45c5-9ff9-c02f71217dfb"
/>


- [x] GPT-4.1

- [x] GPT-4.0

- [x] o4-mini

Release Notes:

- agent: Add tool calling support for gpt-4.1, gpt-4o, o4-mini when
using Copilot Chat as a provider

Signed-off-by: Umesh Yadav <umesh4257@gmail.com>
This commit is contained in:
Umesh Yadav 2025-05-05 17:29:12 +05:30 committed by GitHub
parent 7133699335
commit 251f26d48a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -188,7 +188,10 @@ impl LanguageModel for CopilotChatLanguageModel {
fn supports_tools(&self) -> bool { fn supports_tools(&self) -> bool {
match self.model { match self.model {
CopilotChatModel::Claude3_5Sonnet CopilotChatModel::Gpt4o
| CopilotChatModel::Gpt4_1
| CopilotChatModel::O4Mini
| CopilotChatModel::Claude3_5Sonnet
| CopilotChatModel::Claude3_7Sonnet | CopilotChatModel::Claude3_7Sonnet
| CopilotChatModel::Claude3_7SonnetThinking => true, | CopilotChatModel::Claude3_7SonnetThinking => true,
_ => false, _ => false,