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
42.14k stars 9.5k forks source link

[Request] 自定义嵌入模型 Custom Embedding model #3785

Open ProAlexUSC opened 1 month ago

ProAlexUSC commented 1 month ago

🥰 需求描述

目前嵌入模型仅支持 text-embedding-3-small,能否支持其他模型,或者提供模型 remap 的能力?

At present, the embedded model only supports text-embedding-3-small. Can it support other models, or provide the ability for model remapping?

🧐 解决方案

我在 OpenAI 模型配置下,使用其他兼容 OpenAI 接口的大模型提供商,它提供了 netease-youdao/bce-embedding-base_v1 模型。 希望能使用这个模型作为嵌入模型,或者直接重命名 netease-youdao/bce-embedding-base_v1text-embedding-3-small

Under the OpenAI model configuration, I am using a large model provider that is compatible with the OpenAI API, which offers the netease-youdao/bce-embedding-base_v1 model. I hope to use this model as the embedding model, or directly rename netease-youdao/bce-embedding-base_v1 to text-embedding-3-small.

📝 补充信息

No response

lobehubbot commented 1 month ago

👀 @ProAlexUSC

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

dosubot[bot] commented 1 month ago

@ProAlexUSC 你好!我是Dosu,我是一个可以帮助你解决 bug、回答问题,并成为贡献者的机器人。如果你有任何问题,我会很乐意帮助你。

You can add support for other embedding models or remap existing models within the system. The models.json file in the src/libs/agent-runtime/togetherai/fixtures/ directory allows you to specify model remapping. For example, you can rename netease-youdao/bce-embedding-base_v1 to text-embedding-3-small as follows:

{
  "name": "netease-youdao/bce-embedding-base_v1",
  "renamed": "text-embedding-3-small",
  ...
}

This will allow the system to use the netease-youdao/bce-embedding-base_v1 model under the name text-embedding-3-small [1].

To continue talking to Dosu, mention @dosu.

arvinxx commented 4 weeks ago

后续会支持的,但是这个模型的向量必须要能设定 1024 维才能用

lobehubbot commented 4 weeks ago

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


It will be supported in the future, but the vector of this model must be able to set 1024 dimensions before it can be used.

Lostsite commented 3 weeks ago

后续会支持的,但是这个模型的向量必须要能设定 1024 维才能用

Why must be 1024 dimensions? Also, based on OpenAI, "text-embedding-3-small" is 1,536 dimensions.

ref: https://platform.openai.com/docs/models/embeddings

arvinxx commented 3 weeks ago

@Lostsite Just read the offical docuement.

https://openai.com/index/new-embedding-models-and-api-updates/

image

https://platform.openai.com/docs/guides/embeddings/use-cases

image
exqmjmz commented 3 weeks ago

后续会支持的,但是这个模型的向量必须要能设定 1024 维才能用

BAAI/bge-m3 这个向量支持1024纬度在siliconflow有这个模型,目前是免费 https://docs.siliconflow.cn/reference/createembedding-1

CaiJingLong commented 3 weeks ago

So, must have OpenAI API to use it? Why not support ollama embedding. Or, if it support ollama embedding, how to set it?

Btw, I use self host server mode to deploy with docker-compose.

exqmjmz commented 3 weeks ago

智谱的embedding-3也支持1024纬度以上的向量 https://open.bigmodel.cn/dev/api/vector/embedding-3 image

alwqx commented 1 week ago

后续会支持的,但是这个模型的向量必须要能设定 1024 维才能用

赞,希望支持 ollama 运行的嵌入模型

lobehubbot commented 1 week ago

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


It will be supported in the future, but the vector of this model must be able to set 1024 dimensions before it can be used.

Like, I hope to support the embedded model run by ollama

JunerLee commented 1 week ago

后续会支持的,但是这个模型的向量必须要能设定 1024 维才能用

目前也是遇到了这个问题,服务端只能用openai的词嵌入向量化,国内很多模型也支持价格也不贵,希望可以支持更多家的向量化模型,比如ChatGLM的

lobehubbot commented 1 week ago

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


It will be supported in the future, but the vector of this model must be able to set 1024 dimensions before it can be used.

We are currently encountering this problem as well. The server can only use openai's word embedding vectorization. Many domestic models also support it and the price is not expensive. We hope to support more vectorization models, such as ChatGLM's.

Salmon-Bard commented 1 week ago

How can I get lobe-chat to a call a Rest API that exposes my local hosted embedding model ?? My be there should be some webhook or plugin to pass embedding created via any model