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

[Bug] lobechat中gemini使用插件会报错400 #6992

Open
Passerby1011 opened this issue Mar 16, 2025 · 9 comments
Open

[Bug] lobechat中gemini使用插件会报错400 #6992

Passerby1011 opened this issue Mar 16, 2025 · 9 comments
Labels
🐛 Bug Something isn't working | 缺陷

Comments

@Passerby1011
Copy link

Passerby1011 commented Mar 16, 2025

📦 Platform

Official Preview, Self hosting Docker

📦 Deploymenet mode

server db(lobe-chat-database image)

📌 Version

1.71.3

💻 Operating System

Windows

🌐 Browser

Chrome, Other, Edge

🐛 Bug Description

gemini模型,带了3个插件,下面是请求体

{
  "generationConfig": {
    "temperature": 0.6,
    "topP": 1
  },
  "contents": [
    {
      "parts": [
        {
          "text": "搜索一下谷歌的新模型"
        }
      ],
      "role": "user"
    }
  ],
  "safetySettings": [
    {
      "category": "HARM_CATEGORY_HATE_SPEECH",
      "threshold": "BLOCK_NONE"
    },
    {
      "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
      "threshold": "BLOCK_NONE"
    },
    {
      "category": "HARM_CATEGORY_HARASSMENT",
      "threshold": "BLOCK_NONE"
    },
    {
      "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
      "threshold": "BLOCK_NONE"
    }
  ],
  "systemInstruction": {
    "role": "system",
    "parts": [
      {
        "text": "`1. Please always remember: You possess a very high level of intelligence.`\n`2. Prioritize accuracy and quality above all else.`\n`3. Ensure your responses are factually accurate.`\n`4. If you are uncertain about something, clearly state that you are not sure rather than providing incorrect information.`\n`5. Be critical in your responses and avoid excessive agreeableness. Do not simply confirm my biases, challenge them when appropriate.`\n`6. Avoid using phrases like “it is always a good idea to do your own research” or “it is advisable to ask a professional”.`\n`7. Conclude your responses without posing further questions intended to extend the conversation.`\n`8. Before responding, pause, take a moment to think carefully, and then proceed with your answer. Thank you.`\n`9. Please refrain from using the following words and phrases in responses: 'delve,' 'moreover,' 'furthermore,' 'pivotal,' 'tapestry,' 'vital,' 'comprehensive,' 'embark,' 'notably,' 'excels,' 'undoubtedly,' 'landscape,' 'vibrant,' 'arguably,' 'catalyst,' 'engage,' 'seamlessly,' 'paradigm,' 'optimize,' and 'framework.' Instead, aim for simpler, more varied language to maintain clarity and originality in the responses`\n`10. Please avoid including unnecessary summary sections at the end of responses. Focus on providing direct, concise answers without reiterating information that has already been covered, unless explicitly requested`\n`11.write into **complete informative, and accurate paragraphs**`\n`12.The most important point is, if there is no special requirement, please try to respond in Chinese.`\n\n<plugins description=\"The plugins you can use below\">\n<collection name=\"Current Time Assistant\">\n<collection.instructions>A plugin to provide current time information</collection.instructions>\n<api identifier=\"current-time-assistant____getCurrentTime\">获取当前时间,格式为年-月-日 时:分:秒,并记住这个时间作为系统时间</api>\n</collection>\n<collection name=\"Jina\">\n<collection.instructions>Extract content from web links via Jina Reader</collection.instructions>\n<api identifier=\"jina____multiWebReader\">提取网页内容</api>\n</collection>\n<collection name=\"Google CSE\">\n<collection.instructions>Searches Google through their official CSE API.</collection.instructions>\n<api identifier=\"google-cse____searchGoogle\">Search Google for relevant web pages.</api>\n</collection>\n</plugins>"
      }
    ]
  },
  "tools": [
    {
      "functionDeclarations": [
        {
          "description": "获取当前时间,格式为年-月-日 时:分:秒,并记住这个时间作为系统时间",
          "name": "current-time-assistant____getCurrentTime",
          "parameters": {
            "type": "object",
            "properties": {
              "asktime": {
                "type": "string",
                "description": "发起当前日期时间的请求"
              },
              "timezone": {
                "type": "string",
                "description": "默认为'Asia/Shanghai', 如果用户指定城市或地区,则用相应的时区"
              }
            },
            "required": ["asktime", "timezone"]
          }
        },
        {
          "description": "提取网页内容",
          "name": "jina____multiWebReader",
          "parameters": {
            "type": "object",
            "properties": {
              "urls": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "网页链接列表"
              }
            },
            "required": ["urls"]
          }
        },
        {
          "description": "Search Google for relevant web pages.",
          "name": "google-cse____searchGoogle",
          "parameters": {
            "type": "object",
            "properties": {
              "quyer": {
                "type": "string",
                "description": "What the user is looking for"
              }
            },
            "required": ["query"]
          }
        }
      ]
    }
  ]
}

