Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

feat(vertex_httpx.py): return vertex grounding, citation, and safety results

Krrish Dholakiad471f7e840a4
diff --git a/litellm/llms/vertex_httpx.py b/litellm/llms/vertex_httpx.py
index 9018a901b0b..ce6a31d7bda 100644
--- a/litellm/llms/vertex_httpx.py
+++ b/litellm/llms/vertex_httpx.py
@@ -421,12 +421,13 @@ class VertexGeminiConfig:
)
gtool_func_declarations.append(gtool_func_declaration)
except KeyError:
- # assume it's a provider-specific param
- verbose_logger.warning(
- "Got KeyError parsing tool={}. Assuming it's a provider-specific param. Use `litellm.set_verbose` or `litellm --detailed_debug` to see raw request."
- )
if tool.get("googleSearchRetrieval", None) is not None:
googleSearchRetrieval = tool["googleSearchRetrieval"]
+ else:
+ # assume it's a provider-specific param
+ verbose_logger.warning(
+ "Got KeyError parsing tool={}. Assuming it's a provider-specific param. Use `litellm.set_verbose` or `litellm --detailed_debug` to see raw request."
+ )
_tools = Tools(
function_declarations=gtool_func_declarations,
)
@@ -766,16 +767,23 @@ class VertexLLM(BaseLLM):
setattr(model_response, "usage", usage)
## ADD GROUNDING METADATA ##
- model_response._hidden_params["vertex_ai_grounding_metadata"] = (
+ setattr(model_response, "vertex_ai_grounding_metadata", grounding_metadata)
+ model_response._hidden_params[
+ "vertex_ai_grounding_metadata"
+ ] = ( # older approach - maintaining to prevent regressions
grounding_metadata
)
## ADD SAFETY RATINGS ##
- model_response._hidden_params["vertex_ai_safety_results"] = safety_ratings
+ setattr(model_response, "vertex_ai_safety_results", safety_ratings)
+ model_response._hidden_params["vertex_ai_safety_results"] = (
+ safety_ratings # older approach - maintaining to prevent regressions
+ )
## ADD CITATION METADATA ##
+ setattr(model_response, "vertex_ai_citation_metadata", citation_metadata)
model_response._hidden_params["vertex_ai_citation_metadata"] = (
- citation_metadata
+ citation_metadata # older approach - maintaining to prevent regressions
)
except Exception as e:
diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yaml
index 0ccc2666027..711cb2d31ba 100644
--- a/litellm/proxy/_new_secret_config.yaml
+++ b/litellm/proxy/_new_secret_config.yaml
@@ -1,7 +1,7 @@
model_list:
- - model_name: "claude-3-5-sonnet-20240620"
+ - model_name: "*"
litellm_params:
- model: "claude-3-5-sonnet-20240620"
+ model: "*"
litellm_settings:
max_internal_user_budget: 0.001