Skip to content

Commit ddd762f

Browse files
committed
docs: keep batch processing server example
1 parent cbc0fa0 commit ddd762f

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""llama-cpp-python server from scratch in a single file.
2+
"""
3+
4+
# import llama_cpp
5+
6+
# path = b"../../models/Qwen1.5-0.5B-Chat-GGUF/qwen1_5-0_5b-chat-q8_0.gguf"
7+
8+
# model_params = llama_cpp.llama_model_default_params()
9+
# model = llama_cpp.llama_model_load_from_file(path, model_params)
10+
11+
# if model is None:
12+
# raise RuntimeError(f"Failed to load model from file: {path}")
13+
14+
15+
# ctx_params = llama_cpp.llama_context_default_params()
16+
# ctx = llama_cpp.llama_init_from_model(model, ctx_params)
17+
18+
# if ctx is None:
19+
# raise RuntimeError("Failed to create context")
20+
21+
22+
from fastapi import FastAPI
23+
24+
app = FastAPI()
25+
26+
import openai.types.chat as types
27+
28+
29+
@app.post("/v1/chat/completions")
30+
def create_chat_completions():
31+
return {"message": "Hello World"}

0 commit comments

Comments
 (0)