Skip to content
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

Copilot declarative Agent Plugin : copilot only takes the first 10 elements #13314

Open
moudhafersalhi opened this issue Feb 27, 2025 · 5 comments
Assignees
Labels

Comments

@moudhafersalhi
Copy link

Describe the bug
I build 2 different declarative copilot Agent. Both of them use 2 different APIs for 2 different purposes.
When asked about something, copilot makes the correct API call and gets the correct informations(all rows), but when analysing and checking, it takes in consideration only the first 10elements of my JSON Response!
To Reproduce
Steps to reproduce the behavior:

Expected behavior
I expect that Copilot takes in consideration the whole dataset returend by my API
Screenshots
First screenshot. Copilot says we have 10 consutlants in the datavase

Image
Second Screenshot. The API returns 18 consutlants and not only 10

Image

VS Code Extension Information (please complete the following information):

  • OS: windows
  • Version 1.96.4

CLI Information (please complete the following information):

  • OS: windows
  • Version 5.12.1 (Teams toolkit)

Additional context
Add any other context about the problem here.

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs attention This issue needs the attention of a contributor. label Feb 27, 2025
Copy link

👋 Hi @moudhafersalhi,

Thank you for reporting this issue! We want to let you know that:

⏱️ Our team will personally review your issue
🎯 You can expect a response within 2 business days

✨ This is an AI-generated initial response
🤖 AI-Generated Preliminary Analysis:

It appears that you are encountering an issue where the Copilot declarative agent is only considering the first 10 elements of your JSON response, despite your API returning more results.

This is a known issue with how the Copilot declarative agent processes data. Here are some steps and workarounds you can try to resolve this issue:

Steps and Workarounds:

  1. Check Pagination and Response Size:

    • Ensure that your API response includes all the elements in a single response or implements pagination if the dataset is large.
    • Verify that your API does not have any limits on the number of items returned per request.
  2. Modify OpenAPI Specification:

    • If you are using an OpenAPI specification, review it to ensure that it properly describes the full dataset and any pagination mechanisms.
    • You might need to adjust the schema to ensure all elements are considered.
  3. Adjust Copilot Agent Configuration:

    • The agent might have a configuration limit on the number of elements processed. Check the configuration settings within the declarative agent setup to see if there's an option to adjust this limit.
  4. Post-Processing in Agent Logic:

    • Implement post-processing logic within the agent to handle the full dataset. This can be done by aggregating the results before they are analyzed by the agent.
  5. Update Teams Toolkit:

    • Ensure you are using the latest version of the Teams Toolkit, as updates may include fixes for known issues. You mentioned using version 5.12.1; check if a newer version is available.

Example of Adjusting OpenAPI Specification:

If the issue is related to the OpenAPI specification, you might need to adjust it to ensure it supports handling larger datasets:

paths:
  /consultants:
    get:
      summary: Get all consultants
      responses:
        '200':
          description: A list of consultants
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    displayName:
                      type: string

Example of Agent Configuration Adjustment:

If the agent configuration is the issue, you might need to dive into the settings to adjust the element processing limit:

{
  "agent": {
    "settings": {
      "maxElements": 50  // Adjust this to handle more elements
    }
  }
}

Contact Support:

If the above steps do not resolve the issue, it might be best to contact Microsoft support or raise an issue on the Teams Toolkit GitHub repository with detailed information about your setup and the problem.

Additional Resources:

If you have any specific error codes or additional details, please provide them, and I can further assist you with more targeted solutions.


Note: This is an automated first response generated by AI. A human team member will review your issue and provide a more detailed response soon. We appreciate your patience!

@Prasad-MSFT
Copy link

Hi @moudhafersalhi, thanks for raising your issue. We will check this and will get back to you shortly.

@SLdragon
Copy link
Contributor

SLdragon commented Mar 3, 2025

Hi, @moudhafersalhi ,
Copilot automatically controls the response message. Maybe you can ask it to include all elements from your original message.

@moudhafersalhi
Copy link
Author

Hi, @moudhafersalhi , Copilot automatically controls the response message. Maybe you can ask it to include all elements from your original message.

Hi @SLdragon , thank you but i tried this as well. I tried even asking how many items the copilot received and copilot always answer based on 10 and says it received only 10.
I found a workaround tho. changing the API response from an array to an object of items solved the issue.
Previous response
[
{},{}...etc
]
New Response
{
count: X,
items: [{},{}...etc]
}

@SLdragon
Copy link
Contributor

SLdragon commented Mar 4, 2025

Thank you @moudhafersalhi for your input.
It appears Copilot limits array displays to 10 items to prevent lengthy messages, and when using object it will be treated to single element.

@adashen adashen removed the needs attention This issue needs the attention of a contributor. label Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants