chore: fix unnecessary string concatation in single line (#8311)
This commit is contained in:
@@ -200,7 +200,7 @@ class AIModel(ABC):
|
||||
except Exception as e:
|
||||
model_schema_yaml_file_name = os.path.basename(model_schema_yaml_path).rstrip(".yaml")
|
||||
raise Exception(
|
||||
f"Invalid model schema for {provider_name}.{model_type}.{model_schema_yaml_file_name}:" f" {str(e)}"
|
||||
f"Invalid model schema for {provider_name}.{model_type}.{model_schema_yaml_file_name}: {str(e)}"
|
||||
)
|
||||
|
||||
# cache model schema
|
||||
|
||||
@@ -621,7 +621,7 @@ class CohereLargeLanguageModel(LargeLanguageModel):
|
||||
|
||||
desc = p_val["description"]
|
||||
if "enum" in p_val:
|
||||
desc += f"; Only accepts one of the following predefined options: " f"[{', '.join(p_val['enum'])}]"
|
||||
desc += f"; Only accepts one of the following predefined options: [{', '.join(p_val['enum'])}]"
|
||||
|
||||
parameter_definitions[p_key] = ToolParameterDefinitionsValue(
|
||||
description=desc, type=p_val["type"], required=required
|
||||
|
||||
@@ -96,7 +96,7 @@ class HuggingfaceHubLargeLanguageModel(_CommonHuggingfaceHub, LargeLanguageModel
|
||||
|
||||
if credentials["task_type"] not in ("text2text-generation", "text-generation"):
|
||||
raise CredentialsValidateFailedError(
|
||||
"Huggingface Hub Task Type must be one of text2text-generation, " "text-generation."
|
||||
"Huggingface Hub Task Type must be one of text2text-generation, text-generation."
|
||||
)
|
||||
|
||||
client = InferenceClient(token=credentials["huggingfacehub_api_token"])
|
||||
@@ -282,7 +282,7 @@ class HuggingfaceHubLargeLanguageModel(_CommonHuggingfaceHub, LargeLanguageModel
|
||||
|
||||
valid_tasks = ("text2text-generation", "text-generation")
|
||||
if model_info.pipeline_tag not in valid_tasks:
|
||||
raise ValueError(f"Model {model_name} is not a valid task, " f"must be one of {valid_tasks}.")
|
||||
raise ValueError(f"Model {model_name} is not a valid task, must be one of {valid_tasks}.")
|
||||
except Exception as e:
|
||||
raise CredentialsValidateFailedError(f"{str(e)}")
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ class HuggingfaceHubTextEmbeddingModel(_CommonHuggingfaceHub, TextEmbeddingModel
|
||||
|
||||
valid_tasks = "feature-extraction"
|
||||
if model_info.pipeline_tag not in valid_tasks:
|
||||
raise ValueError(f"Model {model_name} is not a valid task, " f"must be one of {valid_tasks}.")
|
||||
raise ValueError(f"Model {model_name} is not a valid task, must be one of {valid_tasks}.")
|
||||
except Exception as e:
|
||||
raise CredentialsValidateFailedError(f"{str(e)}")
|
||||
|
||||
|
||||
@@ -572,7 +572,7 @@ class OllamaLargeLanguageModel(LargeLanguageModel):
|
||||
label=I18nObject(en_US="Size of context window"),
|
||||
type=ParameterType.INT,
|
||||
help=I18nObject(
|
||||
en_US="Sets the size of the context window used to generate the next token. " "(Default: 2048)"
|
||||
en_US="Sets the size of the context window used to generate the next token. (Default: 2048)"
|
||||
),
|
||||
default=2048,
|
||||
min=1,
|
||||
@@ -650,7 +650,7 @@ class OllamaLargeLanguageModel(LargeLanguageModel):
|
||||
label=I18nObject(en_US="Format"),
|
||||
type=ParameterType.STRING,
|
||||
help=I18nObject(
|
||||
en_US="the format to return a response in." " Currently the only accepted value is json."
|
||||
en_US="the format to return a response in. Currently the only accepted value is json."
|
||||
),
|
||||
options=["json"],
|
||||
),
|
||||
|
||||
@@ -86,7 +86,7 @@ class ReplicateLargeLanguageModel(_CommonReplicate, LargeLanguageModel):
|
||||
|
||||
if model.count("/") != 1:
|
||||
raise CredentialsValidateFailedError(
|
||||
"Replicate Model Name must be provided, " "format: {user_name}/{model_name}"
|
||||
"Replicate Model Name must be provided, format: {user_name}/{model_name}"
|
||||
)
|
||||
|
||||
try:
|
||||
|
||||
@@ -472,7 +472,7 @@ class TongyiLargeLanguageModel(LargeLanguageModel):
|
||||
for p_key, p_val in properties.items():
|
||||
desc = p_val["description"]
|
||||
if "enum" in p_val:
|
||||
desc += f"; Only accepts one of the following predefined options: " f"[{', '.join(p_val['enum'])}]"
|
||||
desc += f"; Only accepts one of the following predefined options: [{', '.join(p_val['enum'])}]"
|
||||
|
||||
properties_definitions[p_key] = {
|
||||
"description": desc,
|
||||
|
||||
Reference in New Issue
Block a user