Skip to content

Conversation

@schumannc
Copy link
Collaborator

@schumannc schumannc commented Feb 22, 2024

New Endpoint for Chat Responses without Session ID:

Adding an endpoint to handle chats without a session ID. This could be especially useful for stateless interactions where context retention isn't necessary.

#118

@vmesel
Copy link
Member

vmesel commented Feb 22, 2024

Hey @schumannc thanks for your PR, just to clarify: the intention here is to have a chat endpoint that does not have a session id, thus not creating memory instances and everything else, right?

Talking to @walison17, we could maintain this endpoint, but we should rename this endpoint to /ask so we have a more explicit name on this endpoint and what it does.

@vmesel
Copy link
Member

vmesel commented Feb 22, 2024

Also @schumannc could you share more of the use case you think makes this change necessary?

@avelino avelino requested review from vmesel and walison17 February 22, 2024 19:33
@schumannc
Copy link
Collaborator Author

Another way would be implement the router using plugins, but I would keep the other changes to bypass the memory chat.

src/main.py Outdated


@app.post("/chat")
async def post_message(message: Chat):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a route with the same name

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ask sounds better, right?

self.assertIn("message", response.json())

def test_post_message_no_session_id(self):
response = client.post(f"/chat", json={"message": "Hello"})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
response = client.post(f"/chat", json={"message": "Hello"})
response = client.post("/chat", json={"message": "Hello"})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with this suggestion

self.assertIn("message", response.json())

def test_post_message_no_session_id(self):
response = client.post(f"/chat", json={"message": "Hello"})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with this suggestion

src/main.py Outdated


@app.post("/chat")
async def post_message(message: Chat):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ask sounds better, right?

@vmesel vmesel merged commit 556221f into talkdai:main Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants