Skip to content

Commit

Permalink
💎 [Feature] ChatAPI: Support /v1 prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Hansimov committed Dec 9, 2023
1 parent 84cebc2 commit bb9b91b
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions apis/chat_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from conversations import (
ConversationConnector,
ConversationCreator,
ConversationSession,
MessageComposer,
)

Expand Down Expand Up @@ -136,25 +135,26 @@ def chat_completions(self, item: ChatCompletionsPostItem):
)

def setup_routes(self):
self.app.get(
"/models",
summary="Get available models",
)(self.get_available_models)

self.app.post(
"/create",
summary="Create a conversation session",
)(self.create_conversation_session)

self.app.post(
"/chat",
summary="Chat in conversation session",
)(self.chat)

self.app.post(
"/chat/completions",
summary="Chat completions in conversation session",
)(self.chat_completions)
for prefix in ["", "/v1"]:
self.app.get(
prefix + "/models",
summary="Get available models",
)(self.get_available_models)

self.app.post(
prefix + "/create",
summary="Create a conversation session",
)(self.create_conversation_session)

self.app.post(
prefix + "/chat",
summary="Chat in conversation session",
)(self.chat)

self.app.post(
prefix + "/chat/completions",
summary="Chat completions in conversation session",
)(self.chat_completions)


app = ChatAPIApp().app
Expand Down

0 comments on commit bb9b91b

Please sign in to comment.