Enhancement: Add Support for Conversational Continuity Detection Using finish_reason #3567
RodrigoX1
started this conversation in
Feature Requests & Suggestions
Replies: 1 comment
-
Finish reason is partly used already, primarily for triggering the "Continue" button. LibreChat/api/app/clients/OpenAIClient.js Line 661 in 270c6d2 I think the easiest implementation would be provide the metadata via hover somewhere on messages if |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What features would you like to see added?
Background
In the context of using the OpenAI API for conversational applications, it's crucial to determine when a response from the API indicates that the conversation should continue. The
finish_reason
field provided in the API response helps identify whether the response was truncated, blocked, or completed naturally.Proposed Improvement
I propose adding functionality to detect the
finish_reason
from the OpenAI API response and handle each case appropriately. This would enhance the user experience by ensuring that conversations continue smoothly and that users are informed when a response is incomplete or blocked.Examples of finish_reason in OpenAI API Responses
1.
stop
Finish ReasonThe text generation was completed because the API encountered one of the stop tokens provided or reached the end of the prompt.
The finish_reason is "stop" because the API completed the response as intended.
2.
length
Finish ReasonThe text generation was cut off because it reached the maximum token limit for the response.
The finish_reason is "length" because the response was truncated when it hit the token limit.
3.
content_filter
Finish ReasonThe text generation was stopped by OpenAI's content filter because the generated text violated safety and use guidelines.
The finish_reason is "content_filter" because the content filter detected potentially harmful or inappropriate content.
4.
null
Finish ReasonNo specific reason was provided for the completion of the response. This might be used in cases where the response is terminated for unspecified reasons.
The finish_reason is "null" because there wasn't a clear reason for the termination of the response.
stop
length
content_filter
null
More details
Example Code
Here is a sample implementation of the proposed functionality in Python:
Beta Was this translation helpful? Give feedback.
All reactions