ka1kuk commited on
Commit
58bcd2f
·
1 Parent(s): 22591ce

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -13
main.py CHANGED
@@ -16,16 +16,7 @@ app.add_middleware( # add the middleware
16
  def hello():
17
  return "Hello, I'm Artist"
18
 
19
- @app.post('/generate_completion')
20
- async def generate_completion(
21
- model: str = Query('gpt-4', description='The model to use for generating the completion'),
22
- messages: List[Dict[str, str]] = Query(..., description='The list of messages to generate the completion for'),
23
- stream: bool = Query(False, description='Whether to stream the response')
24
- ):
25
- response = index._create_completion(model=model, messages=messages, stream=stream)
26
-
27
- result = []
28
- for message in response:
29
- result.append(message)
30
-
31
- return result
 
16
  def hello():
17
  return "Hello, I'm Artist"
18
 
19
+ @app.post("/generate")
20
+ def generate_completion(message: Message):
21
+ response = Linlada._create_completion(model='gpt-4', messages=[{"role": message.role, "content": message.content}], stream=False)
22
+ return response