forked from phoenix/litellm-mirror
fix(proxy_server.py): allow post-call rules to be passed in as a file
This commit is contained in:
parent
33906656ba
commit
adaf341f54
2 changed files with 8 additions and 1 deletions
4
litellm/proxy/_experimental/post_call_rules.py
Normal file
4
litellm/proxy/_experimental/post_call_rules.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
def my_custom_rule(input): # receives the model response
|
||||
# if len(input) < 5: # trigger fallback if the model response is too short
|
||||
return False
|
||||
return True
|
|
@ -513,6 +513,9 @@ def load_router_config(router: Optional[litellm.Router], config_file_path: str):
|
|||
elif key == "callbacks":
|
||||
litellm.callbacks = [get_instance_fn(value=value, config_file_path=config_file_path)]
|
||||
print_verbose(f"{blue_color_code} Initialized Callbacks - {litellm.callbacks} {reset_color_code}")
|
||||
elif key == "post_call_rules":
|
||||
litellm.post_call_rules = [get_instance_fn(value=value, config_file_path=config_file_path)]
|
||||
print(f"litellm.post_call_rules: {litellm.post_call_rules}")
|
||||
elif key == "success_callback":
|
||||
litellm.success_callback = []
|
||||
|
||||
|
@ -1065,7 +1068,7 @@ async def embeddings(request: Request, user_api_key_dict: UserAPIKeyAuth = Depen
|
|||
|
||||
if data.get("user", None) is None and user_api_key_dict.user_id is not None:
|
||||
data["user"] = user_api_key_dict.user_id
|
||||
|
||||
|
||||
data["model"] = (
|
||||
general_settings.get("embedding_model", None) # server default
|
||||
or user_model # model name passed via cli args
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue