Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
supa-thibaud committed Aug 23, 2024
1 parent 0a04187 commit ce2149d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ async def request_chat_completions(self, model="default", messages=None, max_tok
async for line in response.content.iter_any():
yield line.decode()
else:
return await response.json()
yield await response.json()

async def request_completions(self, model="default", prompt="The capital of France is", max_tokens=100, stream=False, frequency_penalty=0.0, n=1, stop=None, temperature=1.0, top_p=1.0):
data = {
Expand All @@ -154,8 +154,8 @@ async def request_completions(self, model="default", prompt="The capital of Fran
async for line in response.content.iter_any():
yield line.decode()
else:
return await response.json()
yield await response.json()

async def get_models(self):
async with self.session.get(f"{self.base_url}/models") as response:
return await response.json()
yield await response.json()
4 changes: 2 additions & 2 deletions src/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ async def async_handler(job):
async for chunk in openai_request.request_completions(**openai_input):
yield chunk
elif openai_route == "/v1/models":
models = await openai_request.get_models()
yield models
async for models in openai_request.get_models():
yield models
else:
generate_url = f"{engine.base_url}/generate"
headers = {"Content-Type": "application/json"}
Expand Down

0 comments on commit ce2149d

Please sign in to comment.