enh: ollama manifold

This commit is contained in:
Timothy J. Baek 2024-05-28 17:20:06 -07:00
parent a18a31b130
commit 3848d40721

View File

@ -24,13 +24,11 @@ class Pipeline:
OLLAMA_BASE_URL: str
self.valves = Valves(**{"OLLAMA_BASE_URL": "http://localhost:11435"})
self.pipelines = []
pass
async def on_startup(self):
# This function is called when the server is started or after valves are updated.
print(f"on_startup:{__name__}")
self.pipelines = self.get_ollama_models()
pass
async def on_shutdown(self):
@ -58,6 +56,11 @@ class Pipeline:
else:
return []
# Pipelines are the models that are available in the manifold.
# It can be a list or a function that returns a list.
def pipelines(self) -> List[dict]:
return self.get_ollama_models()
def pipe(
self, user_message: str, model_id: str, messages: List[dict], body: dict
) -> Union[str, Generator, Iterator]: