Skip to content

Выводить ответ сервера при ошибках, а не только код и трассировку #68

Description

@weatherwarlock

Установил, настроил.
Получил ошибку при обращении к vLLM

Service request failed.
Status: 400 (BAD REQUEST)
   в OpenAI.ClientPipelineExtensions.ProcessMessage(ClientPipeline pipeline, PipelineMessage message, RequestOptions options) в C:\projects\github\openai-dotnet\src\Custom\Internal\ClientPipelineExtensions.cs:строка 51
   в OpenAI.Chat.ChatClient.CompleteChat(BinaryContent content, RequestOptions options) в C:\projects\github\openai-dotnet\src\Generated\ChatClient.cs:строка 28
   в OpenAI.Chat.ChatClient.<>c__DisplayClass12_0.<CompleteChatStreaming>b__0() в C:\projects\github\openai-dotnet\src\Custom\Chat\ChatClient.cs:строка 228
   в OpenAI.SseUpdateCollection`1.<GetRawPages>d__10.MoveNext() в C:\projects\github\openai-dotnet\src\Utility\SseUpdateCollection.cs:строка 71
   в System.ClientModel.CollectionResult`1.<GetEnumerator>d__1.MoveNext()
   в FreeAIr.BLogic.Reader.LLMReader.<ReadSafelyPrivateAsync>d__10.MoveNext() в C:\projects\github\FreeAIr\FreeAIr\BLogic\Reader\LLMReader.cs:строка 211

И только когда сделал прокси, поймал на нем запрос и отправил через postman получил что ошибся в задаче max_completion_tokens

{
    "error": {
        "message": "This model's maximum context length is 262144 tokens. However, you requested 262144 output tokens and your prompt contains 27559 characters (more than 0 characters, which is the upper bound for 0 input tokens). Please reduce the length of the input prompt or the number of requested output tokens. (parameter=input_text, value=27559)",
        "type": "BadRequestError",
        "param": "input_text",
        "code": 400
    }
}

Потому считаю полезным выводить помимо кода ошибки еще и само сообщение(и на мой взгляд трассировку в таких случаях прятать под спойлер или в раскрывающуюся панель).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions