Skip to content

Instantly share code, notes, and snippets.

@toandaominh1997
Created December 1, 2024 19:01
Show Gist options
  • Save toandaominh1997/73758907cd968bc0295bab9335738b63 to your computer and use it in GitHub Desktop.
Save toandaominh1997/73758907cd968bc0295bab9335738b63 to your computer and use it in GitHub Desktop.
from typing import List, Union, Generator, Iterator
import os
class Pipeline:
def __init__(self):
self.index = 0
async def on_startup(self):
# This function is called when the server is started.
pass
async def on_shutdown(self):
# This function is called when the server is stopped.
pass
def pipe(
self, user_message: str, model_id: str, messages: List[dict], body: dict
) -> Union[str, Generator, Iterator]:
self.index += 1
return f"Index at {self.index}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment