mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
docs: add docstring to modify_url
This commit is contained in:
parent
f99fb5f27f
commit
c2cdd38ce3
1 changed files with 10 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue