This repository was archived by the owner on Aug 26, 2025. It is now read-only.
forked from Azure/azure-rest-api-specs
-
Notifications
You must be signed in to change notification settings - Fork 8
This repository was archived by the owner on Aug 26, 2025. It is now read-only.
[Exception] Exceeds the maximum token for the prompt #3079
Copy link
Copy link
Open
Labels
AI-BotbugSomething isn't workingSomething isn't workingquestionFurther information is requestedFurther information is requested
Description
Bug Report
-
What is your query?
With multiple round of conversation, the history and query would exceeds the token limit. -
What is the link if your query contain a github spec PR?
-
What is the problem?
System.Net.Http.HttpClient.Default.LogicalHandler: Information: Start processing HTTP request POST https://smba.trafficmanager.net/apac/v3/conversations/a%3A1KuFW_HAfIhUkXwnIAf9BtHmxEGhW7qrJolkeh96xrMYBVVAx3DY1ATWOFw8zyudODOVvHQZgvfU3UgfxBsjU45JFkKooRMqqvbH_c_0e0mJBkXu4uDQo53jZ789tLhf_/activities/1698649251462
System.Net.Http.HttpClient.Default.ClientHandler: Information: Sending HTTP request POST https://smba.trafficmanager.net/apac/v3/conversations/a%3A1KuFW_HAfIhUkXwnIAf9BtHmxEGhW7qrJolkeh96xrMYBVVAx3DY1ATWOFw8zyudODOVvHQZgvfU3UgfxBsjU45JFkKooRMqqvbH_c_0e0mJBkXu4uDQo53jZ789tLhf_/activities/1698649251462
'SpecReviewBot.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.13\System.Diagnostics.StackTrace.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'SpecReviewBot.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.13\System.Reflection.Metadata.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'SpecReviewBot.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.13\System.Collections.Immutable.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Microsoft.Bot.Builder.Integration.AspNet.Core.CloudAdapter: Error: [OnTurnError] unhandled error : Failed to perform AI prompt completion: Invalid request: The request is not valid, HTTP status: 400
Microsoft.TeamsAI.Exceptions.PlannerException: Failed to perform AI prompt completion: Invalid request: The request is not valid, HTTP status: 400
---> Microsoft.SemanticKernel.AI.AIException: Invalid request: The request is not valid, HTTP status: 400
---> Azure.RequestFailedException: This model's maximum context length is 4097 tokens, however you requested 4123 tokens (3123 in your prompt; 1000 for the completion). Please reduce your prompt; or completion length.
Status: 400 (model_error)
Content:
{
"error": {
"message": "This model's maximum context length is 4097 tokens, however you requested 4123 tokens (3123 in your prompt; 1000 for the completion). Please reduce your prompt; or completion length.",
"type": "invalid_request_error",
"param": null,
"code": null
}
}
at Azure.Core.HttpPipelineExtensions.ProcessMessageAsync(HttpPipeline pipeline, HttpMessage message, RequestContext requestContext, CancellationToken cancellationToken)
at Azure.AI.OpenAI.OpenAIClient.GetCompletionsAsync(String deploymentOrModelName, CompletionsOptions completionsOptions, CancellationToken cancellationToken)
at Microsoft.SemanticKernel.Connectors.AI.OpenAI.AzureSdk.ClientBase.RunRequestAsync[T](Func`1 request)
--- End of inner exception stack trace ---
at Microsoft.SemanticKernel.Connectors.AI.OpenAI.AzureSdk.ClientBase.RunRequestAsync[T](Func`1 request)
at Microsoft.SemanticKernel.Connectors.AI.OpenAI.AzureSdk.ClientBase.InternalGetTextResultsAsync(String text, CompleteRequestSettings requestSettings, CancellationToken cancellationToken)
at Microsoft.TeamsAI.AI.Planner.OpenAIPlanner`2._CreateTextCompletion(PromptTemplate promptTemplate, CancellationToken cancellationToken)
at Microsoft.TeamsAI.AI.Planner.OpenAIPlanner`2.CompletePromptAsync(ITurnContext turnContext, TState turnState, PromptTemplate promptTemplate, AIOptions`1 options, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at Microsoft.TeamsAI.AI.Planner.OpenAIPlanner`2.CompletePromptAsync(ITurnContext turnContext, TState turnState, PromptTemplate promptTemplate, AIOptions`1 options, CancellationToken cancellationToken)
at Microsoft.TeamsAI.AI.Planner.OpenAIPlanner`2.GeneratePlanAsync(ITurnContext turnContext, TState turnState, PromptTemplate promptTemplate, AIOptions`1 options, CancellationToken cancellationToken)
at Microsoft.TeamsAI.AI.AI`1.ChainAsync(ITurnContext turnContext, TState turnState, PromptTemplate prompt, AIOptions`1 options, CancellationToken cancellationToken)
at Microsoft.TeamsAI.AI.AI`1.ChainAsync(ITurnContext turnContext, TState turnState, String prompt, AIOptions`1 options, CancellationToken cancellationToken)
at Microsoft.TeamsAI.Application`2._OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken)
at Microsoft.TeamsAI.Application`2.OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.MiddlewareSet.ReceiveActivityWithStatusAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.BotAdapter.RunPipelineAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken)
Microsoft.Bot.Builder.Integration.AspNet.Core.CloudAdapter: Information: SendActivitiesAsync for 1 activities.
- What is the Screenshot if have?
Metadata
Metadata
Assignees
Labels
AI-BotbugSomething isn't workingSomething isn't workingquestionFurther information is requestedFurther information is requested
