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

💄 config: Add qwen vision models #2879

Closed
wants to merge 9 commits into from
Closed

Conversation

sxjeru
Copy link
Contributor

@sxjeru sxjeru commented Jun 15, 2024

💻 变更类型 | Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • ⚡️ perf
  • 📝 docs

📝 补充信息 | Additional Information

#3114 替代。

S3 可用,先进行适配。

由于 Qwen VL 不支持当前的 Base64 图片,本 PR 延后至 lobe-chat 兼容 openai 的文件接口做好后再作完善。

image

🔀 变更说明 | Description of Change

添加并选择 Qwen VL Max 模型默认启用。

由于 Qwen2 开源模型在性能与价格上都超越了原始 Qwen 模型,所以更改了默认模型。

image

Copy link

vercel bot commented Jun 15, 2024

@sxjeru is attempting to deploy a commit to the LobeHub Team on Vercel.

A member of the Team first needs to authorize it.

@lobehubbot
Copy link
Member

👍 @sxjeru

Thank you for raising your pull request and contributing to our Community
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
If you encounter any problems, please feel free to connect with us.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。
如果您遇到任何问题,请随时与我们联系。

Copy link

codecov bot commented Jun 15, 2024

Codecov Report

Attention: Patch coverage is 60.25641% with 31 lines in your changes missing coverage. Please review.

Project coverage is 93.16%. Comparing base (df67dc0) to head (90d584b).

Current head 90d584b differs from pull request most recent head 5ebbd1b

Please upload reports for the commit 5ebbd1b to get more accurate results.

Files Patch % Lines
src/libs/agent-runtime/qwen/index.ts 44.00% 28 Missing ⚠️
src/libs/agent-runtime/utils/streams/openai.ts 62.50% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2879      +/-   ##
==========================================
- Coverage   93.30%   93.16%   -0.14%     
==========================================
  Files         383      382       -1     
  Lines       23931    23948      +17     
  Branches     2544     2676     +132     
==========================================
- Hits        22328    22312      -16     
- Misses       1603     1636      +33     
Flag Coverage Δ
app 93.16% <60.25%> (-0.14%) ⬇️
server 65.68% <26.92%> (-0.79%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sxjeru
Copy link
Contributor Author

sxjeru commented Jun 18, 2024

目前支持发送图片链接聊天,不过模型存在一些固有缺陷:

  • 若发送“帮我看看这个链接”等相关文字,其可能会回复“由于安全原因,无法访问外部链接”等保护性语句。
  • 怀疑阿里对图片链接存在黑名单筛选,输入一些链接会直接报错“输入疑似不合适的内容”。

image

image

@lobehubbot
Copy link
Member

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


Currently, sending image links for chat is supported, but the model has some inherent flaws:

  • If you send related text such as "Help me see this link", it may reply with protective statements such as "Due to security reasons, external links cannot be accessed".
  • It is suspected that Alibaba has a blacklist for filtering image links. When entering some links, an error message "Enter suspected inappropriate content" will be reported directly.

image

@sxjeru sxjeru marked this pull request as ready for review June 18, 2024 05:10
@sxjeru
Copy link
Contributor Author

sxjeru commented Jun 18, 2024

理论上已经支持 s3 上传的图片,由于阿里云疑似屏蔽了 eu.org 图片网址,导致这边无法实际测试。

@lobehubbot
Copy link
Member

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


Theoretically, images uploaded via s3 are supported. However, Alibaba Cloud seems to have blocked the eu.org image URL, making it impossible to actually test it here.

@@ -1,16 +1,63 @@
import OpenAI from 'openai';

import { ModelProvider } from '../types';
import { ModelProvider, UserMessageContentPart, OpenAIChatMessage } from '../types';
import { LobeOpenAICompatibleFactory } from '../utils/openaiCompatibleFactory';

export const LobeQwenAI = LobeOpenAICompatibleFactory({
baseURL: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
chatCompletion: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个要补下单测

@Mingholy
Copy link
Contributor

Mingholy commented Jul 2, 2024

#3114
qwen-vl的OpenAI兼容模式现在已经支持base64传入了。已提交PR支持,测试可通过base64或设置oss来上传图片调用。
但上述PR并未支持识别prompt中的图片链接构造input message。请 @arvinxx @sxjeru review下可否在重写的LobeQwenAI中增加message的处理方法。

@lobehubbot
Copy link
Member

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


#3114
The OpenAI compatibility mode of qwen-vl now supports base64 input. PR support has been submitted, and the test can be called through base64 or setting oss to upload images.
However, the above PR does not support identifying the image link in the prompt to construct the input message. Please @arvinxx @sxjeru review whether the message processing method can be added to the rewritten LobeQwenAI.

@sxjeru
Copy link
Contributor Author

sxjeru commented Jul 2, 2024

但上述PR并未支持识别prompt中的图片链接构造input message。

识别消息中的图片链接属于妥协方案,若粘贴图片能正常聊天,则不必添加。其他 provider 也没有支持。

@lobehubbot
Copy link
Member

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


However, the above PR does not support identifying the image link in the prompt to construct the input message.

Recognizing image links in messages is a compromise. If pasting the image will allow normal chat, there is no need to add it. Other providers are not supported either.

@sxjeru sxjeru closed this Jul 2, 2024
@sxjeru sxjeru deleted the patch-3 branch July 2, 2024 11:02
@sxjeru sxjeru restored the patch-3 branch July 2, 2024 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants