lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
44.09k stars 9.85k forks source link

[Request] 谷歌模型无法直接访问时 #1493

Closed mingyue0094 closed 6 months ago

mingyue0094 commented 8 months ago

🥰 需求描述

2个问题。 一 gemini 访问需要 添加socks5代理。 二 gemini api v1beta 支持函数调用了。

https://ai.google.dev/docs/api_versions?hl=zh-cn

🧐 解决方案

期望 一。有个环境变量,可以提供socks5代理给 谷歌 gemini 二。优化 接入 谷歌模型部分,使可用函数调用功能。

📝 补充信息

No response

lobehubbot commented 8 months ago

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


🥰 Description of requirements

2 questions. A gemini access requires adding socks5 proxy.

  1. gemini api v1beta supports function calling.

https://ai.google.dev/docs/api_versions?hl=zh-cn

🧐 Solution

expect one. There is an environment variable that can provide socks5 proxy to Google gemini two. Optimize the access to Google model part and make the function call function available.

📝 Supplementary information

No response

lobehubbot commented 8 months ago

👀 @mingyue0094

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。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

arvinxx commented 8 months ago
  1. 代理问题详见:https://github.com/lobehub/lobe-chat/issues/1313
  2. 一样等官方 SDK 实现,我们才能支持:https://github.com/google/generative-ai-js/issues/14
mingyue0094 commented 8 months ago
  1. 代理问题详见:[Request] GOOGLE_PROXY_URL Support #1313

    1. 一样等官方 SDK 实现,我们才能支持:Function calling support google/generative-ai-js#14

嗯。调用 generative-ai-js sdk 的方式,确实无法 新增这个功能。 他们是有 restapi 的,https://ai.google.dev/tutorials/rest_quickstart 构建请求json后,请求api 接口也可以。

早期的gemini 。用go掉sdk 就遇到添加代理不成功,然后 就看到 rest api 也很简洁的。就调rest api 实现了可加代理。https://github.com/mingyue0094/gemini_proxy/blob/main/main.go

arvinxx commented 7 months ago

嗯。调用 generative-ai-js sdk 的方式,确实无法 新增这个功能。 他们是有 restapi 的,https://ai.google.dev/tutorials/rest_quickstart 构建请求json后,请求api 接口也可以。

不考虑 api 调用,这个未来自己的维护成本很高的。我倾向官方做好之后我再集成的思路,不然维护不过来。

lobehubbot commented 7 months ago

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


Hmm. It is indeed impossible to add this function by calling generative-ai-js sdk. They have restapi, https://ai.google.dev/tutorials/rest_quickstart After building the request json, you can also request the api interface.

Regardless of api calls, the maintenance cost of this will be very high in the future. I prefer the idea of ​​​​integrating it after the official work is completed, otherwise it will not be maintained.

mingyue0094 commented 7 months ago

嗯。调用 generative-ai-js sdk 的方式,确实无法 新增这个功能。 他们是有 restapi 的,https://ai.google.dev/tutorials/rest_quickstart 构建请求json后,请求api 接口也可以。

不考虑 api 调用,这个未来自己的维护成本很高的。我倾向官方做好之后我再集成的思路,不然维护不过来。


官方最新版本好像是可以支持代理了。https://github.com/google/generative-ai-js/issues/29#issuecomment-1952519355

lobehubbot commented 7 months ago

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


Hmm. It is indeed impossible to add this function by calling generative-ai-js sdk. They have restapi, https://ai.google.dev/tutorials/rest_quickstart After building the request json, you can also request the api interface.

Regardless of api calls, this will have high maintenance costs in the future. I prefer the idea of ​​​​integrating it after the official work is completed, otherwise it will not be maintained.


The latest official version seems to support proxies. https://github.com/google/generative-ai-js/issues/29#issuecomment-1952519355

kierankihn commented 7 months ago

官方 SDK 现在已经支持了函数调用

参考 google/generative-ai-js/issues/66

官方示例:https://github.com/google/generative-ai-js/blob/main/samples/node/advanced-function-calling.js

lobehubbot commented 6 months ago

✅ @mingyue0094

This issue is closed, If you have any questions, you can comment and reply.\ 此问题已经关闭。如果您有任何问题,可以留言并回复。

lobehubbot commented 6 months ago

:tada: This issue has been resolved in version 0.147.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket: