Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions knext/command/sub_command/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,18 @@ def create_project(
llm_config_checker = LLMConfigChecker()
vectorize_model_config_checker = VectorizeModelConfigChecker()
llm_config = config.get("chat_llm", {})
vectorize_model_config = config.get("vectorizer", {})
vectorize_model_config = config.get("vectorizer", {}) or config.get(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Empty dict triggers the second part of 'or'

"vectorize_model", {}
)
if "vectorizer" not in config and "vectorize_model" in config:
Comment thread
Kaedeser marked this conversation as resolved.
Outdated
config["vectorizer"] = config.get("vectorize_model", {})
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is unnecessary since the key existence was already checked.

Suggest changing to

config["vectorizer"] = config["vectorize_model"]

try:
llm_config_checker.check(json.dumps(llm_config))
dim = vectorize_model_config_checker.check(json.dumps(vectorize_model_config))
config["vectorizer"]["vector_dimensions"] = dim
if "vectorizer" in config and isinstance(config["vectorizer"], dict):
config["vectorizer"]["vector_dimensions"] = dim
if "vectorize_model" in config and isinstance(config["vectorize_model"], dict):
config["vectorize_model"]["vector_dimensions"] = dim
except Exception as e:
click.secho(f"Error: {e}", fg="bright_red")
sys.exit()
Expand Down
Loading