mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
LiteLLM Minor Fixes & Improvements (10/24/2024) (#6421)
* fix(utils.py): support passing dynamic api base to validate_environment Returns True if just api base is required and api base is passed * fix(litellm_pre_call_utils.py): feature flag sending client headers to llm api Fixes https://github.com/BerriAI/litellm/issues/6410 * fix(anthropic/chat/transformation.py): return correct error message * fix(http_handler.py): add error response text in places where we expect it * fix(factory.py): handle base case of no non-system messages to bedrock Fixes https://github.com/BerriAI/litellm/issues/6411 * feat(cohere/embed): Support cohere image embeddings Closes https://github.com/BerriAI/litellm/issues/6413 * fix(__init__.py): fix linting error * docs(supported_embedding.md): add image embedding example to docs * feat(cohere/embed): use cohere embedding returned usage for cost calc * build(model_prices_and_context_window.json): add embed-english-v3.0 details (image cost + 'supports_image_input' flag) * fix(cohere_transformation.py): fix linting error * test(test_proxy_server.py): cleanup test * test: cleanup test * fix: fix linting errors
This commit is contained in:
parent
38708a355a
commit
c03e5da41f
23 changed files with 417 additions and 150 deletions
|
@ -5197,7 +5197,9 @@ def create_proxy_transport_and_mounts():
|
|||
|
||||
|
||||
def validate_environment( # noqa: PLR0915
|
||||
model: Optional[str] = None, api_key: Optional[str] = None
|
||||
model: Optional[str] = None,
|
||||
api_key: Optional[str] = None,
|
||||
api_base: Optional[str] = None,
|
||||
) -> dict:
|
||||
"""
|
||||
Checks if the environment variables are valid for the given model.
|
||||
|
@ -5224,11 +5226,6 @@ def validate_environment( # noqa: PLR0915
|
|||
_, custom_llm_provider, _, _ = get_llm_provider(model=model)
|
||||
except Exception:
|
||||
custom_llm_provider = None
|
||||
# # check if llm provider part of model name
|
||||
# if model.split("/",1)[0] in litellm.provider_list:
|
||||
# custom_llm_provider = model.split("/", 1)[0]
|
||||
# model = model.split("/", 1)[1]
|
||||
# custom_llm_provider_passed_in = True
|
||||
|
||||
if custom_llm_provider:
|
||||
if custom_llm_provider == "openai":
|
||||
|
@ -5497,6 +5494,17 @@ def validate_environment( # noqa: PLR0915
|
|||
if "api_key" not in key.lower():
|
||||
new_missing_keys.append(key)
|
||||
missing_keys = new_missing_keys
|
||||
|
||||
if api_base is not None:
|
||||
new_missing_keys = []
|
||||
for key in missing_keys:
|
||||
if "api_base" not in key.lower():
|
||||
new_missing_keys.append(key)
|
||||
missing_keys = new_missing_keys
|
||||
|
||||
if len(missing_keys) == 0: # no missing keys
|
||||
keys_in_environment = True
|
||||
|
||||
return {"keys_in_environment": keys_in_environment, "missing_keys": missing_keys}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue