Added simple echo example

This commit is contained in:
Helge-Mikael Nordgård 2025-01-23 20:08:47 +01:00
parent 2c2c1cd49c
commit badff18961
2 changed files with 25 additions and 1 deletions

23
01_pipeline_tester.py Normal file
View File

@ -0,0 +1,23 @@
from typing import List, Union, Generator, Iterator
class Pipeline:
def __init__(self):
self.name = "Simple pipeline tester"
pass
async def on_startup(self):
# This function is called when the server is started.
print(f"on_startup:{__name__}")
pass
async def on_shutdown(self):
# This function is called when the server is shutdown.
print(f"on_shutdown:{__name__}")
pass
def pipe(self, user_message: str, model_id: str, messages: List[dict], body: dict) -> Union[str, Generator, Iterator]:
# This function is called when a new user_message is receieved.
print(f"received message from user: {user_message}") #user_message to logs
return (f"received message from user: {user_message}") #user_message to the UI

View File

@ -3,3 +3,4 @@
These python scripts are meant as a pipeline between Openweb UI and Openrouter
1. 00: Queries a openrouter model and returns the response to the chat
2. 01: Simple Echo example