Character Limit Issue with Azure OpenAI Bot in Microsoft Teams

Eugenio García Duro 25 Reputation points
2024-09-30T13:08:26.45+00:00

I am developing a bot using Azure OpenAI and Search service, which is deployed on Microsoft Teams. The bot works correctly in my local environment, but when I deploy it to Teams, the responses fail due to the character limit in the Teams channel (480 characters).

The bot retrieves large volumes of text from an storage account using Cognitive Search and generates responses through Azure OpenAI. The information returned in the citations often exceeds the 480-character limit imposed by Teams.

I have tried truncating the text in the citations.content field to fit within this limit, but Teams still rejects the responses or the content seems to be regenerated. I have not found a way to modify the character limit in Microsoft Teams or to control the size of the responses effectively.

Is it possible to increase the character limit for bot messages in Microsoft Teams?

If increasing the limit is not an option, what best practices do you recommend for handling responses that exceed 480 characters, especially when working with Cognitive Search and Azure OpenAI?

Is there any specific feature in Azure OpenAI or Cognitive Search that can help manage the amount of text returned in citations to comply with Teams' character limits?

Any guidance or suggestions on how to resolve this issue would be greatly appreciated. I am happy to provide additional details if needed.

Thank you for your assistance.

  1. This is the log results (I have removed the text in the content field)
CHAT RESPONSE:
status: 200
duration: 11033ms
{
  "id": "35f636c7-3dd8-4b72-8e51-f1c0cc9cf057",
  "model": "gpt-4",
  "created": 1727699856,
  "object": "extensions.chat.completion",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "content": "text removed [doc3].",
        "end_turn": true,
        "context": {
          "citations": [
            {
              "content": "text removed",
              "title": "PG 0001-2016 Código Ético.pdf",
              "url": "https://stcopernicus219750672363.blob.core.windows.net/copernicuspolicies/PG%200001-2016%20Co%CC%81digo%20E%CC%81tico.pdf",
              "filepath": "PG 0001-2016 Código Ético.pdf",
              "chunk_id": "1"
            },
            {
              "content": "text removed",
              "title": "PG 0001-2016 Código Ético.pdf",
              "url": "https://stcopernicus219750672363.blob.core.windows.net/copernicuspolicies/PG%200001-2016%20Co%CC%81digo%20E%CC%81tico.pdf",
              "filepath": "PG 0001-2016 Código Ético.pdf",
              "chunk_id": "2"
            },
            {
              "content": "text removed",
              "title": "PG 0001-2016 Código Ético.pdf",
              "url": "https://stcopernicus219750672363.blob.core.windows.net/copernicuspolicies/PG%200001-2016%20Co%CC%81digo%20E%CC%81tico.pdf",
              "filepath": "PG 0001-2016 Código Ético.pdf",
              "chunk_id": "0"
            }
          ],
          "intent": "[\"resumen del Código Ético PG 0001-2016\", \"contenido principal del Código Ético PG 0001-2016\", \"puntos clave del Código Ético PG 0001-2016\"]"
        }
      }
    }
  ],
  "usage": {
    "prompt_tokens": 5726,
    "completion_tokens": 371,
    "total_tokens": 6097
  },
  "system_fingerprint": "fp_5b26d85e12"
}
  azureopenai:app:error [onTurnError] unhandled error: RestError: Error while parsing citation entity with id: 1. 
  Detailed error message: The value of citation entity field 'citation.appearance.abstract' exceeds the length limit. 
  The maximum length is '480' characters, but the provided length is '497' characters. +3m
Azure AI Bot Service
Azure AI Bot Service
An Azure service that provides an integrated environment for bot development.
871 questions
Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
10,567 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,447 questions
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,455 questions
{count} vote

Accepted answer
  1. YutongTie-MSFT 53,701 Reputation points
    2024-09-30T18:50:50.8+00:00

    Hello Eugenio García Duro

    Thanks for reaching out to us, I would say this issue is more related to Microsoft Teams, I will add the Teams development tags so that more experts can share their insights.

    I have also check on Teams bot document, it is only mentioned 40 KB as the limit and extract of the referenced content and is limited to less than 1,000 characters.

    Reference document here -

    https://zcusa.951200.xyz/en-us/microsoftteams/platform/bots/how-to/bot-messages-ai-generated-content?tabs=before%2Cbotmessage#add-citations

    https://zcusa.951200.xyz/en-us/microsoftteams/platform/bots/how-to/format-your-bot-messages

    Hope Teams development experts can share more details. I hope this helps.

    Regards,

    Yutong


5 additional answers

Sort by: Most helpful
  1. Sing Peir Yun 5 Reputation points
    2024-10-02T01:07:21.56+00:00

    What can we do to fix this issue? I am having the exact same issue right now and my existing bot stop functioning, and I cannot seem to build a new bot as well, on Microsoft Teams. What are the workarounds on this? My bot was working fine before this.

    azureopenai:app:error [onTurnError] unhandled error: RestError: Error while parsing citation entity with id: 1. Detailed error message: The value of citation entity field 'citation.appearance.abstract' exceeds the length limit. The maximum length is '480' characters, but the provided length is '500' characters.

    azureopenai:app:error RestError: Error while parsing citation entity with id: 1. Detailed error message: The value of citation entity field 'citation.appearance.abstract' exceeds the length limit. The maximum length is '480' characters, but the provided length is '500' characters.


  2. Thomas Lowrey 5 Reputation points
    2024-10-27T17:14:40.7866667+00:00

    Has anyone found a workaround to this problem? Its been almost a month and no matter where I search no one seems to have an answer.


  3. vinod kumar 0 Reputation points
    2024-11-21T05:55:42.89+00:00

    I am also facing the same issue where we get suggestions to tweak these parameters which doesn't seems to be beneficial.
    image (3)

    Screenshot 2024-11-21 112359

    [onTurnError] unhandled error: RestError: Error while parsing citation entity with id: 2. Detailed error message: The value of citation entity field 'citation.appearance.abstract' exceeds the length limit. The maximum length is '480' characters, but the provided length is '490' characters. +0ms

    Please provide any suggestions if you find any.


  4. Aballe Ochoa, Roberto 0 Reputation points
    2024-11-21T22:13:19.5566667+00:00

    Same problem. Any resolution yet?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.