mirror of
https://github.com/Hopiu/llm.git
synced 2026-04-30 01:44:44 +00:00
Updated error message for invalid or missing embedding model (#257)
* Updated error message for missing embedding model --------- Co-authored-by: Simon Willison <swillison@gmail.com>
This commit is contained in:
parent
ab05023b30
commit
df32d7685d
2 changed files with 7 additions and 4 deletions
|
|
@ -1082,7 +1082,7 @@ def embed(collection, id, input, model, store, database, content, metadata, form
|
|||
model = get_default_embedding_model()
|
||||
if model is None:
|
||||
raise click.ClickException(
|
||||
"You need to specify a model (no default model is set)"
|
||||
"You need to specify an embedding model (no default model is set)"
|
||||
)
|
||||
collection_obj = Collection(collection, db=db, model_id=model)
|
||||
model_obj = collection_obj.model()
|
||||
|
|
@ -1092,7 +1092,7 @@ def embed(collection, id, input, model, store, database, content, metadata, form
|
|||
model_obj = get_embedding_model(model)
|
||||
except UnknownModelError:
|
||||
raise click.ClickException(
|
||||
"You need to specify a model (no default model is set)"
|
||||
"You need to specify an embedding model (no default model is set)"
|
||||
)
|
||||
|
||||
show_output = True
|
||||
|
|
@ -1216,7 +1216,7 @@ def embed_multi(
|
|||
)
|
||||
except ValueError:
|
||||
raise click.ClickException(
|
||||
"You need to specify a model (no default model is set)"
|
||||
"You need to specify an embedding model (no default model is set)"
|
||||
)
|
||||
|
||||
expected_length = None
|
||||
|
|
|
|||
|
|
@ -474,7 +474,10 @@ def test_default_embed_model_errors(user_path, default_is_set, command):
|
|||
assert result.exit_code == 0
|
||||
else:
|
||||
assert result.exit_code == 1
|
||||
assert "You need to specify a model (no default model is set)" in result.output
|
||||
assert (
|
||||
"You need to specify an embedding model (no default model is set)"
|
||||
in result.output
|
||||
)
|
||||
# Now set the default model and try again
|
||||
result2 = runner.invoke(cli, ["embed-models", "default", "embed-demo"])
|
||||
assert result2.exit_code == 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue