gpt4free icon indicating copy to clipboard operation
gpt4free copied to clipboard

[OpenaiChat] Adding the 'system' role

Open iG8R opened this issue 1 year ago • 4 comments
trafficstars

Could you please add the system role to the OpenaiChat provider and other gpt-compatible providers with the corresponding field in the WebUI. https://platform.openai.com/docs/guides/text-generation

iG8R avatar Feb 22 '24 18:02 iG8R

You can set globally a system message in OpenAI Chat, but not for a conversation. By default the system message are added to the user message with System: and then the message. But if you write: Instructions: and then the system message, it should works better.

hlohaus avatar Feb 22 '24 18:02 hlohaus

E.g. if I need OpenaiChat to translate some text with the system message, i have to write the following in the prompt field? Instructions: You are a professional, authentic translation engine, only returns translations. Translate the following text to English: /here is some text/ But how OpenaiChat separate Instructions: from Translate the following text to English:?

iG8R avatar Feb 22 '24 19:02 iG8R

There is no reason to separate it. It is also a instruction. But between the instructions and the text, you should add 2 or 3 line breaks.

hlohaus avatar Feb 22 '24 19:02 hlohaus

I.e. from the example above I need to do the following:

Instructions: You are a professional, authentic translation engine, only returns translations.



Translate the following text to English: /here is some text/

Sure, this approach could be used, but as a temporary roundabout measure, since dedicated field in the WebUI with the corresponding field in the request would still be preferable and more reasonable, because it is unknown how OpenaiChat would be counting the respective number of tokens in the request with Instructions:... in the role's content and in the system's content.

iG8R avatar Feb 22 '24 19:02 iG8R

Why you are using not the API from OpenAI? I can't change companys

hlohaus avatar Feb 25 '24 11:02 hlohaus

Why you are using not the API from OpenAI?

What do you mean? I exactly try to use OpenAI API - https://help.openai.com/en/articles/7042661-moving-from-completions-to-chat-completions-in-the-openai-api - which postulates:

You can also use a system level instruction to guide the model's behavior throughout the conversation.

There is also a man here who was wondering the same thing - https://community.openai.com/t/understanding-role-management-in-openais-api-two-methods-compared/253289

iG8R avatar Feb 25 '24 14:02 iG8R

OpenaiChat use not the Chat API. It use the Frontend of chat.openai.com, because it is free. You can use system messages only with the paid API.

hlohaus avatar Feb 26 '24 08:02 hlohaus

IMHO, it's not quite like that. I use following apps to translate texts using g4f as an API proxy:

  1. pot-desktop https://github.com/pot-app/pot-desktop
  2. immersive-translate https://github.com/immersive-translate/immersive-translate/

Here are their settings, which differ only in the system fields:

But, the translation differs in meaning and fluent in some places quite a lot. image

iG8R avatar Feb 26 '24 12:02 iG8R

I added a message history and system message support to OpenaiChat. I convert now the messages for the Chat API. #1637

hlohaus avatar Feb 26 '24 22:02 hlohaus

@hlohaus Custom instructions from the web app are transferred to the G4F. Is this intended behavior?

nullstreak avatar Feb 28 '24 10:02 nullstreak

It is a excepted behavior. It is the Web API.

hlohaus avatar Feb 28 '24 11:02 hlohaus

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

github-actions[bot] avatar Mar 07 '24 00:03 github-actions[bot]

Is it possible to add a message support into the WebUI? So that there are 2 separate text input fields for message and for user.

iG8R avatar Mar 07 '24 11:03 iG8R

Like in LiaobotsUI

image

iG8R avatar Mar 07 '24 12:03 iG8R

Thank you very much!

iG8R avatar Mar 15 '24 01:03 iG8R