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

✨ feat: 允许用户自行定义 Embedding 模型 #4370

Closed
wants to merge 372 commits into from

Conversation

cookieY
Copy link
Contributor

@cookieY cookieY commented Oct 14, 2024

💻 变更类型 | Change Type

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

🔀 变更说明 | Description of Change

本次变更主要实现了embedding 模型可配置性

通过新增环境变量DEFAULT_FILES_CONFIG实现可自主配置embedding 模型, provider基于现有模型供应商列表

示例:

以 / 为分隔符 openai 为模型提供商, text-embedding-3-small为 embedding 模型

DEFAULT_FILES_CONFIG="embedding_model=zhipu/embedding-3,reranker_model=cohere/rerank-english-v3.0,query_mode=full_text"

📝 补充信息 | Additional Information

目前已支持 zhipu/github/openai/bedrock/ollama模型提供商的embedding 模型

可在agent-runtime下对各模型提供商实现 embeddings 方法从而增加 embedding 模型支持

为后续检索策略预留 rerank 模型以及查询模式变量入口

Copy link

vercel bot commented Oct 14, 2024

@cookieY is attempting to deploy a commit to the LobeChat Community Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Oct 14, 2024
@lobehubbot
Copy link
Member

👍 @cookieY

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.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。
如果您遇到任何问题,请随时与我们联系。

@dosubot dosubot bot added the 🌠 Feature Request New feature or request | 特性与建议 label Oct 14, 2024
Copy link

codecov bot commented Oct 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.21%. Comparing base (780a2a9) to head (f4feb68).
Report is 338 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4370      +/-   ##
==========================================
- Coverage   92.53%   92.21%   -0.32%     
==========================================
  Files         522      571      +49     
  Lines       37335    43419    +6084     
  Branches     3664     2519    -1145     
==========================================
+ Hits        34547    40040    +5493     
- Misses       2788     3379     +591     
Flag Coverage Δ
app 92.21% <ø> (-0.32%) ⬇️
server 97.66% <ø> (+0.39%) ⬆️

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.

Copy link
Contributor

@arvinxx arvinxx left a comment

Choose a reason for hiding this comment

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

rag_evals 这部分先不要改,目前暂时没有什么人用的,这个 PR 先把最基础的自定义逻辑理顺加上

README.md Outdated Show resolved Hide resolved
.env.example Outdated Show resolved Hide resolved
docs/self-hosting/environment-variables/basic.mdx Outdated Show resolved Hide resolved
src/config/knowledge.ts Outdated Show resolved Hide resolved
src/const/settings/knowledge.ts Outdated Show resolved Hide resolved
src/types/serverConfig.ts Show resolved Hide resolved
@arvinxx
Copy link
Contributor

arvinxx commented Oct 28, 2024

另外 rebase 下 main?

@lobehubbot
Copy link
Member

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


Also rebase main?

@cookieY
Copy link
Contributor Author

cookieY commented Oct 28, 2024

@arvinxx 已根据建议重新更改,解构我会在另提一个 pr

@lobehubbot
Copy link
Member

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


@arvinxx has changed it according to the suggestion. I will submit another PR to deconstruct it.

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Oct 28, 2024
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Oct 30, 2024
Copy link
Contributor

Choose a reason for hiding this comment

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

这几个格式化是不是可以先拆出来 merge 掉

src/server/routers/async/file.ts Outdated Show resolved Hide resolved
src/server/routers/async/file.ts Show resolved Hide resolved
src/server/routers/lambda/chunk.ts Show resolved Hide resolved
@BrandonStudio
Copy link
Contributor

模型卡片里面是不是要加embeddingModels?现在只有chatModels
另外models存储是不是要重构?从远程获取模型列表的时候不仅要获取chat模型,还要获取embedding模型(provider的models方法,目前是丢弃所有非chat模型)

@lobehubbot
Copy link
Member

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


Do I need to add embeddingModels to the model card? Now only chatModels
In addition, does the models storage need to be restructured? When getting the model list from the remote, you need to get not only the chat model, but also the embedding model (provider's models method currently discards all non-chat models)

@arvinxx
Copy link
Contributor

arvinxx commented Nov 9, 2024

模型卡片里面是不是要加embeddingModels?现在只有chatModels
另外models存储是不是要重构?从远程获取模型列表的时候不仅要获取chat模型,还要获取embedding模型(provider的models方法,目前是丢弃所有非chat模型)

嗯,后续是要加的。不过这个还不着急,我们这个月有计划会全量改造一下现在的语言模型那块,会分成供应商配置、语言模型、向量化模型、文生图模型、语音模型等等。

@lobehubbot
Copy link
Member

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


Do we need to add embeddingModels to the model card? Now only chatModels
In addition, does the models storage need to be restructured? When obtaining the model list remotely, you must obtain not only the chat model, but also the embedding model (provider's models method currently discards all non-chat models)

Well, it will be added later. But don’t worry about it yet. We have plans to completely transform the current language model this month, which will be divided into supplier configuration, language model, vectorization model, Vincentian graph model, speech model, etc.

### [Version&nbsp;1.35.2](lobehub/lobe-chat@v1.35.1...v1.35.2)
<sup>Released on **2024-12-01**</sup>

#### 💄 Styles

- **misc**: Improve i18n.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### Styles

* **misc**: Improve i18n, closes [lobehub#4857](lobehub#4857) ([4b7dbc0](lobehub@4b7dbc0))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
@lobehubbot
Copy link
Member

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


@escapeWu Well, we can move forward.

hezhijie0327 and others added 21 commits December 25, 2024 11:40
### [Version&nbsp;1.39.2](lobehub/lobe-chat@v1.39.1...v1.39.2)
<sup>Released on **2024-12-25**</sup>

#### ♻ Code Refactoring

- **misc**: Refactor sensenova provider with LobeOpenAICompatibleFactory.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### Code refactoring

* **misc**: Refactor sensenova provider with LobeOpenAICompatibleFactory, closes [lobehub#5116](lobehub#5116) ([5656f39](lobehub@5656f39))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
* 测试 ppr

* fix

* fix loading on home

* fix style

* fix

* fix

* fix type

* try to fix

* fix

* Delete src/app/(main)/chat/@session/loading.tsx

* refactor

* fix setting layout

* fix loading style

* fix import

* Update loading.tsx

* fix lint
### [Version&nbsp;1.39.3](lobehub/lobe-chat@v1.39.2...v1.39.3)
<sup>Released on **2024-12-25**</sup>

#### 💄 Styles

- **misc**: Improve loading brand.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### Styles

* **misc**: Improve loading brand, closes [lobehub#5165](lobehub#5165) ([9684c98](lobehub@9684c98))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Dec 25, 2024
@cookieY cookieY closed this Dec 25, 2024
@cookieY cookieY deleted the embedding branch December 25, 2024 07:48
@cookieY cookieY restored the embedding branch December 25, 2024 07:48
@cookieY cookieY deleted the embedding branch December 25, 2024 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌠 Feature Request New feature or request | 特性与建议 size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.