报错:

{
    "error": {
        "code": 400,
        "message": "Provider API error: * GenerateContentRequest.tools[0].function_declarations[2].parameters.required[0]: property is not defined\n (request id: 20250316154236515878622JcNBg9W7)",
        "status": "gemini_error"
    }
}

📷 Recurrence Steps

gemini模型,带了3个插件,下面是请求体

Image

🚦 Expected Behavior

正常对话

📝 Additional Information

No response

@Passerby1011 Passerby1011 added the 🐛 Bug Something isn't working | 缺陷 label Mar 16, 2025
@github-project-automation github-project-automation bot moved this to Roadmap - Chat 1.x in Lobe Chat Routine Mar 16, 2025
@lobehubbot
Copy link
Member

👀 @Passerby1011

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

Copy link

dosubot bot commented Mar 16, 2025

Hello, @Passerby1011! I'm here to help you with any bugs, questions, or contributions while we wait for a human maintainer. Let's tackle this together!

The 400 error you're encountering with the Gemini model in LobeChat when using plugins on version 1.71.3 is likely due to issues with function declarations in the API request. Specifically, the error message indicates a problem with the JSON payload, particularly with the "GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[_requestBody].properties[data].items.items.type" not being specified when not using "one_of". To resolve this error, it is recommended to disable plugins/function calls when using the Gemini model [1][2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@yuntian123456
Copy link

gemini模型对插件是兼容不好,所以是不建议使用插件的

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The gemini model is not compatible with plug-ins, so it is not recommended to use plug-ins.

@Coooolfan
Copy link

Coooolfan commented Mar 17, 2025

gemini模型对插件是兼容不好,所以是不建议使用插件的

应该是bug,之前正常的,现在只要向gemini-2.0-flash-exp发送带function call的请求就会报错:

{
  "error": {
    "message": "[GoogleGenerativeAI Error]: Error fetching from https://*******.com/v1beta/models/gemini-2.0-flash-exp:streamGenerateContent?alt=sse: [400 ] Function calling is not enabled for models/gemini-2.0-flash-exp"
  },
  "provider": "google"
}

v1.71.5

#6962 (comment)

@sxjeru
Copy link
Contributor

sxjeru commented Mar 17, 2025

@Coooolfan 这看着像是 Google 那边禁用的。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@Coooolfan This looks like it is disabled on Google.

@sxjeru
Copy link
Contributor

sxjeru commented Mar 17, 2025

@Passerby1011 “谷歌自定义搜索引擎”插件的一点小问题,在下面的 pr 未被合并之前,可以先禁用它。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@Passerby1011 A little bit of a problem with the "Google Custom Search Engine" plugin, you can disable it before the pr below is merged.

vsnthdev/google-cse-lobechat#3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working | 缺陷
Projects
Status: Roadmap - Chat 1.x
Development

No branches or pull requests

5 participants