mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-17 23:51:30 +00:00
fix: raise clear error when file references used without api_key
This commit is contained in:
parent
c91b44adeb
commit
76d53fe861
1 changed files with 18 additions and 0 deletions
|
|
@ -214,6 +214,15 @@ class GoogleBatchEmbeddings(VertexLLM):
|
|||
resolved_files=resolved_files,
|
||||
)
|
||||
else:
|
||||
input_list = [input] if isinstance(input, str) else input
|
||||
has_file_refs = any(
|
||||
_is_file_reference(e) for e in input_list if isinstance(e, str)
|
||||
)
|
||||
if has_file_refs and not api_key:
|
||||
raise ValueError(
|
||||
"An API key is required to resolve Gemini file references (files/...). "
|
||||
"Pass api_key= or set GEMINI_API_KEY."
|
||||
)
|
||||
resolved_files = {}
|
||||
if api_key and _is_multimodal_input(input):
|
||||
resolved_files = self._resolve_file_references(
|
||||
|
|
@ -310,6 +319,15 @@ class GoogleBatchEmbeddings(VertexLLM):
|
|||
resolved_files=resolved_files,
|
||||
)
|
||||
else:
|
||||
input_list = [input] if isinstance(input, str) else input
|
||||
has_file_refs = any(
|
||||
_is_file_reference(e) for e in input_list if isinstance(e, str)
|
||||
)
|
||||
if has_file_refs and not api_key:
|
||||
raise ValueError(
|
||||
"An API key is required to resolve Gemini file references (files/...). "
|
||||
"Pass api_key= or set GEMINI_API_KEY."
|
||||
)
|
||||
resolved_files = {}
|
||||
if api_key and _is_multimodal_input(input):
|
||||
resolved_files = await self._async_resolve_file_references(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue