danny-avila / LibreChat

Enhanced ChatGPT Clone: Features Anthropic, AWS, OpenAI, Assistants API, Azure, Groq, o1, GPT-4o, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, langchain, DALL-E-3, ChatGPT Plugins, OpenAI Functions, Secure Multi-User System, Presets, completely open-source for self-hosting. Actively in public development.
https://librechat.ai/
MIT License
17.44k stars 2.9k forks source link

[Bug]: Unexpected Application Error: Objects are not valid as a React child #3483

Closed orangebutblue closed 1 month ago

orangebutblue commented 1 month ago

What happened?

Using Vertex AI (for Claude). LibreChat crashes instantly when I send a message. I get redirected to the following error:

Unexpected Application Error!
Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7Blc%2C%20type%2C%20id%2C%20kwargs%7D for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7Blc%2C%20type%2C%20id%2C%20kwargs%7D for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at Gm (https://librechat....com/assets/vendor-BilfyWdU.js:38:12805)
    at P (https://librechat....com/assets/vendor-BilfyWdU.js:38:17863)
    at Vn (https://librechat....com/assets/vendor-BilfyWdU.js:40:1475)
    at TO (https://librechat....com/assets/vendor-BilfyWdU.js:40:44430)
    at RO (https://librechat....com/assets/vendor-BilfyWdU.js:40:39790)
    at rX (https://librechat....com/assets/vendor-BilfyWdU.js:40:39718)
    at Hg (https://librechat....com/assets/vendor-BilfyWdU.js:40:39570)
    at Z_ (https://librechat....com/assets/vendor-BilfyWdU.js:40:35934)
    at o8 (https://librechat....com/assets/vendor-BilfyWdU.js:40:36738)
    at Dl (https://librechat....com/assets/vendor-BilfyWdU.js:38:3279)

When I open that link, it says:

...
The full text of the error you just encountered is:

Objects are not valid as a React child (found: object with keys {lc, type, id, kwargs}). If you meant to render a collection of children, use an array instead.

I'm using the docker version. The docker log says:


2024-07-30 19:27:56 error: [handleAbortError] AI response error; aborting request: Unable to verify model params: {"lc":1,"type":"constructor","id":["langchain","chat_models","chat_integration","ChatVertexAI"],"kwargs":{"model":"claude-3-5-sonnet-20240620","temperature":1,"max_output_tokens":8192,"top_p":0.95,"top_k":40,"stop":["||>","\nUser:","<|diff_marker|>"],"max_retries":2,"auth_options":{"lc":1,"type":"secret","id":["GOOGLE_AUTH_OPTIONS"]},"platform_type":"gcp"}},
2024-07-30 19:27:56 warn: AI Response error for conversation 7bacf876-b238-4374-8223-322b14ef3290 likely caused by Google censor/filter

I don't think it has anything to do with the censor/filter. It does it for every message I'm trying to send.

These are the relevant changes i've made in the .env:

GOOGLE_MODELS=claude-3-5-sonnet-20240620

GOOGLE_SAFETY_SEXUALLY_EXPLICIT=BLOCK_ONLY_HIGH
GOOGLE_SAFETY_HATE_SPEECH=BLOCK_ONLY_HIGH
GOOGLE_SAFETY_HARASSMENT=BLOCK_ONLY_HIGH
GOOGLE_SAFETY_DANGEROUS_CONTENT=BLOCK_ONLY_HIGH

contents of my docker-compose.override.yml:

version: '3.4'

services:
  api:
    volumes:
    - type: bind
      source: ./api/data/auth.json
      target: /app/api/data/auth.json

Of course the file is there:

hostsytem# ls -l api/data/auth.json
-rw-r--r-- 1 root root 2399 Jul 30 14:23 api/data/auth.json

Steps to Reproduce

  1. login
  2. Switch to Google provider
  3. Switch to 'claude-3-5-sonnet-20240620
  4. type in anything into the chat
  5. redirect to error page

What browsers are you seeing the problem on?

Firefox, Chrome

Relevant log output

when I enable debugging in the .env file, I get this in the docker logs:

,
> LibreChat@0.7.4-rc1 backend,
> cross-env NODE_ENV=production node api/server/index.js,
,
2024-07-30T19:37:04.735Z info: [Optional] Redis not initialized. Note: Redis support is experimental.,
2024-07-30T19:37:07.311Z info: Connected to MongoDB,
2024-07-30T19:37:07.559Z debug: [indexSync] There are 39 messages and 39 indexed,
2024-07-30T19:37:07.559Z debug: [indexSync] There are 13 convos and 13 indexed,
2024-07-30T19:37:07.577Z error: Config file YAML format is invalid: ENOENT: no such file or directory, open '/app/librechat.yaml',
2024-07-30T19:37:07.578Z warn: Default value for CREDS_KEY is being used.,
2024-07-30T19:37:07.578Z warn: Default value for CREDS_IV is being used.,
2024-07-30T19:37:07.578Z warn: Default value for JWT_SECRET is being used.,
2024-07-30T19:37:07.579Z warn: Default value for JWT_REFRESH_SECRET is being used.,
2024-07-30T19:37:07.579Z info: Please replace any default secret values.,
2024-07-30T19:37:07.579Z info: ​,
,
    For your convenience, use this tool to generate your own secret values:,
    https://www.librechat.ai/toolkit/creds_generator,
,
    ​,
2024-07-30T19:37:07.585Z warn: RAG API is either not running or not reachable at http://rag_api:8000, you may experience errors with file uploads.,
2024-07-30T19:37:07.603Z info: Server listening on all interfaces at port 3080. Use http://localhost:3080 to access it,
2024-07-30T19:37:18.349Z debug: [validateJson] files,
["\"Ai_PDF.json\"","\"BrowserOp.json\"","\"Dr_Thoths_Tarot.json\"","\"DreamInterpreter.json\"","\"VoxScript.json\"","\"askyourpdf.json\"","\"drink_maestro.json\"","\"earthImagesAndVisualizations.json\"","\"image_prompt_enhancer.json\"","\"qrCodes.json\"","\"scholarai.json\"","\"uberchord.json\"","\"web_search.json\""],
2024-07-30T19:37:18.615Z debug: [validateJson] files,
["\"Ai_PDF.json\"","\"BrowserOp.json\"","\"Dr_Thoths_Tarot.json\"","\"DreamInterpreter.json\"","\"VoxScript.json\"","\"askyourpdf.json\"","\"drink_maestro.json\"","\"earthImagesAndVisualizations.json\"","\"image_prompt_enhancer.json\"","\"qrCodes.json\"","\"scholarai.json\"","\"uberchord.json\"","\"web_search.json\""],
2024-07-30T19:37:23.358Z debug: [AskController],
{,
  text: "test",,
  conversationId: null,,
  // 1 example(s),
  examples: [{"input":{"content":""},"output":{"content":""}}],,
  endpoint: "google",,
  modelLabel: null,,
  promptPrefix: null,,
  iconURL: undefined,,
  greeting: undefined,,
  spec: undefined,,
    modelOptions.model: "claude-3-5-sonnet-20240620",,
    modelOptions.temperature: 1,,
    modelOptions.maxOutputTokens: 8192,,
    modelOptions.topP: 0.95,,
    modelOptions.topK: 40,,
    modelOptions.maxContextTokens: undefined,,
    // 20 openAI(s),
    modelsConfig.openAI: ["gpt-4o-mini","gpt-4o","gpt-3.5-turbo","gpt-3.5-turbo-0125","gpt-4-turbo","gpt-4-turbo-2024-04-09","gpt-4-0125-preview","gpt-4-turbo-preview","gpt-4-1106-preview","gpt-3.5-turbo-1106","gpt-3.5-turbo-16k-0613","gpt-3.5-turbo-16k","gpt-4","gpt-4-0314","gpt-4-32k-0314","gpt-4-0613","gpt-3.5-turbo-0613","gpt-4-vision-preview","gpt-3.5-turbo-instruct-0914","gpt-3.5-turbo-instruct"],,
    // 1 google(s),
    modelsConfig.google: ["claude-3-5-sonnet-20240620"],,
    // 11 anthropic(s),
    modelsConfig.anthropic: ["claude-3-5-sonnet-20240620","claude-3-opus-20240229","claude-3-sonnet-20240229","claude-3-haiku-20240307","claude-2.1","claude-2","claude-1.2","claude-1","claude-1-100k","claude-instant-1","claude-instant-1-100k"],,
    // 13 gptPlugin(s),
    modelsConfig.gptPlugins: ["gpt-4o-mini","gpt-4o","gpt-3.5-turbo","gpt-3.5-turbo-0125","gpt-4-turbo","gpt-4-turbo-2024-04-09","gpt-4-0125-preview","gpt-4-turbo-preview","gpt-4-1106-preview","gpt-3.5-turbo-1106","gpt-3.5-turbo-16k","gpt-4","gpt-4-vision-preview"],,
    // 15 azureOpenAI(s),
    modelsConfig.azureOpenAI: ["gpt-3.5-turbo","gpt-3.5-turbo-0125","gpt-4-turbo","gpt-4-turbo-2024-04-09","gpt-4-0125-preview","gpt-4-turbo-preview","gpt-4-1106-preview","gpt-3.5-turbo-1106","gpt-3.5-turbo-16k-0613","gpt-3.5-turbo-16k","gpt-4","gpt-4-0314","gpt-4-32k-0314","gpt-4-0613","gpt-3.5-turbo-0613"],,
    // 2 bingAI(s),
    modelsConfig.bingAI: ["BingAI","Sydney"],,
    // 2 chatGPTBrowser(s),
    modelsConfig.chatGPTBrowser: ["text-davinci-002-render-sha","gpt-4"],,
    // 17 assistant(s),
    modelsConfig.assistants: ["gpt-4o-mini","gpt-4o","gpt-3.5-turbo","gpt-3.5-turbo-0125","gpt-4-turbo","gpt-4-turbo-2024-04-09","gpt-4-0125-preview","gpt-4-turbo-preview","gpt-4-1106-preview","gpt-3.5-turbo-1106","gpt-3.5-turbo-16k-0613","gpt-3.5-turbo-16k","gpt-4","gpt-4-0314","gpt-4-32k-0314","gpt-4-0613","gpt-3.5-turbo-0613"],,
    // 20 azureAssistant(s),
    modelsConfig.azureAssistants: ["gpt-4o-mini","gpt-4o","gpt-3.5-turbo","gpt-3.5-turbo-0125","gpt-4-turbo","gpt-4-turbo-2024-04-09","gpt-4-0125-preview","gpt-4-turbo-preview","gpt-4-1106-preview","gpt-3.5-turbo-1106","gpt-3.5-turbo-16k-0613","gpt-3.5-turbo-16k","gpt-4","gpt-4-0314","gpt-4-32k-0314","gpt-4-0613","gpt-3.5-turbo-0613","gpt-4-vision-preview","gpt-3.5-turbo-instruct-0914","gpt-3.5-turbo-instruct"],,
},
2024-07-30T19:37:23.536Z debug: [BaseClient] Loading history:,
{,
  conversationId: "7e612a13-2220-462d-97f2-819c6957b4b8",,
  parentMessageId: "00000000-0000-0000-0000-000000000000",,
},
2024-07-30T19:37:23.547Z debug: [GoogleClient] buildMessages,
{,
[LOGGER PARSING ERROR] Cannot read properties of undefined (reading 'additional_kwargs'),
2024-07-30T19:37:23.550Z debug: Creating VertexAI client,
2024-07-30T19:37:23.554Z error: [handleAbortError] AI response error; aborting request: Unable to verify model params: {"lc":1,"type":"constructor","id":["langchain","chat_models","c... [truncated],
2024-07-30T19:37:23.555Z warn: AI Response error for conversation 7e612a13-2220-462d-97f2-819c6957b4b8 likely caused by Google censor/filter,
2024-07-30T19:37:23.578Z debug: [saveConvo] api/app/clients/BaseClient.js - saveMessageToDatabase #saveConvo,
2024-07-30T19:37:23.585Z debug: [AskController] Request closed,


### Screenshots

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
lidonius1122 commented 1 month ago

The Google Endpoint is specifically designed for Gemini models and utilizes a different API schema compared to Anthropic's models. As a result, Claude models cannot be directly accessed through this endpoint. However, if you wish to use Claude via Google Cloud Vertex AI, you'll need to implement a proxy solution. One option is to use litellm, which acts as an proxy, allowing you to interact with Claude through the Vertex AI infrastructure.

https://www.librechat.ai/blog/2023-11-30_litellm