From a0fce720147bcda68d356b7e5eceffdd0ef6ac53 Mon Sep 17 00:00:00 2001 From: Nam Vu Date: Wed, 11 Sep 2024 14:44:53 +0700 Subject: [PATCH] fix: truthy value (#8208) --- api/core/callback_handler/index_tool_callback_handler.py | 2 +- api/core/model_runtime/model_providers/vertex_ai/llm/llm.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/core/callback_handler/index_tool_callback_handler.py b/api/core/callback_handler/index_tool_callback_handler.py index 50cde18c54f7e9..6d5393ce5c692d 100644 --- a/api/core/callback_handler/index_tool_callback_handler.py +++ b/api/core/callback_handler/index_tool_callback_handler.py @@ -67,7 +67,7 @@ def return_retriever_resource_info(self, resource: list): data_source_type=item.get("data_source_type"), segment_id=item.get("segment_id"), score=item.get("score") if "score" in item else None, - hit_count=item.get("hit_count") if "hit_count" else None, + hit_count=item.get("hit_count") if "hit_count" in item else None, word_count=item.get("word_count") if "word_count" in item else None, segment_position=item.get("segment_position") if "segment_position" in item else None, index_node_hash=item.get("index_node_hash") if "index_node_hash" in item else None, diff --git a/api/core/model_runtime/model_providers/vertex_ai/llm/llm.py b/api/core/model_runtime/model_providers/vertex_ai/llm/llm.py index ecb22e21bd1006..09a7f53f2816d1 100644 --- a/api/core/model_runtime/model_providers/vertex_ai/llm/llm.py +++ b/api/core/model_runtime/model_providers/vertex_ai/llm/llm.py @@ -115,7 +115,7 @@ def _generate_anthropic( token = credentials.token # Vertex AI Anthropic Claude3 Opus model available in us-east5 region, Sonnet and Haiku available in us-central1 region - if "opus" or "claude-3-5-sonnet" in model: + if "opus" in model or "claude-3-5-sonnet" in model: location = "us-east5" else: location = "us-central1"