Fix: get LiteLLM models on init

This commit is contained in:
Justin Hayes 2024-08-02 15:45:38 -04:00
parent ba1af55615
commit ef88564520

View File

@ -2,7 +2,7 @@
title: LiteLLM Manifold Pipeline
author: open-webui
date: 2024-05-30
version: 1.0
version: 1.0.1
license: MIT
description: A manifold pipeline that uses LiteLLM.
"""
@ -46,7 +46,8 @@ class Pipeline:
"LITELLM_PIPELINE_DEBUG": os.getenv("LITELLM_PIPELINE_DEBUG", False),
}
)
self.pipelines = []
# Get models on initialization
self.pipelines = self.get_litellm_models()
pass
async def on_startup(self):
@ -85,7 +86,7 @@ class Pipeline:
for model in models["data"]
]
except Exception as e:
print(f"Error: {e}")
print(f"Error fetching models from LiteLLM: {e}")
return [
{
"id": "error",
@ -93,6 +94,7 @@ class Pipeline:
},
]
else:
print("LITELLM_BASE_URL not set. Please configure it in the valves.")
return []
def pipe(