Skip to content

Commit

Permalink
Merge pull request #2 from telekom/ms/fix-embedding-dim
Browse files Browse the repository at this point in the history
fix: use EMBEDDING_DIM for milvus and set it to 768 as default
  • Loading branch information
doginono authored Apr 23, 2024
2 parents 2852cbc + b154e84 commit 692fbe1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions helpers/env-variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ export const createBackendEnvFile = async (
];
let envVars: EnvVar[] = [];
if (opts.framework === "fastapi") {
// TODO: select right dimension depending on the model
const defaultDimension = opts.model === "large-model" ? "1536" : "768";
envVars = [
...defaultEnvs,
...[
Expand All @@ -171,6 +173,7 @@ export const createBackendEnvFile = async (
{
name: "EMBEDDING_DIM",
description: "Dimension of the embedding model to use.",
value: defaultDimension,
},
{
name: "LLM_TEMPERATURE",
Expand Down
2 changes: 1 addition & 1 deletion templates/components/vectordbs/python/milvus/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def generate_datasource():
user=os.getenv("MILVUS_USERNAME"),
password=os.getenv("MILVUS_PASSWORD"),
collection_name=os.getenv("MILVUS_COLLECTION"),
dim=int(os.getenv("MILVUS_DIMENSION", "1536")),
dim=int(os.getenv("EMBEDDING_DIM")),
)
storage_context = StorageContext.from_defaults(vector_store=store)
VectorStoreIndex.from_documents(
Expand Down
2 changes: 1 addition & 1 deletion templates/components/vectordbs/python/milvus/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def get_index():
user=os.getenv("MILVUS_USERNAME"),
password=os.getenv("MILVUS_PASSWORD"),
collection_name=os.getenv("MILVUS_COLLECTION"),
dim=int(os.getenv("EMBEDDING_DIM", "1536")),
dim=int(os.getenv("EMBEDDING_DIM")),
)
index = VectorStoreIndex.from_vector_store(store)
logger.info("Finished connecting to index from Milvus.")
Expand Down

0 comments on commit 692fbe1

Please sign in to comment.