Skip to content

Commit

Permalink
fix: better solution for filetype string
Browse files Browse the repository at this point in the history
Signed-off-by: thiswillbeyourgithub <26625900+thiswillbeyourgithub@users.noreply.github.com>
  • Loading branch information
thiswillbeyourgithub committed Oct 18, 2024
1 parent 23f11e6 commit 0c1a59a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 1 addition & 3 deletions wdoc/utils/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,7 @@ def load_one_doc(
split into documents, add some metadata then return.
The loader is cached"""
text_splitter = get_splitter(task, modelname=llm_name)
if filetype != "string": # only filetype that can take empty arguments
assert kwargs, "Received an empty dict of arguments to load. Maybe --path is empty?"
assert kwargs, "Received an empty dict of arguments to load. Maybe --path is empty?"

expected_global_dir = loaders_temp_dir_file.read_text().strip()
assert expected_global_dir, f"Empty loaders_temp_dir_file at {loaders_temp_dir_file}"
Expand Down Expand Up @@ -438,7 +437,6 @@ def load_one_doc(
)

elif filetype == "string":
assert not kwargs, f"Received unexpected arguments for filetype 'string': {kwargs}"
docs = load_string()

elif filetype == "txt":
Expand Down
2 changes: 2 additions & 0 deletions wdoc/wdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ def print_exception(exc_type, exc_value, exc_traceback):
query_eval_modelname = None
if filetype == "auto":
assert "path" in cli_kwargs and cli_kwargs["path"], "If filetype is 'auto', a --path must be given"
elif filetype == "string":
cli_kwargs["path"] = "empty placeholder"
assert "/" in modelname, "modelname must be in litellm format: provider/model. For example 'openai/gpt-4o'"
if modelname != TESTING_LLM and modelname.split("/", 1)[0] not in list(litellm.models_by_provider.keys()):
raise Exception(
Expand Down

0 comments on commit 0c1a59a

Please sign in to comment.