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

[Exception] Exceeds the maximum token for the prompt #3079

Open
raych1 opened this issue Oct 30, 2023 · 0 comments
Open

[Exception] Exceeds the maximum token for the prompt #3079

raych1 opened this issue Oct 30, 2023 · 0 comments
Assignees
Labels
AI-Bot bug Something isn't working question Further information is requested

Comments

@raych1
Copy link

raych1 commented Oct 30, 2023

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?

image

@raych1 raych1 self-assigned this Oct 30, 2023
@raych1 raych1 added bug Something isn't working question Further information is requested AI-Bot labels Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI-Bot bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant