-
-
Notifications
You must be signed in to change notification settings - Fork 10k
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 model #4208
Conversation
Index and object should not be stored in the data table, right? Is there an implementation problem?
Then I suggest that it is better to directly return the array of embedding, without the need for the two fields object and index. It is recommended that you first make a refactor PR to transform the existing implementation into a version without object and index. |
* 'main' of github.com:cookieY/lobe-chat: 🔖 chore(release): v1.20.8 [skip ci] 👷 build: remove unnecessary SSL judgments (lobehub#4219) 🔨 chore: upgrade `shiki` to 1.21.0 (lobehub#4218)
@arvinxx 目前已搞定 目前代码个人觉得有些地方想看下有没有更好的优化方案,目前是通过在embeddingChunks,runRecordEvaluation,semanticSearch,semanticSearchForChat方法中添加以下方法获得 embedding model 信息,是否有更好的优化方案 const model =getServerGlobalConfig().defaultEmbed?.embedding_model?.model DEFAULT_EMBEDDING_MODEL.model;
const provider =getServerGlobalConfig().defaultEmbed?.embedding_model?.provider ??DEFAULT_EMBEDDING_MODEL.provider;
const items: NewEmbeddingsItem[] =
embeddings?.map((e) => ({
chunkId: chunks[e.index].id,
embeddings: e.embedding,
fileId: input.fileId,
model: model,
})) || []; 目前是通过embedding 返回数据中的 index 作为索引查找,当前情况下 不管是更改格式还是不更改,都会出现一部分提供商返回的数据需要进行二次包装。(不改,bedrock/ollama需要包装。改,zhipu/openai 需要包装),我的建议是暂时先不动了 |
# Conflicts: # src/libs/agent-runtime/zhipu/index.ts # src/server/routers/async/file.ts # src/server/routers/async/ragEval.ts # src/server/routers/lambda/chunk.ts
2. 新增 csv 分快
@cookieY rebase下重新提交吧 |
@cookieY Rebase and resubmit |
@arvinxx 等等我 reset 后重新提交一个新的分支吧 |
@arvinxx Wait for me to reset and resubmit a new branch. |
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
本次变更主要实现了embedding 模型可配置性
通过新增环境变量DEFAULT_EMBEDDING_MODEL实现可自主配置embedding 模型, provider基于现有模型供应商列表
示例:
📝 补充信息 | Additional Information
目前已支持 openai / bedrock / ollama / zhipu模型提供商 的 embedding 模型
可在agent-runtime下对各模型提供商实现 embeddings 方法从而增加 embedding 模型支持