mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 10:14:26 +00:00
test_assistants_passthrough_logging
This commit is contained in:
parent
b076ae9bc8
commit
7e24a5bea0
3 changed files with 22 additions and 1 deletions
|
@ -534,6 +534,7 @@ async def pass_through_request( # noqa: PLR0915
|
|||
passthrough_logging_payload = PassthroughStandardLoggingPayload(
|
||||
url=str(url),
|
||||
request_body=_parsed_body,
|
||||
request_method=getattr(request, "method", None),
|
||||
)
|
||||
kwargs = _init_kwargs_for_pass_through_endpoint(
|
||||
user_api_key_dict=user_api_key_dict,
|
||||
|
|
|
@ -14,5 +14,21 @@ class PassthroughStandardLoggingPayload(TypedDict, total=False):
|
|||
"""
|
||||
|
||||
url: str
|
||||
"""
|
||||
The full url of the request
|
||||
"""
|
||||
|
||||
request_method: Optional[str]
|
||||
"""
|
||||
The method of the request
|
||||
"GET", "POST", "PUT", "DELETE", etc.
|
||||
"""
|
||||
|
||||
request_body: Optional[dict]
|
||||
"""
|
||||
The body of the request
|
||||
"""
|
||||
response_body: Optional[dict] # only tracked for non-streaming responses
|
||||
"""
|
||||
The body of the response
|
||||
"""
|
||||
|
|
|
@ -38,12 +38,13 @@ async def test_assistants_passthrough_logging():
|
|||
"tools": [{"type": "code_interpreter"}],
|
||||
"model": "gpt-4o"
|
||||
}
|
||||
TARGET_METHOD = "POST"
|
||||
|
||||
result = await pass_through_request(
|
||||
request=Request(
|
||||
scope={
|
||||
"type": "http",
|
||||
"method": "POST",
|
||||
"method": TARGET_METHOD,
|
||||
"path": "/v1/assistants",
|
||||
"query_string": b"",
|
||||
"headers": [
|
||||
|
@ -86,5 +87,8 @@ async def test_assistants_passthrough_logging():
|
|||
client_facing_response_body = json.loads(result.body)
|
||||
assert passthrough_logging_payload["response_body"] == client_facing_response_body
|
||||
|
||||
# assert that the request method is correct
|
||||
assert passthrough_logging_payload["request_method"] == TARGET_METHOD
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue