Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/app runner typo #2661

Merged
merged 2 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion api/core/app_runner/app_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def get_pre_calculate_rest_tokens(self, app_record: App,

return rest_tokens

def recale_llm_max_tokens(self, model_config: ModelConfigEntity,
def recalc_llm_max_tokens(self, model_config: ModelConfigEntity,
prompt_messages: list[PromptMessage]):
# recalc max_tokens if sum(prompt_token + max_tokens) over model token limit
model_type_instance = model_config.provider_model_bundle.model_type_instance
Expand Down
2 changes: 1 addition & 1 deletion api/core/app_runner/basic_app_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def run(self, application_generate_entity: ApplicationGenerateEntity,
return

# Re-calculate the max tokens if sum(prompt_token + max_tokens) over model token limit
self.recale_llm_max_tokens(
self.recalc_llm_max_tokens(
model_config=app_orchestration_config.model_config,
prompt_messages=prompt_messages
)
Expand Down
2 changes: 1 addition & 1 deletion api/core/features/assistant_cot_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def increase_usage(final_llm_usage_dict: dict[str, LLMUsage], usage: LLMUsage):
)

# recale llm max tokens
self.recale_llm_max_tokens(self.model_config, prompt_messages)
self.recalc_llm_max_tokens(self.model_config, prompt_messages)
# invoke model
chunks: Generator[LLMResultChunk, None, None] = model_instance.invoke_llm(
prompt_messages=prompt_messages,
Expand Down
2 changes: 1 addition & 1 deletion api/core/features/assistant_fc_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def increase_usage(final_llm_usage_dict: dict[str, LLMUsage], usage: LLMUsage):
)

# recale llm max tokens
self.recale_llm_max_tokens(self.model_config, prompt_messages)
self.recalc_llm_max_tokens(self.model_config, prompt_messages)
# invoke model
chunks: Union[Generator[LLMResultChunk, None, None], LLMResult] = model_instance.invoke_llm(
prompt_messages=prompt_messages,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) \
if not base_url:
return self.create_text_message('Please input base_url')

if 'model' in tool_parameters:
if 'model' in tool_parameters and tool_parameters['model']:
self.runtime.credentials['model'] = tool_parameters['model']

model = self.runtime.credentials.get('model', None)
Expand Down