docs: add docstring to modify_url

This commit is contained in:
Ishaan Jaffer 2026-05-20 18:03:19 -07:00
parent f99fb5f27f
commit c2cdd38ce3
No known key found for this signature in database

View file

@ -6225,6 +6225,16 @@ def function_to_dict(input_function) -> dict: # noqa: C901
def modify_url(original_url, new_path):
"""
Replace the path component of a URL while preserving the scheme, host, port, and query parameters.
Args:
original_url (str): The original URL whose path will be replaced.
new_path (str): The new path to use (e.g. "/v1/chat/completions").
Returns:
str: The modified URL as a string with the updated path.
"""
url = httpx.URL(original_url)
modified_url = url.copy_with(path=new_path)
return str(modified_url)