Skip to content

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

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

Merged
merged 4 commits into from
May 5, 2025

Conversation

imumesh18
Copy link
Contributor

@imumesh18 imumesh18 commented Apr 24, 2025

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.

image
  • GPT-4.1

  • GPT-4.0

  • o4-mini

Release Notes:

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

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Apr 24, 2025
@imumesh18 imumesh18 changed the title copilot: Add support for tool_calls for gpt-4.1, gpt-4o, o4-mini and gemini-2.5-pro copilot: Add support for tool_calls for gpt-4.1, gpt-4o, o4-mini Apr 24, 2025
@imumesh18 imumesh18 force-pushed the copilot-agent-models branch from 269d04a to 94331de Compare April 24, 2025 19:45
@imumesh18 imumesh18 marked this pull request as ready for review April 24, 2025 19:46
@imumesh18
Copy link
Contributor Author

@notpeter can you please review this and help merge it?

@imumesh18
Copy link
Contributor Author

Hey @bennetbo, can you please review this and help me get it merged?

Signed-off-by: Umesh Yadav <umesh4257@gmail.com>
@imumesh18 imumesh18 force-pushed the copilot-agent-models branch from 94331de to 2997e55 Compare April 29, 2025 11:04
@lj3954
Copy link
Contributor

lj3954 commented Apr 29, 2025

I've confirmed this and implemented it in #29027. I tried changing the tool schema to the same one the Google provider does for models of that vendor, but to no avail. Not certain exactly what would need to be done to fix those. o3-mini also should be a model which supports tools, at least according to the API's data.

@lj3954
Copy link
Contributor

lj3954 commented Apr 29, 2025

Nevermind, the issue with Google models I had the other day was the same one you found in VSCode; it appears to be resolved now on the server side. #29027 will now enable tool calling support for all Copilot models of all vendors.

@KorigamiK
Copy link
Contributor

Is there a reason why more models which support tool calling are not added here? I should mention #29855

@lj3954
Copy link
Contributor

lj3954 commented May 4, 2025

Is there a reason why more models which support tool calling are not added here? I should mention #29855

This PR is aimed at enabling tools for the models that Microsoft VSCode lists in its Copilot agent mode, with the exception of Google's models, which require a different tool schema. #29027 proposes changes which will enable tools for Google models, as well as all current and future models which support tools.

These only pertain to the Copilot model provider. Other providers are being worked on elsewhere. For instance, #29563 proposes adding tool support for ollama models which support them. These implementations take effort; they're (generally) not one line changes or match case additions like you see in this specific PR.

@bennetbo bennetbo merged commit 251f26d into zed-industries:main May 5, 2025
20 checks passed
JosephTLyons pushed a commit that referenced this pull request May 5, 2025
)

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>
@imumesh18 imumesh18 deleted the copilot-agent-models branch May 5, 2025 13:25
bennetbo added a commit that referenced this pull request May 12, 2025
I noticed the discussion in #28881, and had thought of exactly the same
a few days prior.

This implementation should preserve existing functionality fairly well.

I've added a dependency (serde_with) to allow the deserializer to skip
models which cannot be deserialized, which could occur if a future
provider, for instance, is added. Without this modification, such a
change could break all models. If extra dependencies aren't desired, a
manual implementation could be used instead.

- Closes #29369 

Release Notes:

- Dynamically detect available Copilot Chat models, including all models
with tool support

---------

Co-authored-by: AidanV <aidanvanduyne@gmail.com>
Co-authored-by: imumesh18 <umesh4257@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
Co-authored-by: Agus Zubiaga <hi@aguz.me>
JosephTLyons pushed a commit that referenced this pull request May 12, 2025
I noticed the discussion in #28881, and had thought of exactly the same
a few days prior.

This implementation should preserve existing functionality fairly well.

I've added a dependency (serde_with) to allow the deserializer to skip
models which cannot be deserialized, which could occur if a future
provider, for instance, is added. Without this modification, such a
change could break all models. If extra dependencies aren't desired, a
manual implementation could be used instead.

- Closes #29369 

Release Notes:

- Dynamically detect available Copilot Chat models, including all models
with tool support

---------

Co-authored-by: AidanV <aidanvanduyne@gmail.com>
Co-authored-by: imumesh18 <umesh4257@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
Co-authored-by: Agus Zubiaga <hi@aguz.me>
JosephTLyons pushed a commit that referenced this pull request May 12, 2025
I noticed the discussion in #28881, and had thought of exactly the same
a few days prior.

This implementation should preserve existing functionality fairly well.

I've added a dependency (serde_with) to allow the deserializer to skip
models which cannot be deserialized, which could occur if a future
provider, for instance, is added. Without this modification, such a
change could break all models. If extra dependencies aren't desired, a
manual implementation could be used instead.

- Closes #29369 

Release Notes:

- Dynamically detect available Copilot Chat models, including all models
with tool support

---------

Co-authored-by: AidanV <aidanvanduyne@gmail.com>
Co-authored-by: imumesh18 <umesh4257@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
Co-authored-by: Agus Zubiaga <hi@aguz.me>
dive pushed a commit to dive/zed that referenced this pull request May 12, 2025
…es#29027)

I noticed the discussion in zed-industries#28881, and had thought of exactly the same
a few days prior.

This implementation should preserve existing functionality fairly well.

I've added a dependency (serde_with) to allow the deserializer to skip
models which cannot be deserialized, which could occur if a future
provider, for instance, is added. Without this modification, such a
change could break all models. If extra dependencies aren't desired, a
manual implementation could be used instead.

- Closes zed-industries#29369 

Release Notes:

- Dynamically detect available Copilot Chat models, including all models
with tool support

---------

Co-authored-by: AidanV <aidanvanduyne@gmail.com>
Co-authored-by: imumesh18 <umesh4257@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
Co-authored-by: Agus Zubiaga <hi@aguz.me>
osiewicz pushed a commit that referenced this pull request May 15, 2025
I noticed the discussion in #28881, and had thought of exactly the same
a few days prior.

This implementation should preserve existing functionality fairly well.

I've added a dependency (serde_with) to allow the deserializer to skip
models which cannot be deserialized, which could occur if a future
provider, for instance, is added. Without this modification, such a
change could break all models. If extra dependencies aren't desired, a
manual implementation could be used instead.

- Closes #29369 

Release Notes:

- Dynamically detect available Copilot Chat models, including all models
with tool support

---------

Co-authored-by: AidanV <aidanvanduyne@gmail.com>
Co-authored-by: imumesh18 <umesh4257@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
Co-authored-by: Agus Zubiaga <hi@aguz.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants