Skip to content

Commit 2d88a78

Browse files
committed
[fix] video question answering uses grabed gemini key
1 parent 5f37acd commit 2d88a78

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

edenai_apis/apis/google/google_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ def __init__(self, api_keys: Dict = {}):
5151
"llm_client": LLMEngine(
5252
provider_name="gemini",
5353
provider_config={
54-
"api_key": self.api_settings.pop("genai_api_key", None),
54+
"api_key": self.api_settings.get("genai_api_key"),
5555
},
5656
),
5757
}
5858
if self.location:
5959
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = self.location
6060
self.__set_remaining_clients(clients_init_payload)
6161
else:
62-
if not check_empty_values(self.api_settings):
62+
if not check_empty_values(self.api_settings, ["genai_api_key"]):
6363
credentials = service_account.Credentials.from_service_account_info(
6464
self.api_settings
6565
)

edenai_apis/loaders/utils.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,18 @@ def check_messsing_keys(owr_dict: Dict, own_dict: Dict):
2121
return True
2222

2323

24-
def check_empty_values(data):
24+
def check_empty_values(data, keys_to_ignore: List[str] = []) -> bool:
2525
"""
2626
Recursively checks if all values in a dictionary (JSON-like object)
27-
are None, empty strings, or empty containers (like {}, [], etc.).
27+
are None, empty strings, or empty containers (like {}, [], etc.),
28+
excluding keys listed in keys_to_ignore.
2829
"""
2930
if isinstance(data, dict):
30-
return all(check_empty_values(v) for v in data.values())
31+
return all(
32+
key in keys_to_ignore or check_empty_values(value, keys_to_ignore)
33+
for key, value in data.items()
34+
)
3135
elif isinstance(data, list):
32-
return all(check_empty_values(item) for item in data)
36+
return all(check_empty_values(item, keys_to_ignore) for item in data)
3337
else:
3438
return data in (None, "", [], {})

0 commit comments

Comments
 (0)