matthoffner commited on
Commit
acc58cf
1 Parent(s): 39f02cd

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -11
main.py CHANGED
@@ -7,8 +7,8 @@ from fastapi.responses import HTMLResponse
7
  from fastapi.middleware.cors import CORSMiddleware
8
  from sse_starlette.sse import EventSourceResponse
9
  from ctransformers.langchain import CTransformers
10
- from pydantic import BaseModel
11
- from typing import List, Any, Field
12
  from typing_extensions import TypedDict, Literal
13
 
14
  llm = AutoModelForCausalLM.from_pretrained("NeoDim/starchat-alpha-GGML",
@@ -31,16 +31,8 @@ async def index():
31
  html_content = markdown.markdown(md_template_string)
32
  return HTMLResponse(content=html_content, status_code=200)
33
 
34
- class ChatCompletionRequestMessage(BaseModel):
35
- role: Literal["system", "user", "assistant"] = Field(
36
- default="user", description="The role of the message."
37
- )
38
- content: str = Field(default="", description="The content of the message.")
39
-
40
  class ChatCompletionRequest(BaseModel):
41
- messages: List[ChatCompletionRequestMessage] = Field(
42
- default=[], description="A list of messages to generate completions for."
43
- )
44
 
45
  @app.post("/v1/chat/completions")
46
  async def chat(request: ChatCompletionRequest, response_mode=None):
 
7
  from fastapi.middleware.cors import CORSMiddleware
8
  from sse_starlette.sse import EventSourceResponse
9
  from ctransformers.langchain import CTransformers
10
+ from pydantic import BaseModel, Field
11
+ from typing import List, Any
12
  from typing_extensions import TypedDict, Literal
13
 
14
  llm = AutoModelForCausalLM.from_pretrained("NeoDim/starchat-alpha-GGML",
 
31
  html_content = markdown.markdown(md_template_string)
32
  return HTMLResponse(content=html_content, status_code=200)
33
 
 
 
 
 
 
 
34
  class ChatCompletionRequest(BaseModel):
35
+ prompt: str
 
 
36
 
37
  @app.post("/v1/chat/completions")
38
  async def chat(request: ChatCompletionRequest, response_mode=None):