mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-17 23:51:30 +00:00
(sap) fix after bot review
This commit is contained in:
parent
43d84b1334
commit
9415f5864b
2 changed files with 8 additions and 2 deletions
|
|
@ -30,7 +30,7 @@ else:
|
|||
LiteLLMLoggingObj = Any
|
||||
|
||||
from ..credentials import get_token_creator
|
||||
from .models import ResponseFormatJSONSchema, ResponseFormat, OrchestrationRequest
|
||||
from .models import ResponseFormatJSONSchema, ResponseFormat, OrchestrationRequest, ChatCompletionTool
|
||||
from .handler import (
|
||||
GenAIHubOrchestrationError,
|
||||
AsyncSAPStreamIterator,
|
||||
|
|
@ -220,12 +220,13 @@ class GenAIHubOrchestrationConfig(OpenAIGPTConfig):
|
|||
# Filter strict for GPT models only - SAP AI Core doesn't accept it as a model param
|
||||
# LangChain agents pass strict=true at top level, which fails for GPT models
|
||||
# Anthropic models accept strict, so preserve it for them
|
||||
if model.startswith("gpt") and "strict" in params:
|
||||
if model_name.startswith("gpt") and "strict" in params:
|
||||
params.pop("strict")
|
||||
|
||||
model_version = params.pop("model_version", "latest")
|
||||
|
||||
tools_ = params.pop("tools", [])
|
||||
tools_ = [validate_dict(tool, ChatCompletionTool) for tool in tools_]
|
||||
tools = {"tools": tools_} if tools_ else {}
|
||||
|
||||
response_format = params.pop("response_format", {})
|
||||
|
|
|
|||
|
|
@ -48,6 +48,11 @@ class TestSAPTransformationIntegration:
|
|||
prompt = result["config"]["modules"]["prompt_templating"]["prompt"]
|
||||
if "tools" in prompt:
|
||||
assert isinstance(prompt["tools"], list)
|
||||
for tool in prompt["tools"]:
|
||||
assert tool["function"]["parameters"]["type"] == "object", (
|
||||
"SAP API requires parameters.type == 'object'"
|
||||
)
|
||||
assert "properties" in tool["function"]["parameters"]
|
||||
|
||||
def test_transform_request_parameter_handling_robustness(self, mock_config):
|
||||
"""Test transform_request method handles various parameter combinations correctly."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue