move all code to root

This commit is contained in:
SvenBrnn
2025-05-22 05:24:15 +00:00
parent b44de8fd6b
commit 2a9f1a4882
8 changed files with 2 additions and 2 deletions
+32
View File
@@ -0,0 +1,32 @@
import runpod
from utils import JobInput
from engine import OllamaEngine, OllamaOpenAiEngine
async def handler(job: any):
# Just dump the whole input to the console and then return an {"ok": True} response
print('Job:', job)
job_input = JobInput(job["input"])
engine_class = OllamaOpenAiEngine if job_input.openai_route else OllamaEngine
engine = engine_class() # Instantiate the engine
job = engine.generate(job_input) # Call generate with job_input
async for batch in job:
yield batch
# Original code from vllm runpod_wrapper.py
#async def handler(job):
# job_input = JobInput(job["input"])
# engine = OpenAIvLLMEngine if job_input.openai_route else vllm_engine
# results_generator = engine.generate(job_input)
# async for batch in results_generator:
# yield batch
runpod.serverless.start(
{
"handler": handler,
"return_aggregate_stream": True,
}
)