Skip to content

Commit

Permalink
Update embedding model IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
n4ze3m committed Jan 16, 2024
1 parent 9492eef commit 4a34351
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/ui/src/components/Common/BotForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ export const BotForm = ({
form={form}
className="space-y-6"
initialValues={{
embedding: "text-embedding-ada-002",
embedding: "dialoqbase_eb_text-embedding-ada-002",
model: "gpt-3.5-turbo-dbase",
maxDepth: 2,
maxLinks: 10,
Expand Down
1 change: 1 addition & 0 deletions app/ui/src/routes/settings/model.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ export default function SettingsModelRoot() {
title: "Model ID",
key: "model_id",
className: "text-gray-500",
render: (text) => text.replace("dialoqbase_eb_", ""),
},
{
dataIndex: "model_provider",
Expand Down
32 changes: 16 additions & 16 deletions server/prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,49 +274,49 @@ const EMBEDDING_MODELS: {
config?: string;
}[] = [
{
model_id: "text-embedding-ada-002",
model_id: "dialoqbase_eb_text-embedding-ada-002",
name: "text-embedding-ada-002",
model_provider: "OpenAI",
model_type: "embedding",
},
{
model_id: "small",
model_id: "dialoqbase_eb_small",
name: "Cohere",
model_provider: "Cohere",
model_type: "embedding",
},
{
model_id: "Xenova/all-MiniLM-L6-v2",
model_id: "dialoqbase_eb_Xenova/all-MiniLM-L6-v2",
name: "all-MiniLM-L6-v2 (cpu)",
model_type: "embedding",
model_provider: "Transformer",
},
{
model_id: "dialoqbase-ollama",
model_id: "dialoqbase_eb_dialoqbase-ollama",
name: "Ollama Embeddings",
model_type: "embedding",
model_provider: "Ollama",
},
{
model_id: "models/embedding-gecko-001",
model_id: "dialoqbase_eb_models/embedding-gecko-001",
name: "Google text-gecko-001",
model_type: "embedding",
model_provider: "Google PaLM",
},
{
model_id: "jina-embeddings-v2-base-en",
model_id: "dialoqbase_eb_jina-embeddings-v2-base-en",
name: "jina-embeddings-v2-base-en (API)",
model_type: "embedding",
model_provider: "Jina",
},
{
model_id: "Xenova/jina-embeddings-v2-small-en",
model_id: "dialoqbase_eb_Xenova/jina-embeddings-v2-small-en",
name: "jina-embeddings-v2-small-en (cpu)",
model_type: "embedding",
model_provider: "Transformer",
},
{
model_id: "embedding-001",
model_id: "dialoqbase_eb_embedding-001",
name: "Google embedding-001",
model_type: "embedding",
model_provider: "Google",
Expand Down Expand Up @@ -363,7 +363,7 @@ const replaceOldEmbeddings = async () => {
embedding: "openai",
},
data: {
embedding: "text-embedding-ada-002",
embedding: "dialoqbase_eb_text-embedding-ada-002",
},
})

Expand All @@ -372,17 +372,17 @@ const replaceOldEmbeddings = async () => {
embedding: "cohere",
},
data: {
embedding: "small",
embedding: "dialoqbase_eb_small",
},
})


await prisma.bot.updateMany({
where: {
embedding: "transformer",
embedding: "dialoqbase_eb_transformer",
},
data: {
embedding: "Xenova/all-MiniLM-L6-v2",
embedding: "dialoqbase_eb_Xenova/all-MiniLM-L6-v2",
},
})

Expand All @@ -391,7 +391,7 @@ const replaceOldEmbeddings = async () => {
embedding: "google-gecko",
},
data: {
embedding: "models/embedding-gecko-001",
embedding: "dialoqbase_eb_models/embedding-gecko-001",
},
})

Expand All @@ -400,7 +400,7 @@ const replaceOldEmbeddings = async () => {
embedding: "jina-api",
},
data: {
embedding: "jina-embeddings-v2-base-en",
embedding: "dialoqbase_eb_jina-embeddings-v2-base-en",
},
})

Expand All @@ -409,7 +409,7 @@ const replaceOldEmbeddings = async () => {
embedding: "jina",
},
data: {
embedding: "Xenova/jina-embeddings-v2-small-en",
embedding: "dialoqbase_eb_Xenova/jina-embeddings-v2-small-en",
},
})

Expand All @@ -418,7 +418,7 @@ const replaceOldEmbeddings = async () => {
embedding: "google",
},
data: {
embedding: "embedding-001",
embedding: "dialoqbase_eb_embedding-001",
},
})

Expand Down
2 changes: 1 addition & 1 deletion server/src/handlers/api/v1/admin/model.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export const saveEmbedddingModelFromInputedUrlHandler = async (
await prisma.dialoqbaseModels.create({
data: {
name: model_name,
model_id: model_id,
model_id: `dialoqbase_eb_${model_id}`,
local_model: true,
model_type: "embedding",
model_provider: model_provider[api_type],
Expand Down
2 changes: 1 addition & 1 deletion server/src/utils/embeddings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const embeddings = (
modelName: string,
otherFields: any
) => {
console.log("Using Embeddings", provider, modelName);
modelName = modelName.replace("dialoqbase_eb_", "");
switch (provider.toLocaleLowerCase()) {
case "openai":
return new OpenAIEmbeddings({
Expand Down

0 comments on commit 4a34351

Please sign in to comment.